Permalink
Browse files

Merge branch 'master' of https://github.com/moodle/moodle

  • Loading branch information...
2 parents 9ea62d0 + 5bbf3cb commit bccdff582f876a8c74e08d78b523a5f51ea2fffb @wdjunaidi wdjunaidi committed Mar 1, 2012
Showing 372 changed files with 6,428 additions and 3,519 deletions.
@@ -18,8 +18,7 @@
/**
* Defines the capabilities used by the Language customization admin tool
*
- * @package tool
- * @subpackage customlang
+ * @package tool_customlang
* @copyright 2010 David Mudrak <david@moodle.com>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
@@ -17,12 +17,13 @@
/**
* Unitest caps.
*
- * @package tool
- * @subpackage unittest
+ * @package tool_unittest
* @copyright 1999 onwards Martin Dougiamas {@link http://moodle.com}
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
+defined('MOODLE_INTERNAL') || die();
+
$capabilities = array(
// Note: do not add managers here, unittests are dangerous and not intended for production sites!!!
@@ -16,17 +16,23 @@
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
- * @package moodlecore
- * @subpackage backup-moodle2
- * @copyright 2010 onwards Eloy Lafuente (stronk7) {@link http://stronk7.com}
- * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ * Defines backup_activity_task class
+ *
+ * @package core_backup
+ * @subpackage moodle2
+ * @category backup
+ * @copyright 2010 onwards Eloy Lafuente (stronk7) {@link http://stronk7.com}
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
+defined('MOODLE_INTERNAL') || die();
+
/**
- * abstract activity task that provides all the properties and common tasks to be performed
- * when one activity is being backup
+ * Provides all the settings and steps to perform one complete backup of the activity
*
- * TODO: Finish phpdocs
+ * Activities are supposed to provide the subclass of this class in their file
+ * mod/MODULENAME/backup/moodle2/backup_MODULENAME_activity_task.class.php
+ * The expected name of the subclass is backup_MODULENAME_activity_task
*/
abstract class backup_activity_task extends backup_task {
@@ -38,6 +44,10 @@
/**
* Constructor - instantiates one object of this class
+ *
+ * @param string $name the task identifier
+ * @param int $moduleid course module id (id in course_modules table)
+ * @param backup_plan|null $plan the backup plan instance this task is part of
*/
public function __construct($name, $moduleid, $plan = null) {
@@ -59,28 +69,43 @@ public function __construct($name, $moduleid, $plan = null) {
parent::__construct($name, $plan);
}
+ /**
+ * @return int the course module id (id in the course_modules table)
+ */
public function get_moduleid() {
return $this->moduleid;
}
+ /**
+ * @return int the course section id (id in the course_sections table)
+ */
public function get_sectionid() {
return $this->sectionid;
}
+ /**
+ * @return string the name of the module, eg 'workshop' (from the modules table)
+ */
public function get_modulename() {
return $this->modulename;
}
+ /**
+ * @return int the id of the activity instance (id in the activity's instances table)
+ */
public function get_activityid() {
return $this->activityid;
}
+ /**
+ * @return int the id of the associated CONTEXT_MODULE instance
+ */
public function get_contextid() {
return $this->contextid;
}
/**
- * Activity tasks have their own directory to write files
+ * @return string full path to the directory where this task writes its files
*/
public function get_taskbasepath() {
return $this->get_basepath() . '/activities/' . $this->modulename . '_' . $this->moduleid;
@@ -184,9 +209,11 @@ public function execute() {
/**
- * Specialisation that, first of all, looks for the setting within
- * the task with the the prefix added and later, delegates to parent
- * without adding anything
+ * Tries to look for the instance specific setting value, task specific setting value or the
+ * common plan setting value - in that order
+ *
+ * @param string $name the name of the setting
+ * @return mixed|null the value of the setting or null if not found
*/
public function get_setting($name) {
$namewithprefix = $this->modulename . '_' . $this->moduleid . '_' . $name;
@@ -211,7 +238,7 @@ public function get_setting($name) {
// Protected API starts here
/**
- * Define the common setting that any backup activity will have
+ * Defines the common setting that any backup activity will have
*/
protected function define_settings() {
@@ -264,21 +291,44 @@ protected function define_settings() {
}
/**
- * Define (add) particular settings that each activity can have
+ * Defines activity specific settings to be added to the common ones
+ *
+ * This method is called from {@link self::define_settings()}. The activity module
+ * author may use it to define additional settings that influence the execution of
+ * the backup.
+ *
+ * Most activities just leave the method empty.
+ *
+ * @see self::define_settings() for the example how to define own settings
*/
abstract protected function define_my_settings();
/**
- * Define (add) particular steps that each activity can have
+ * Defines activity specific steps for this task
+ *
+ * This method is called from {@link self::build()}. Activities are supposed
+ * to call {self::add_step()} in it to include their specific steps in the
+ * backup plan.
*/
abstract protected function define_my_steps();
/**
- * Code the transformations to perform in the activity in
- * order to get transportable (encoded) links
+ * Encodes URLs to the activity instance's scripts into a site-independent form
+ *
+ * The current instance of the activity may be referenced from other places in
+ * the course by URLs like http://my.moodle.site/mod/workshop/view.php?id=42
+ * Obvisouly, such URLs are not valid any more once the course is restored elsewhere.
+ * For this reason the backup file does not store the original URLs but encodes them
+ * into a transportable form. During the restore, the reverse process is applied and
+ * the encoded URLs are replaced with the new ones valid for the target site.
+ *
+ * Every plugin must override this method in its subclass.
+ *
+ * @see backup_xml_transformer class that actually runs the transformation
+ * @param string $content some HTML text that eventually contains URLs to the activity instance scripts
+ * @return string the content with the URLs encoded
*/
static public function encode_content_links($content) {
throw new coding_exception('encode_content_links() method needs to be overridden in each subclass of backup_activity_task');
}
-
}
@@ -16,12 +16,15 @@
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
- * @package moodlecore
- * @subpackage backup-moodle2
- * @copyright 2010 onwards Eloy Lafuente (stronk7) {@link http://stronk7.com}
- * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ * @package core_backup
+ * @subpackage moodle2
+ * @category backup
+ * @copyright 2010 onwards Eloy Lafuente (stronk7) {@link http://stronk7.com}
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
+defined('MOODLE_INTERNAL') || die();
+
/**
* abstract block task that provides all the properties and common steps to be performed
* when one block is being backup
@@ -16,10 +16,13 @@
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
- * @package moodlecore
- * @subpackage backup-moodle2
- * @copyright 2010 onwards Eloy Lafuente (stronk7) {@link http://stronk7.com}
- * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ * Defines backup_course_task
+ *
+ * @package core_backup
+ * @subpackage moodle2
+ * @category backup
+ * @copyright 2010 onwards Eloy Lafuente (stronk7) {@link http://stronk7.com}
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
/**
@@ -24,10 +24,11 @@
* backed up, a course report should make use of the second and third
* parameters in get_plugin_element().
*
- * @package moodlecore
- * @subpackage backup-moodle2
- * @copyright 2011 onwards The Open University
- * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ * @package core_backup
+ * @subpackage moodle2
+ * @category backup
+ * @copyright 2011 onwards The Open University
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
abstract class backup_coursereport_plugin extends backup_plugin {
// Use default parent behaviour
@@ -16,12 +16,17 @@
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
- * @package moodlecore
- * @subpackage backup-moodle2
- * @copyright 2010 onwards Eloy Lafuente (stronk7) {@link http://stronk7.com}
- * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ * Defines various element classes used in specific areas
+ *
+ * @package core_backup
+ * @subpackage moodle2
+ * @category backup
+ * @copyright 2010 onwards Eloy Lafuente (stronk7) {@link http://stronk7.com}
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
+defined('MOODLE_INTERNAL') || die();
+
/**
* Implementation of backup_final_element that provides one interceptor for anonymization of data
*
@@ -16,12 +16,17 @@
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
- * @package moodlecore
- * @subpackage backup-moodle2
- * @copyright 2010 onwards Eloy Lafuente (stronk7) {@link http://stronk7.com}
- * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ * Defines backup_default_block_task class
+ *
+ * @package core_backup
+ * @subpackage moodle2
+ * @category backup
+ * @copyright 2010 onwards Eloy Lafuente (stronk7) {@link http://stronk7.com}
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
+defined('MOODLE_INTERNAL') || die();
+
/**
* Default block task to backup blocks that haven't own DB structures to be added
* when one block is being backup
@@ -16,12 +16,17 @@
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
- * @package moodlecore
- * @subpackage backup-moodle2
- * @copyright 2010 onwards Eloy Lafuente (stronk7) {@link http://stronk7.com}
- * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ * Defines backup_final_task class
+ *
+ * @package core_backup
+ * @subpackage moodle2
+ * @category backup
+ * @copyright 2010 onwards Eloy Lafuente (stronk7) {@link http://stronk7.com}
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
+defined('MOODLE_INTERNAL') || die();
+
/**
* Final task that provides all the final steps necessary in order to finish one
* backup (mainly gathering references and creating the main xml) apart from
@@ -16,12 +16,17 @@
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
- * @package moodlecore
- * @subpackage backup-moodle2
- * @copyright 2011 onwards Eloy Lafuente (stronk7) {@link http://stronk7.com}
- * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ * Defines backup_format_plugin class
+ *
+ * @package core_backup
+ * @subpackage moodle2
+ * @category backup
+ * @copyright 2011 onwards Eloy Lafuente (stronk7) {@link http://stronk7.com}
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
+defined('MOODLE_INTERNAL') || die();
+
/**
* Class extending standard backup_plugin in order to implement some
* helper methods related with the course formats (format plugin)
@@ -16,10 +16,13 @@
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
- * @package core
- * @subpackage backup-moodle2
- * @copyright 2011 David Mudrak <david@moodle.com>
- * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ * Defines backup_gradingform_plugin class
+ *
+ * @package core_backup
+ * @subpackage moodle2
+ * @category backup
+ * @copyright 2011 David Mudrak <david@moodle.com>
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
defined('MOODLE_INTERNAL') || die();
@@ -28,5 +31,4 @@
* Base class for all advanced grading form plugins
*/
abstract class backup_gradingform_plugin extends backup_plugin {
-
}
@@ -16,12 +16,17 @@
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
- * @package moodlecore
- * @subpackage backup-moodle2
- * @copyright 2011 onwards Eloy Lafuente (stronk7) {@link http://stronk7.com}
- * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ * Defines backup_plagiarism_plugin class
+ *
+ * @package core_backup
+ * @subpackage moodle2
+ * @category backup
+ * @copyright 2011 onwards Eloy Lafuente (stronk7) {@link http://stronk7.com}
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
+defined('MOODLE_INTERNAL') || die();
+
/**
* Class extending standard backup_plugin in order to implement some
* helper methods related with the plagiarism plugins (plagiarism plugin)
@@ -16,10 +16,13 @@
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
- * @package moodlecore
- * @subpackage backup-moodle2
- * @copyright 2010 onwards Eloy Lafuente (stronk7) {@link http://stronk7.com}
- * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ * Defines backup_plan_builder class
+ *
+ * @package core_backup
+ * @subpackage moodle2
+ * @category backup
+ * @copyright 2010 onwards Eloy Lafuente (stronk7) {@link http://stronk7.com}
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
defined('MOODLE_INTERNAL') || die();
Oops, something went wrong.

0 comments on commit bccdff5

Please sign in to comment.