From: Moodle HQ git importer Date: Wed, 27 May 2009 00:36:40 +0000 (+0000) Subject: fix git cvs drift X-Git-Url: http://git.mjollnir.org/gw?a=commitdiff_plain;h=11e1f828968b70ccbee5b636ddb3d10dcd031b3d;p=moodle.git fix git cvs drift --- diff --git a/lib/dmllib.php b/lib/dmllib.php index a6909d88e2..708c8149f7 100644 --- a/lib/dmllib.php +++ b/lib/dmllib.php @@ -1,46 +1,57 @@ -. +/** + * This library contains all the Data Manipulation Language (DML) functions + * used to interact with the DB + * + * This library contains all the Data Manipulation Language (DML) functions + * used to interact with the DB. All the dunctions in this library must be + * generic and work against the major number of RDBMS possible. This is the + * list of currently supported and tested DBs: mysql, postresql, mssql, oracle + + * This library is automatically included by Moodle core so you never need to + * include it yourself. + + * For more info about the functions available in this library, please visit: + * http://docs.moodle.org/en/DML_functions + * (feel free to modify, improve and document such page, thanks!) + * + * @copyright 1999 onwards Martin Dougiamas {@link http://moodle.com} + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + * @package moodlecore + */ + + /** Require the essential */ require_once($CFG->libdir.'/dml/moodle_database.php'); /** * DML exception class, use instead of error() in dml code. + * + * @copyright 1999 onwards Martin Dougiamas {@link http://moodle.com} + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + * @package moodlecore */ class dml_exception extends moodle_exception { + /** + * @param string $errorcode + * @param string $a + * @param string $debuginfo + */ function __construct($errorcode, $a=NULL, $debuginfo=null) { parent::__construct($errorcode, '', '', $a, $debuginfo); } @@ -48,8 +59,15 @@ class dml_exception extends moodle_exception { /** * DML db connection exception - triggered if database not accessible. + * + * @copyright 1999 onwards Martin Dougiamas {@link http://moodle.com} + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + * @package moodlecore */ class dml_connection_exception extends dml_exception { + /** + * @param string $error + */ function __construct($error) { $errorinfo = ''.s($error).''; parent::__construct('dbconnectionfailed', NULL, $errorinfo); @@ -58,12 +76,23 @@ class dml_connection_exception extends dml_exception { /** * DML read exception - triggered by SQL syntax errors, missing tables, etc. + * + * @copyright 1999 onwards Martin Dougiamas {@link http://moodle.com} + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + * @package moodlecore */ class dml_read_exception extends dml_exception { + /** @var string */ public $error; public $sql; + /** @var array */ public $params; - + + /** + * @param string $error + * @param string $sql + * @param array $params + */ function __construct($error, $sql=null, array $params=null) { $this->error = $error; $this->sql = $sql; @@ -75,12 +104,23 @@ class dml_read_exception extends dml_exception { /** * DML read exception - triggered by SQL syntax errors, missing tables, etc. + * + * @copyright 1999 onwards Martin Dougiamas {@link http://moodle.com} + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + * @package moodlecore */ class dml_write_exception extends dml_exception { + /** @var string */ public $error; public $sql; + /** @var array */ public $params; + /** + * @param string $error + * @param string $sql + * @param array $params + */ function __construct($error, $sql=null, array $params=null) { $this->error = $error; $this->sql = $sql; @@ -92,6 +132,9 @@ class dml_write_exception extends dml_exception { /** * Sets up global $DB moodle_database instance + * + * @global object + * @global object * @return void */ function setup_DB() { diff --git a/lib/eaccelerator.class.php b/lib/eaccelerator.class.php index 6ead149e12..44b7fc5956 100644 --- a/lib/eaccelerator.class.php +++ b/lib/eaccelerator.class.php @@ -1,24 +1,52 @@ - ** - ** Note: do NOT store booleans here. For compatibility with - ** memcached, a false value is indistinguisable from a - ** "not found in cache" response. - **/ +// This file is part of Moodle - http://moodle.org/ +// +// Moodle is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Moodle is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with Moodle. If not, see . + +/** + * This class abstracts eaccelerator/turckmmcache + * API to provide + * + * - get() + * - set() + * - delete() + * - getforfill() + * - releaseforfill() + * + * Note: do NOT store booleans here. For compatibility with + * memcached, a false value is indistinguisable from a + * "not found in cache" response. + * + * @copyright Martin Langhoff + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + * @package moodlecore + */ +/** + * + * @copyright Martin Langhoff + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + * @package moodlecore + */ class eaccelerator { + /** + * @todo Document this function + * + * @global object + */ function eaccelerator() { global $CFG; if ( function_exists('eaccelerator_get')) { @@ -32,6 +60,12 @@ class eaccelerator { $this->prefix = $CFG->dbname .'|' . $CFG->prefix . '|'; } + /** + * The status of the eaccelerator, if it has been established + * this will return true + * + * @return bool + */ function status() { if (isset($this->mode)) { return true; @@ -39,6 +73,14 @@ class eaccelerator { return false; } + /** + * @todo Document this function + * + * @param string $key + * @param string $value + * @param int $ttl + * @return mixed + */ function set($key, $value, $ttl=0) { $set = $this->mode . '_put'; $unlock = $this->mode . '_unlock'; @@ -50,6 +92,12 @@ class eaccelerator { return $set($this->prefix . $key, serialize($value), $ttl); } + /** + * @todo Document this function + * + * @param string $key + * @return string|bool String if success else false + */ function get($key) { $fn = $this->mode . '_get'; $rec = $fn($this->prefix . $key); @@ -58,7 +106,13 @@ class eaccelerator { } return unserialize($rec); } - + + /** + * @todo Document this function + * + * @param string $key + * @return mixed + */ function delete($key) { $fn = $this->mode . '_rm'; return $fn($this->prefix . $key); diff --git a/lib/editorlib.php b/lib/editorlib.php index b78cd42744..b86ddc0996 100644 --- a/lib/editorlib.php +++ b/lib/editorlib.php @@ -20,14 +20,19 @@ * * @package moodlecore * @subpackage editor - * @copyright 2009 Petr Skoda (http://skodak.org) + * @copyright 2009 Petr Skoda {@link http://skodak.org} * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ /** * Returns users preferred editor for given format + * + * @todo implement user preferences for text editors + * + * @global object + * @global object * @param int $format text format or null of none - * @return texeditor object + * @return object texteditor object */ function get_preferred_texteditor($format=null) { global $CFG, $USER; @@ -73,8 +78,10 @@ function get_preferred_texteditor($format=null) { /** * Returns instance of text editor + * + * @global object * @param string $editorname name of editor (textarea, tinymce, ...) - * @return mixed texeditor instance or false if does not exist + * @return object|bool texeditor instance or false if does not exist */ function get_texteditor($editorname) { global $CFG; @@ -93,7 +100,8 @@ function get_texteditor($editorname) { /** * Get the list of available editors - * @return array ('editorname'=>'localised editor name') + * + * @return array Array ('editorname'=>'localised editor name') */ function get_available_editors() { $editors = array(); @@ -105,6 +113,10 @@ function get_available_editors() { /** * Base abstract text editor class. + * + * @copyright 2009 Petr Skoda {@link http://skodak.org} + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + * @package moodlecore */ abstract class texteditor { /** @@ -115,7 +127,7 @@ abstract class texteditor { /** * Returns list of supported text formats - * @return array(FORMAT=>FORMAT) + * @return array Array (FORMAT=>FORMAT) */ public abstract function get_supported_formats(); @@ -127,7 +139,7 @@ abstract class texteditor { /** * Supports file picker and repos? - * @return book + * @return object book object */ public abstract function supports_repositories(); @@ -155,6 +167,9 @@ abstract class texteditor { //=== DEPRECATED ===================== /** * can_use_html_editor is deprecated... + * @deprecated + * @todo Deprecated: eradicate completely, replace with something else + * @return bool */ function can_use_html_editor() { //TODO: eradicate completely, replace with something else diff --git a/lib/eventslib.php b/lib/eventslib.php index 87ec286c25..ef9cae6bb4 100755 --- a/lib/eventslib.php +++ b/lib/eventslib.php @@ -1,23 +1,39 @@ . + /** * Library of functions for events manipulation. * * The public API is all at the end of this file. * - * @author Martin Dougiamas and many others - * @version $Id$ - * @license http://www.gnu.org/copyleft/gpl.html GNU Public License - * @package moodlecore + * @copyright 1999 onwards Martin Dougiamas {@link http://moodle.com} + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + * @package moodlecore */ - /** * Loads the events definitions for the component (from file). If no * events are defined for the component, we simply return an empty array. - * @param $component - examples: 'moodle', 'mod/forum', 'block/quiz_results' - * @return array of capabilities or empty array if not exists * * INTERNAL - to be used from eventslib only + * + * @global object + * @param string $component examples: 'moodle', 'mod/forum', 'block/quiz_results' + * @return array of capabilities or empty array if not exists */ function events_load_def($component) { global $CFG; @@ -71,10 +87,12 @@ function events_load_def($component) { /** * Gets the capabilities that have been cached in the database for this * component. - * @param $component - examples: 'moodle', 'mod/forum', 'block/quiz_results' - * @return array of events * * INTERNAL - to be used from eventslib only + * + * @global object + * @param string $component examples: 'moodle', 'mod/forum', 'block/quiz_results' + * @return array of events */ function events_get_cached($component) { global $DB; @@ -102,7 +120,8 @@ function events_get_cached($component) { * will cause any queued events for the component to be removed from * the database. * - * @param $component - examples: 'moodle', 'mod/forum', 'block/quiz_results' + * @global object + * @param string $component examples: 'moodle', 'mod/forum', 'block/quiz_results' * @return boolean */ function events_update_definition($component='moodle') { @@ -163,7 +182,8 @@ function events_update_definition($component='moodle') { /** * Remove all event handlers and queued events - * @param $component - examples: 'moodle', 'mod/forum', 'block/quiz_results' + * + * @param string $component examples: 'moodle', 'mod/forum', 'block/quiz_results' */ function events_uninstall($component) { $cachedhandlers = events_get_cached($component); @@ -172,11 +192,13 @@ function events_uninstall($component) { /** * Deletes cached events that are no longer needed by the component. - * @param $component - examples: 'moodle', 'mod/forum', 'block/quiz_results' - * @param $chachedevents - array of the cached events definitions that will be - * @return int - number of deprecated capabilities that have been removed * * INTERNAL - to be used from eventslib only + * + * @global object + * @param string $component examples: 'moodle', 'mod/forum', 'block/quiz_results' + * @param array $chachedevents array of the cached events definitions that will be + * @return int number of deprecated capabilities that have been removed */ function events_cleanup($component, $cachedhandlers) { global $DB; @@ -200,11 +222,14 @@ function events_cleanup($component, $cachedhandlers) { /** * puts a handler on queue - * @param object handler - event handler object from db - * @param object eventdata - event data object - * @return id number of new queue handler * * INTERNAL - to be used from eventslib only + * + * @global object + * @param object $handler event handler object from db + * @param object $event event data object + * @param string $errormessage The error message indicating the problem + * @return id number of new queue handler */ function events_queue_handler($handler, $event, $errormessage) { global $DB; @@ -231,12 +256,13 @@ function events_queue_handler($handler, $event, $errormessage) { /** * trigger a single event with a specified handler - * @param handler - hander object from db - * @param eventdata - event dataobject - * @param errormessage - error message indicating problem - * @return bool - success or fail * * INTERNAL - to be used from eventslib only + * + * @param handler $hander object from db + * @param eventdata $eventdata dataobject + * @param string $errormessage error message indicating problem + * @return bool success or fail */ function events_dispatch($handler, $eventdata, &$errormessage) { global $CFG; @@ -266,10 +292,13 @@ function events_dispatch($handler, $eventdata, &$errormessage) { /** * given a queued handler, call the respective event handler to process the event - * @param object qhandler - events_queued_handler object from db - * @return boolean meaning success, or NULL on fatal failure * * INTERNAL - to be used from eventslib only + * + * @global object + * @global object + * @param object $qhandler events_queued_handler object from db + * @return boolean meaning success, or NULL on fatal failure */ function events_process_queued_handler($qhandler) { global $CFG, $DB; @@ -312,10 +341,13 @@ function events_process_queued_handler($qhandler) { /** * removes this queued handler from the events_queued_handler table + * * removes events_queue record from events_queue if no more references to this event object exists - * @param object qhandler - events_queued_handler object from db * * INTERNAL - to be used from eventslib only + * + * @global object + * @param object $qhandler events_queued_handler object from db */ function events_dequeue($qhandler) { global $DB; @@ -331,10 +363,13 @@ function events_dequeue($qhandler) { /** * Returns hanflers for given event. Uses caching for better perf. - * @param string $eventanme name of even or 'reset' - * @return mixed array of handlers or false otherwise * * INTERNAL - to be used from eventslib only + * + * @global object + * @staticvar array $handlers + * @param string $eventanme name of even or 'reset' + * @return mixed array of handlers or false otherwise */ function events_get_handlers($eventname) { global $DB; @@ -357,10 +392,12 @@ function events_get_handlers($eventname) { /** * Events cron will try to empty the events queue by processing all the queued events handlers - * @param string eventname - empty means all - * @return number of dispatched+removed broken events * * PUBLIC + * + * @global object + * @param string $eventname empty means all + * @return number of dispatched+removed broken events */ function events_cron($eventname='') { global $DB; @@ -402,11 +439,15 @@ function events_cron($eventname='') { /** * Function to call all eventhandlers when triggering an event - * @param eventname - name of the event - * @param eventdata - event data object - * @return number of failed events * * PUBLIC + * + * @global object + * @global object + * @global object + * @param string $eventname name of the event + * @param object $eventdata event data object + * @return int number of failed events */ function events_trigger($eventname, $eventdata) { global $CFG, $USER, $DB; @@ -499,11 +540,11 @@ function events_trigger($eventname, $eventdata) { /** * checks if an event is registered for this component - * @param string eventname - name of the event - * @param string component - component name, can be mod/data or moodle - * @return bool * - * PUBLIC + * @global object + * @param string $eventname name of the event + * @param string $component component name, can be mod/data or moodle + * @return bool */ function events_is_registered($eventname, $component) { global $DB; @@ -512,10 +553,13 @@ function events_is_registered($eventname, $component) { /** * checks if an event is queued for processing - either cron handlers attached or failed instant handlers - * @param string eventname - name of the event - * @return int number of queued events * * PUBLIC + * + * @global object + * @global object + * @param string $eventname name of the event + * @return int number of queued events */ function events_pending_count($eventname) { global $CFG, $DB; diff --git a/userfile.php b/userfile.php index b4b6db1aea..04784ae4dd 100644 --- a/userfile.php +++ b/userfile.php @@ -16,7 +16,7 @@ // along with Moodle. If not, see . /** - * This script serves users private files + * This script serves user's private files * * @package moodlecore * @subpackage file