diff --git a/admin/cli/upgrade.php b/admin/cli/upgrade.php
index b223605e0b082..83f114598e8c3 100644
--- a/admin/cli/upgrade.php
+++ b/admin/cli/upgrade.php
@@ -92,6 +92,10 @@
$oldversion = "$CFG->release ($CFG->version)";
$newversion = "$release ($version)";
+if (!moodle_needs_upgrading()) {
+ cli_error(get_string('cliupgradenoneed', 'core_admin', $newversion), 0);
+}
+
// Test environment first.
list($envstatus, $environment_results) = check_moodle_environment(normalize_version($release), ENV_SELECT_RELEASE);
if (!$envstatus) {
diff --git a/admin/environment.xml b/admin/environment.xml
index c43b94e2e7e94..cd1781868052b 100644
--- a/admin/environment.xml
+++ b/admin/environment.xml
@@ -651,6 +651,7 @@
+
diff --git a/admin/index.php b/admin/index.php
index 7e8a6fc0f4055..70dcafa08054c 100644
--- a/admin/index.php
+++ b/admin/index.php
@@ -306,8 +306,8 @@
}
}
- // at this stage there can be only one admin - users may change username, so do not rely on that
- $adminuser = get_complete_user_data('id', $CFG->siteadmins);
+ // at this stage there can be only one admin unless more were added by install - users may change username, so do not rely on that
+ $adminuser = get_complete_user_data('id', reset(explode(',', $CFG->siteadmins)));
if ($adminuser->password === 'adminsetuppending') {
// prevent installation hijacking
diff --git a/admin/mnet/access_control.php b/admin/mnet/access_control.php
index 5721d54648fe9..b9e436f7cc4cf 100644
--- a/admin/mnet/access_control.php
+++ b/admin/mnet/access_control.php
@@ -103,7 +103,7 @@
$usernames = explode(',', $form->username);
foreach ($usernames as $username) {
- $username = trim(moodle_strtolower($username));
+ $username = trim(textlib::strtolower($username));
if (!empty($username)) {
if (mnet_update_sso_access_control($username, $form->mnet_host_id, $form->accessctrl)) {
if ($form->accessctrl == 'allow') {
diff --git a/admin/roles/lib.php b/admin/roles/lib.php
index d2dbaba656385..d57233ff1a224 100644
--- a/admin/roles/lib.php
+++ b/admin/roles/lib.php
@@ -610,8 +610,8 @@ public function read_submitted_permissions() {
$shortname = optional_param('shortname', null, PARAM_RAW);
if (!is_null($shortname)) {
$this->role->shortname = $shortname;
- $this->role->shortname = textlib_get_instance()->specialtoascii($this->role->shortname);
- $this->role->shortname = moodle_strtolower(clean_param($this->role->shortname, PARAM_ALPHANUMEXT));
+ $this->role->shortname = textlib::specialtoascii($this->role->shortname);
+ $this->role->shortname = textlib::strtolower(clean_param($this->role->shortname, PARAM_ALPHANUMEXT));
if (empty($this->role->shortname)) {
$this->errors['shortname'] = get_string('errorbadroleshortname', 'role');
}
diff --git a/admin/settings.php b/admin/settings.php
index 3f8d2c93002ee..3e66f24d48eab 100644
--- a/admin/settings.php
+++ b/admin/settings.php
@@ -131,8 +131,8 @@
echo '';
}
-$PAGE->requires->yui_module('moodle-core-formslib',
- 'M.core.init_formslib',
+$PAGE->requires->yui_module('moodle-core-formchangechecker',
+ 'M.core_formchangechecker.init',
array(array(
'formid' => 'adminsettings'
))
diff --git a/admin/settings/appearance.php b/admin/settings/appearance.php
index 9c86f4f26c260..c791205ca97de 100644
--- a/admin/settings/appearance.php
+++ b/admin/settings/appearance.php
@@ -97,6 +97,7 @@
);
$temp->add(new admin_setting_configselect('defaulthomepage', new lang_string('defaulthomepage', 'admin'), new lang_string('configdefaulthomepage', 'admin'), HOMEPAGE_SITE, $choices));
$temp->add(new admin_setting_configcheckbox('navshowcategories', new lang_string('navshowcategories', 'admin'), new lang_string('confignavshowcategories', 'admin'), 1));
+ $temp->add(new admin_setting_configcheckbox('navshowmycoursecategories', new lang_string('navshowmycoursecategories', 'admin'), new lang_string('navshowmycoursecategories_help', 'admin'), 0));
$temp->add(new admin_setting_configcheckbox('navshowallcourses', new lang_string('navshowallcourses', 'admin'), new lang_string('confignavshowallcourses', 'admin'), 0));
$temp->add(new admin_setting_configtext('navcourselimit',new lang_string('navcourselimit','admin'),new lang_string('confignavcourselimit', 'admin'),20,PARAM_INT));
$temp->add(new admin_setting_configcheckbox('navlinkcoursesections', new lang_string('navlinkcoursesections', 'admin'), new lang_string('navlinkcoursesections_help', 'admin'), 0));
diff --git a/admin/settings/courses.php b/admin/settings/courses.php
index 88fbdef20a4ba..321ce4497629f 100644
--- a/admin/settings/courses.php
+++ b/admin/settings/courses.php
@@ -97,7 +97,6 @@
$temp->add(new admin_setting_configcheckbox_with_lock('backup/backup_general_users', new lang_string('generalusers','backup'), new lang_string('configgeneralusers','backup'), array('value'=>1, 'locked'=>0)));
$temp->add(new admin_setting_configcheckbox_with_lock('backup/backup_general_anonymize', new lang_string('generalanonymize','backup'), new lang_string('configgeneralanonymize','backup'), array('value'=>0, 'locked'=>0)));
$temp->add(new admin_setting_configcheckbox_with_lock('backup/backup_general_role_assignments', new lang_string('generalroleassignments','backup'), new lang_string('configgeneralroleassignments','backup'), array('value'=>1, 'locked'=>0)));
- $temp->add(new admin_setting_configcheckbox_with_lock('backup/backup_general_user_files', new lang_string('generaluserfiles','backup'), new lang_string('configgeneraluserfiles','backup'), array('value'=>1, 'locked'=>0)));
$temp->add(new admin_setting_configcheckbox_with_lock('backup/backup_general_activities', new lang_string('generalactivities','backup'), new lang_string('configgeneralactivities','backup'), array('value'=>1, 'locked'=>0)));
$temp->add(new admin_setting_configcheckbox_with_lock('backup/backup_general_blocks', new lang_string('generalblocks','backup'), new lang_string('configgeneralblocks','backup'), array('value'=>1, 'locked'=>0)));
$temp->add(new admin_setting_configcheckbox_with_lock('backup/backup_general_filters', new lang_string('generalfilters','backup'), new lang_string('configgeneralfilters','backup'), array('value'=>1, 'locked'=>0)));
@@ -144,7 +143,6 @@
$temp->add(new admin_setting_heading('automatedsettings', new lang_string('automatedsettings','backup'), ''));
$temp->add(new admin_setting_configcheckbox('backup/backup_auto_users', new lang_string('generalusers', 'backup'), new lang_string('configgeneralusers', 'backup'), 1));
$temp->add(new admin_setting_configcheckbox('backup/backup_auto_role_assignments', new lang_string('generalroleassignments','backup'), new lang_string('configgeneralroleassignments','backup'), 1));
- $temp->add(new admin_setting_configcheckbox('backup/backup_auto_user_files', new lang_string('generaluserfiles', 'backup'), new lang_string('configgeneraluserfiles','backup'), 1));
$temp->add(new admin_setting_configcheckbox('backup/backup_auto_activities', new lang_string('generalactivities','backup'), new lang_string('configgeneralactivities','backup'), 1));
$temp->add(new admin_setting_configcheckbox('backup/backup_auto_blocks', new lang_string('generalblocks','backup'), new lang_string('configgeneralblocks','backup'), 1));
$temp->add(new admin_setting_configcheckbox('backup/backup_auto_filters', new lang_string('generalfilters','backup'), new lang_string('configgeneralfilters','backup'), 1));
diff --git a/admin/settings/plugins.php b/admin/settings/plugins.php
index 6ed940247872e..6d192b6d37de2 100644
--- a/admin/settings/plugins.php
+++ b/admin/settings/plugins.php
@@ -477,6 +477,13 @@
$ADMIN->add('reportplugins', $page);
}
+/// Add all admin tools
+if ($hassiteconfig) {
+ $ADMIN->add('modules', new admin_category('tools', new lang_string('tools', 'admin')));
+ $ADMIN->add('tools', new admin_externalpage('managetools', new lang_string('toolsmanage', 'admin'),
+ $CFG->wwwroot . '/' . $CFG->admin . '/tools.php'));
+}
+
// Now add various admin tools
foreach (get_plugin_list('tool') as $plugin => $plugindir) {
$settings_path = "$plugindir/settings.php";
@@ -485,13 +492,6 @@
}
}
-/// Add all admin tools
-if ($hassiteconfig) {
- $ADMIN->add('modules', new admin_category('tools', new lang_string('tools', 'admin')));
- $ADMIN->add('tools', new admin_externalpage('managetools', new lang_string('toolsmanage', 'admin'),
- $CFG->wwwroot . '/' . $CFG->admin . '/tools.php'));
-}
-
/// Add all local plugins - must be always last!
if ($hassiteconfig) {
$ADMIN->add('modules', new admin_category('localplugins', new lang_string('localplugins')));
diff --git a/admin/tool/customlang/db/access.php b/admin/tool/customlang/db/access.php
index fa7c1aab5f756..12f07926500eb 100644
--- a/admin/tool/customlang/db/access.php
+++ b/admin/tool/customlang/db/access.php
@@ -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
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
diff --git a/admin/tool/customlang/db/install.xml b/admin/tool/customlang/db/install.xml
index 4cee03bfeb9f8..4887c1f8c6392 100644
--- a/admin/tool/customlang/db/install.xml
+++ b/admin/tool/customlang/db/install.xml
@@ -1,22 +1,22 @@
-
-
+
-
+
-
-
-
-
+
+
+
+
@@ -28,7 +28,7 @@
-
+
diff --git a/admin/tool/unittest/db/access.php b/admin/tool/unittest/db/access.php
index 6a0c8d26561b6..73d07dc1f6f6d 100644
--- a/admin/tool/unittest/db/access.php
+++ b/admin/tool/unittest/db/access.php
@@ -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!!!
diff --git a/admin/tool/uploaduser/locallib.php b/admin/tool/uploaduser/locallib.php
index 83b648c9b32f8..b46f97291a64d 100644
--- a/admin/tool/uploaduser/locallib.php
+++ b/admin/tool/uploaduser/locallib.php
@@ -179,13 +179,11 @@ function uu_validate_user_upload_columns(csv_import_reader $cir, $stdfields, $pr
print_error('csvfewcolumns', 'error', $returnurl);
}
- $textlib = textlib_get_instance(); // profile fields may contain unicode chars
-
// test columns
$processed = array();
foreach ($columns as $key=>$unused) {
$field = $columns[$key];
- $lcfield = $textlib->strtolower($field);
+ $lcfield = textlib::strtolower($field);
if (in_array($field, $stdfields) or in_array($lcfield, $stdfields)) {
// standard fields are only lowercase
$newfield = $lcfield;
@@ -281,8 +279,6 @@ function uu_process_template($template, $user) {
* Internal callback function.
*/
function uu_process_template_callback($username, $firstname, $lastname, $block) {
- $textlib = textlib_get_instance();
-
switch ($block[3]) {
case 'u':
$repl = $username;
@@ -299,18 +295,18 @@ function uu_process_template_callback($username, $firstname, $lastname, $block)
switch ($block[1]) {
case '+':
- $repl = $textlib->strtoupper($repl);
+ $repl = textlib::strtoupper($repl);
break;
case '-':
- $repl = $textlib->strtolower($repl);
+ $repl = textlib::strtolower($repl);
break;
case '~':
- $repl = $textlib->strtotitle($repl);
+ $repl = textlib::strtotitle($repl);
break;
}
if (!empty($block[2])) {
- $repl = $textlib->substr($repl, 0 , $block[2]);
+ $repl = textlib::substr($repl, 0 , $block[2]);
}
return $repl;
diff --git a/admin/tool/uploaduser/user_form.php b/admin/tool/uploaduser/user_form.php
index 33b11193508a9..7fb74b0641b2c 100644
--- a/admin/tool/uploaduser/user_form.php
+++ b/admin/tool/uploaduser/user_form.php
@@ -53,8 +53,7 @@ function definition () {
$mform->setDefault('delimiter_name', 'comma');
}
- $textlib = textlib_get_instance();
- $choices = $textlib->get_encodings();
+ $choices = textlib::get_encodings();
$mform->addElement('select', 'encoding', get_string('encoding', 'tool_uploaduser'), $choices);
$mform->setDefault('encoding', 'UTF-8');
diff --git a/admin/tool/xmldb/actions/check_bigints/check_bigints.class.php b/admin/tool/xmldb/actions/check_bigints/check_bigints.class.php
index f2def4aad10f3..18b4995736621 100644
--- a/admin/tool/xmldb/actions/check_bigints/check_bigints.class.php
+++ b/admin/tool/xmldb/actions/check_bigints/check_bigints.class.php
@@ -23,8 +23,7 @@
/**
* reporting about the ones not physically implemented as BIGINTs
- * and providing one SQL script to fix all them. Also, under MySQL,
- * it performs one check of signed bigints. MDL-11038
+ * and providing one SQL script to fix all them. MDL-11038
*
* @package tool
* @subpackage xmldb
@@ -53,7 +52,6 @@ function init() {
'wrongints' => 'tool_xmldb',
'nowrongintsfound' => 'tool_xmldb',
'yeswrongintsfound' => 'tool_xmldb',
- 'mysqlextracheckbigints' => 'tool_xmldb',
));
// Correct fields must be type bigint for MySQL and int8 for PostgreSQL
@@ -90,8 +88,8 @@ protected function check_table(xmldb_table $xmldb_table, array $metacolumns) {
$metacolumn = $metacolumns[$xmldb_field->getName()];
// Going to check this field in DB
$o.='
' . $this->str['field'] . ': ' . $xmldb_field->getName() . ' ';
- // Detect if the physical field is wrong and, under mysql, check for incorrect signed fields too
- if ($metacolumn->type != $this->correct_type || ($this->dbfamily == 'mysql' && $xmldb_field->getUnsigned() && !$metacolumn->unsigned)) {
+ // Detect if the physical field is wrong
+ if ($metacolumn->type != $this->correct_type) {
$o.='' . $this->str['wrong'] . '';
// Add the wrong field to the list
$obj = new stdClass();
diff --git a/admin/tool/xmldb/actions/create_xml_file/create_xml_file.class.php b/admin/tool/xmldb/actions/create_xml_file/create_xml_file.class.php
index 1cf39694d6769..632d12ea2d005 100644
--- a/admin/tool/xmldb/actions/create_xml_file/create_xml_file.class.php
+++ b/admin/tool/xmldb/actions/create_xml_file/create_xml_file.class.php
@@ -88,7 +88,7 @@ function invoke() {
$c.= ' ' . "\n";
$c.= '
(, )
- unsigned not null
diff --git a/admin/tool/xmldb/actions/main_view/main_view.class.php b/admin/tool/xmldb/actions/main_view/main_view.class.php
index c8feb613396be..30af587196202 100644
--- a/admin/tool/xmldb/actions/main_view/main_view.class.php
+++ b/admin/tool/xmldb/actions/main_view/main_view.class.php
@@ -277,40 +277,6 @@ function invoke() {
}
}
}
- // TODO: Drop this check in Moodle 2.1
- // Intercept loaded structure here and look for ENUM fields
- if (isset($dbdir->xml_file)) {
- if ($structure =& $dbdir->xml_file->getStructure()) {
- if ($tables = $structure->getTables()) {
- foreach ($tables as $table) {
- if ($fields = $table->getFields()) {
- foreach ($fields as $field) {
- if (!empty($field->hasenums)) {
- if ($hithis) {
- $o .= '
';
- } else {
- $o .= '
';
- }
- $o .= 'Table ' . $table->getName() . ', field ' . $field->getName() . ' has ENUM info';
- if (!empty($field->hasenumsenabled)) {
- $o .= ' that seems to be active (true). ENUMs support has been dropped in Moodle 2.0, ' .
- ' the XMLDB Editor will delete any ENUM reference next time you save this file' .
- ' and you MUST provide one upgrade block in your code to drop them from DB. See' .
- ' ' .
- ' Moodle Docs for more info and examples.';
- } else {
- $o .= ' that seem to be inactive (false). ENUMs support has been dropped in Moodle 2.0,' .
- ' the XMLDB Editor will, simply, delete any ENUM reference next time you save this file.' .
- ' No further action is necessary.';
- }
- $o .= '
';
- }
- }
- }
- }
- }
- }
- }
// If there are changes pending to be saved, but the file cannot be written... inform here
if ($dbdir->path_exists &&
file_exists($key . '/install.xml') &&
diff --git a/admin/tool/xmldb/actions/new_table/new_table.class.php b/admin/tool/xmldb/actions/new_table/new_table.class.php
index bb34696d5a7c6..cfdb38522bab8 100644
--- a/admin/tool/xmldb/actions/new_table/new_table.class.php
+++ b/admin/tool/xmldb/actions/new_table/new_table.class.php
@@ -90,7 +90,6 @@ function invoke() {
$field->setType(XMLDB_TYPE_INTEGER);
$field->setLength(10);
$field->setNotNull(true);
- $field->setUnsigned(true);
$field->setSequence(true);
$field->setLoaded(true);
$field->setChanged(true);
diff --git a/admin/tool/xmldb/actions/view_table_php/view_table_php.class.php b/admin/tool/xmldb/actions/view_table_php/view_table_php.class.php
index 36a1d8800d14c..7ce215793fea6 100644
--- a/admin/tool/xmldb/actions/view_table_php/view_table_php.class.php
+++ b/admin/tool/xmldb/actions/view_table_php/view_table_php.class.php
@@ -125,10 +125,8 @@ function invoke() {
$optionspacer . 'rename_field',
$optionspacer . 'change_field_type',
$optionspacer . 'change_field_precision',
- $optionspacer . 'change_field_unsigned',
$optionspacer . 'change_field_notnull',
$optionspacer . 'change_field_default',
- $optionspacer . 'drop_enum_from_field', // TODO: Moodle 2.1 - Drop drop_enum_from_field
'Keys',
$optionspacer . 'add_key',
$optionspacer . 'drop_key',
@@ -218,13 +216,6 @@ function invoke() {
$o.= $this->str['mustselectonefield'];
}
break;
- case 'change_field_unsigned':
- if ($fieldkeyindexinitial == 'f') { //Only if we have got one field
- $o.= s($this->change_field_unsigned_php($structure, $tableparam, $fieldkeyindexparam));
- } else {
- $o.= $this->str['mustselectonefield'];
- }
- break;
case 'change_field_notnull':
if ($fieldkeyindexinitial == 'f') { // Only if we have got one field
$o.= s($this->change_field_notnull_php($structure, $tableparam, $fieldkeyindexparam));
@@ -232,13 +223,6 @@ function invoke() {
$o.= $this->str['mustselectonefield'];
}
break;
- case 'drop_enum_from_field': // TODO: Moodle 2.1 - Drop drop_enum_from_field
- if ($fieldkeyindexinitial == 'f') { // Only if we have got one field
- $o.= s($this->drop_enum_from_field_php($structure, $tableparam, $fieldkeyindexparam));
- } else {
- $o.= $this->str['mustselectonefield'];
- }
- break;
case 'change_field_default':
if ($fieldkeyindexinitial == 'f') { // Only if we have got one field
$o.= s($this->change_field_default_php($structure, $tableparam, $fieldkeyindexparam));
@@ -553,54 +537,6 @@ function change_field_precision_php($structure, $table, $field) {
return $result;
}
- /**
- * This function will generate all the PHP code needed to
- * change the unsigned/signed of one field using XMLDB objects and functions
- *
- * @param xmldb_structure structure object containing all the info
- * @param string table table name
- * @param string field field name to change unsigned/signed
- */
- function change_field_unsigned_php($structure, $table, $field) {
-
- $result = '';
- // Validate if we can do it
- if (!$table = $structure->getTable($table)) {
- return false;
- }
- if (!$field = $table->getField($field)) {
- return false;
- }
- if ($table->getAllErrors()) {
- return false;
- }
-
- // Calculate the unsigned tip text
- $unsigned = $field->getUnsigned() ? 'unsigned' : 'signed';
-
- // Add the standard PHP header
- $result .= XMLDB_PHP_HEADER;
-
- // Add contents
- $result .= XMLDB_LINEFEED;
- $result .= ' // Changing sign of field ' . $field->getName() . ' on table ' . $table->getName() . ' to ' . $unsigned . XMLDB_LINEFEED;
- $result .= ' $table = new xmldb_table(' . "'" . $table->getName() . "'" . ');' . XMLDB_LINEFEED;
- $result .= ' $field = new xmldb_field(' . "'" . $field->getName() . "', " . $field->getPHP(true) . ');' . XMLDB_LINEFEED;
-
- // Launch the proper DDL
- $result .= XMLDB_LINEFEED;
- $result .= ' // Launch change of sign for field ' . $field->getName() . XMLDB_LINEFEED;
- $result .= ' $dbman->change_field_unsigned($table, $field);' . XMLDB_LINEFEED;
-
- // Add the proper upgrade_xxxx_savepoint call
- $result .= $this->upgrade_savepoint_php ($structure);
-
- // Add standard PHP footer
- $result .= XMLDB_PHP_FOOTER;
-
- return $result;
- }
-
/**
* This function will generate all the PHP code needed to
* change the nullability of one field using XMLDB objects and functions
@@ -649,57 +585,6 @@ function change_field_notnull_php($structure, $table, $field) {
return $result;
}
- /**
- * This function will generate all the PHP code needed to
- * drop the enum values (check constraint) of one field
- * using XMLDB objects and functions
- *
- * Note this function is here as part of the process of
- * dropping enums completely from Moodle 2.0: MDL-18577
- * and will be out in Moodle 2.1
- * TODO: Moodle 2.1 - Drop drop_enum_from_field_php
- *
- * @param xmldb_structure structure object containing all the info
- * @param string table table name
- * @param string field field name to change its enum
- */
- function drop_enum_from_field_php($structure, $table, $field) {
-
- $result = '';
- // Validate if we can do it
- if (!$table = $structure->getTable($table)) {
- return false;
- }
- if (!$field = $table->getField($field)) {
- return false;
- }
- if ($table->getAllErrors()) {
- return false;
- }
-
- // Add the standard PHP header
- $result .= XMLDB_PHP_HEADER;
-
- // Add contents
- $result .= XMLDB_LINEFEED;
- $result .= ' // Drop list of values (enum) from field ' . $field->getName() . ' on table ' . $table->getName() . XMLDB_LINEFEED;
- $result .= ' $table = new xmldb_table(' . "'" . $table->getName() . "'" . ');' . XMLDB_LINEFEED;
- $result .= ' $field = new xmldb_field(' . "'" . $field->getName() . "', " . $field->getPHP(true) . ');' . XMLDB_LINEFEED;
-
- // Launch the proper DDL
- $result .= XMLDB_LINEFEED;
- $result .= ' // Launch drop of list of values from field ' . $field->getName() . XMLDB_LINEFEED;
- $result .= ' $dbman->drop_enum_from_field($table, $field);' . XMLDB_LINEFEED;
-
- // Add the proper upgrade_xxxx_savepoint call
- $result .= $this->upgrade_savepoint_php ($structure);
-
- // Add standard PHP footer
- $result .= XMLDB_PHP_FOOTER;
-
- return $result;
- }
-
/**
* This function will generate all the PHP code needed to
* change the default of one field using XMLDB objects and functions
diff --git a/admin/tool/xmldb/lang/en/tool_xmldb.php b/admin/tool/xmldb/lang/en/tool_xmldb.php
index b24a219f85704..a378c268ee4a6 100644
--- a/admin/tool/xmldb/lang/en/tool_xmldb.php
+++ b/admin/tool/xmldb/lang/en/tool_xmldb.php
@@ -27,7 +27,6 @@
$string['aftertable'] = 'After table:';
$string['back'] = 'Back';
$string['backtomainview'] = 'Back to main';
-$string['binaryincorrectlength'] = 'Incorrect length for binary field';
$string['cannotuseidfield'] = 'Cannot insert the "id" field. It is an autonumeric column';
$string['completelogbelow'] = '(see the complete log of the search below)';
$string['confirmdeletefield'] = 'Are you absolutely sure that you want to delete the field:';
@@ -126,7 +125,6 @@
$string['mustselectonefield'] = 'You must select one field to see field related actions!';
$string['mustselectoneindex'] = 'You must select one index to see index related actions!';
$string['mustselectonekey'] = 'You must select one key to see key related actions!';
-$string['mysqlextracheckbigints'] = 'Under MySQL it also looks for incorrectly signed bigints, generating the required SQL to be executed in order to fix all them.';
$string['newfield'] = 'New field';
$string['newindex'] = 'New index';
$string['newkey'] = 'New key';
@@ -160,7 +158,6 @@
$string['table'] = 'Table';
$string['tablenameempty'] = 'The table name cannot be empty';
$string['tables'] = 'Tables';
-$string['textincorrectlength'] = 'Incorrect length for text field';
$string['unload'] = 'Unload';
$string['up'] = 'Up';
$string['view'] = 'View';
diff --git a/auth/cas/auth.php b/auth/cas/auth.php
index d66bdb8029793..fa6fb0f61477f 100644
--- a/auth/cas/auth.php
+++ b/auth/cas/auth.php
@@ -51,7 +51,7 @@ function prevent_local_passwords() {
*/
function user_login ($username, $password) {
$this->connectCAS();
- return phpCAS::isAuthenticated() && (trim(moodle_strtolower(phpCAS::getUser())) == $username);
+ return phpCAS::isAuthenticated() && (trim(textlib::strtolower(phpCAS::getUser())) == $username);
}
/**
@@ -336,15 +336,15 @@ function process_config($config) {
set_config('host_url', trim($config->host_url), $this->pluginconfig);
set_config('ldapencoding', trim($config->ldapencoding), $this->pluginconfig);
set_config('contexts', trim($config->contexts), $this->pluginconfig);
- set_config('user_type', moodle_strtolower(trim($config->user_type)), $this->pluginconfig);
- set_config('user_attribute', moodle_strtolower(trim($config->user_attribute)), $this->pluginconfig);
+ set_config('user_type', textlib::strtolower(trim($config->user_type)), $this->pluginconfig);
+ set_config('user_attribute', textlib::strtolower(trim($config->user_attribute)), $this->pluginconfig);
set_config('search_sub', $config->search_sub, $this->pluginconfig);
set_config('opt_deref', $config->opt_deref, $this->pluginconfig);
set_config('bind_dn', trim($config->bind_dn), $this->pluginconfig);
set_config('bind_pw', $config->bind_pw, $this->pluginconfig);
set_config('ldap_version', $config->ldap_version, $this->pluginconfig);
set_config('objectclass', trim($config->objectclass), $this->pluginconfig);
- set_config('memberattribute', moodle_strtolower(trim($config->memberattribute)), $this->pluginconfig);
+ set_config('memberattribute', textlib::strtolower(trim($config->memberattribute)), $this->pluginconfig);
set_config('memberattribute_isdn', $config->memberattribute_isdn, $this->pluginconfig);
set_config('attrcreators', trim($config->attrcreators), $this->pluginconfig);
set_config('groupecreators', trim($config->groupecreators), $this->pluginconfig);
@@ -364,8 +364,7 @@ function iscreator($username) {
return false;
}
- $textlib = textlib_get_instance();
- $extusername = $textlib->convert($username, 'utf-8', $this->config->ldapencoding);
+ $extusername = textlib::convert($username, 'utf-8', $this->config->ldapencoding);
// Test for group creator
if (!empty($this->config->groupecreators)) {
diff --git a/auth/db/lang/en/auth_db.php b/auth/db/lang/en/auth_db.php
index 2443235bb0d67..6f42064fb0c5e 100644
--- a/auth/db/lang/en/auth_db.php
+++ b/auth/db/lang/en/auth_db.php
@@ -57,7 +57,7 @@
$string['auth_dbsybasequotinghelp'] = 'Sybase style single quote escaping - needed for Oracle, MS SQL and some other databases. Do not use for MySQL!';
$string['auth_dbtable'] = 'Name of the table in the database';
$string['auth_dbtable_key'] = 'Table';
-$string['auth_dbtype'] = 'The database type (See the ADOdb documentation for details)';
+$string['auth_dbtype'] = 'The database type (See the ADOdb documentation for details)';
$string['auth_dbtype_key'] = 'Database';
$string['auth_dbupdatinguser'] = 'Updating user {$a->name} id {$a->id}';
$string['auth_dbuser'] = 'Username with read access to the database';
diff --git a/auth/ldap/auth.php b/auth/ldap/auth.php
index 9f88bbd43bdff..d1572a357e01a 100644
--- a/auth/ldap/auth.php
+++ b/auth/ldap/auth.php
@@ -133,9 +133,8 @@ function user_login($username, $password) {
return false;
}
- $textlib = textlib_get_instance();
- $extusername = $textlib->convert($username, 'utf-8', $this->config->ldapencoding);
- $extpassword = $textlib->convert($password, 'utf-8', $this->config->ldapencoding);
+ $extusername = textlib::convert($username, 'utf-8', $this->config->ldapencoding);
+ $extpassword = textlib::convert($password, 'utf-8', $this->config->ldapencoding);
// Before we connect to LDAP, check if this is an AD SSO login
// if we succeed in this block, we'll return success early.
@@ -199,8 +198,7 @@ function user_login($username, $password) {
* @return mixed array with no magic quotes or false on error
*/
function get_userinfo($username) {
- $textlib = textlib_get_instance();
- $extusername = $textlib->convert($username, 'utf-8', $this->config->ldapencoding);
+ $extusername = textlib::convert($username, 'utf-8', $this->config->ldapencoding);
$ldapconnection = $this->ldap_connect();
if(!($user_dn = $this->ldap_find_userdn($ldapconnection, $extusername))) {
@@ -245,9 +243,9 @@ function get_userinfo($username) {
continue; // wrong data mapping!
}
if (is_array($entry[$value])) {
- $newval = $textlib->convert($entry[$value][0], $this->config->ldapencoding, 'utf-8');
+ $newval = textlib::convert($entry[$value][0], $this->config->ldapencoding, 'utf-8');
} else {
- $newval = $textlib->convert($entry[$value], $this->config->ldapencoding, 'utf-8');
+ $newval = textlib::convert($entry[$value], $this->config->ldapencoding, 'utf-8');
}
if (!empty($newval)) { // favour ldap entries that are set
$ldapval = $newval;
@@ -298,8 +296,7 @@ function get_userlist() {
* @param string $username
*/
function user_exists($username) {
- $textlib = textlib_get_instance();
- $extusername = $textlib->convert($username, 'utf-8', $this->config->ldapencoding);
+ $extusername = textlib::convert($username, 'utf-8', $this->config->ldapencoding);
// Returns true if given username exists on ldap
$users = $this->ldap_get_userlist('('.$this->config->user_attribute.'='.ldap_filter_addslashes($extusername).')');
@@ -315,9 +312,8 @@ function user_exists($username) {
* @param mixed $plainpass Plaintext password
*/
function user_create($userobject, $plainpass) {
- $textlib = textlib_get_instance();
- $extusername = $textlib->convert($userobject->username, 'utf-8', $this->config->ldapencoding);
- $extpassword = $textlib->convert($plainpass, 'utf-8', $this->config->ldapencoding);
+ $extusername = textlib::convert($userobject->username, 'utf-8', $this->config->ldapencoding);
+ $extpassword = textlib::convert($plainpass, 'utf-8', $this->config->ldapencoding);
switch ($this->config->passtype) {
case 'md5':
@@ -342,7 +338,7 @@ function user_create($userobject, $plainpass) {
}
foreach ($values as $value) {
if (!empty($userobject->$key) ) {
- $newuser[$value] = $textlib->convert($userobject->$key, 'utf-8', $this->config->ldapencoding);
+ $newuser[$value] = textlib::convert($userobject->$key, 'utf-8', $this->config->ldapencoding);
}
}
}
@@ -570,8 +566,7 @@ function user_confirm($username, $confirmsecret) {
function password_expire($username) {
$result = 0;
- $textlib = textlib_get_instance();
- $extusername = $textlib->convert($username, 'utf-8', $this->config->ldapencoding);
+ $extusername = textlib::convert($username, 'utf-8', $this->config->ldapencoding);
$ldapconnection = $this->ldap_connect();
$user_dn = $this->ldap_find_userdn($ldapconnection, $extusername);
@@ -616,7 +611,6 @@ function sync_users($do_updates=true) {
print_string('connectingldap', 'auth_ldap');
$ldapconnection = $this->ldap_connect();
- $textlib = textlib_get_instance();
$dbman = $DB->get_manager();
/// Define table user to be created
@@ -667,7 +661,7 @@ function sync_users($do_updates=true) {
if ($entry = @ldap_first_entry($ldapconnection, $ldap_result)) {
do {
$value = ldap_get_values_len($ldapconnection, $entry, $this->config->user_attribute);
- $value = $textlib->convert($value[0], $this->config->ldapencoding, 'utf-8');
+ $value = textlib::convert($value[0], $this->config->ldapencoding, 'utf-8');
$this->ldap_bulk_insert($value);
} while ($entry = ldap_next_entry($ldapconnection, $entry));
}
@@ -845,7 +839,7 @@ function sync_users($do_updates=true) {
$user->mnethostid = $CFG->mnet_localhost_id;
// get_userinfo_asobj() might have replaced $user->username with the value
// from the LDAP server (which can be mixed-case). Make sure it's lowercase
- $user->username = trim(moodle_strtolower($user->username));
+ $user->username = trim(textlib::strtolower($user->username));
if (empty($user->lang)) {
$user->lang = $CFG->lang;
}
@@ -889,7 +883,7 @@ function update_user_record($username, $updatekeys = false) {
global $CFG, $DB;
// Just in case check text case
- $username = trim(moodle_strtolower($username));
+ $username = trim(textlib::strtolower($username));
// Get the current user record
$user = $DB->get_record('user', array('username'=>$username, 'mnethostid'=>$CFG->mnet_localhost_id));
@@ -934,7 +928,7 @@ function update_user_record($username, $updatekeys = false) {
function ldap_bulk_insert($username) {
global $DB, $CFG;
- $username = moodle_strtolower($username); // usernames are __always__ lowercase.
+ $username = textlib::strtolower($username); // usernames are __always__ lowercase.
$DB->insert_record_raw('tmp_extuser', array('username'=>$username,
'mnethostid'=>$CFG->mnet_localhost_id), false, true);
echo '.';
@@ -947,8 +941,7 @@ function ldap_bulk_insert($username) {
* @return boolean result
*/
function user_activate($username) {
- $textlib = textlib_get_instance();
- $extusername = $textlib->convert($username, 'utf-8', $this->config->ldapencoding);
+ $extusername = textlib::convert($username, 'utf-8', $this->config->ldapencoding);
$ldapconnection = $this->ldap_connect();
@@ -998,8 +991,7 @@ function iscreator($username) {
return null;
}
- $textlib = textlib_get_instance();
- $extusername = $textlib->convert($username, 'utf-8', $this->config->ldapencoding);
+ $extusername = textlib::convert($username, 'utf-8', $this->config->ldapencoding);
$ldapconnection = $this->ldap_connect();
@@ -1057,8 +1049,7 @@ function user_update($olduser, $newuser) {
return true;
}
- $textlib = textlib_get_instance();
- $extoldusername = $textlib->convert($olduser->username, 'utf-8', $this->config->ldapencoding);
+ $extoldusername = textlib::convert($olduser->username, 'utf-8', $this->config->ldapencoding);
$ldapconnection = $this->ldap_connect();
@@ -1112,9 +1103,9 @@ function user_update($olduser, $newuser) {
$ambiguous = false;
}
- $nuvalue = $textlib->convert($newuser->$key, 'utf-8', $this->config->ldapencoding);
+ $nuvalue = textlib::convert($newuser->$key, 'utf-8', $this->config->ldapencoding);
empty($nuvalue) ? $nuvalue = array() : $nuvalue;
- $ouvalue = $textlib->convert($olduser->$key, 'utf-8', $this->config->ldapencoding);
+ $ouvalue = textlib::convert($olduser->$key, 'utf-8', $this->config->ldapencoding);
foreach ($ldapkeys as $ldapkey) {
$ldapkey = $ldapkey;
@@ -1210,9 +1201,8 @@ function user_update_password($user, $newpassword) {
$result = false;
$username = $user->username;
- $textlib = textlib_get_instance();
- $extusername = $textlib->convert($username, 'utf-8', $this->config->ldapencoding);
- $extpassword = $textlib->convert($newpassword, 'utf-8', $this->config->ldapencoding);
+ $extusername = textlib::convert($username, 'utf-8', $this->config->ldapencoding);
+ $extpassword = textlib::convert($newpassword, 'utf-8', $this->config->ldapencoding);
switch ($this->config->passtype) {
case 'md5':
@@ -1380,13 +1370,13 @@ function ldap_attributes () {
$moodleattributes = array();
foreach ($this->userfields as $field) {
if (!empty($this->config->{"field_map_$field"})) {
- $moodleattributes[$field] = moodle_strtolower(trim($this->config->{"field_map_$field"}));
+ $moodleattributes[$field] = textlib::strtolower(trim($this->config->{"field_map_$field"}));
if (preg_match('/,/', $moodleattributes[$field])) {
$moodleattributes[$field] = explode(',', $moodleattributes[$field]); // split ?
}
}
}
- $moodleattributes['username'] = moodle_strtolower(trim($this->config->user_attribute));
+ $moodleattributes['username'] = textlib::strtolower(trim($this->config->user_attribute));
return $moodleattributes;
}
@@ -1435,9 +1425,8 @@ function ldap_get_userlist($filter='*') {
$users = ldap_get_entries_moodle($ldapconnection, $ldap_result);
// Add found users to list
- $textlib = textlib_get_instance();
for ($i = 0; $i < count($users); $i++) {
- $extuser = $textlib->convert($users[$i][$this->config->user_attribute][0],
+ $extuser = textlib::convert($users[$i][$this->config->user_attribute][0],
$this->config->ldapencoding, 'utf-8');
array_push($fresult, $extuser);
}
@@ -1575,8 +1564,7 @@ function ntlmsso_magic($sesskey) {
// (according to my reading of RFC-1945, RFC-2616 and RFC-2617 and
// my local tests), so we need to convert the REMOTE_USER value
// (i.e., what we got from the HTTP WWW-Authenticate header) into UTF-8
- $textlib = textlib_get_instance();
- $username = $textlib->convert($_SERVER['REMOTE_USER'], 'iso-8859-1', 'utf-8');
+ $username = textlib::convert($_SERVER['REMOTE_USER'], 'iso-8859-1', 'utf-8');
switch ($this->config->ntlmsso_type) {
case 'ntlm':
@@ -1592,7 +1580,7 @@ function ntlmsso_magic($sesskey) {
return false; // Should never happen!
}
- $username = moodle_strtolower($username); // Compatibility hack
+ $username = textlib::strtolower($username); // Compatibility hack
set_cache_flag($this->pluginconfig.'/ntlmsess', $sesskey, $username, AUTH_NTLMTIMEOUT);
return true;
}
@@ -1794,8 +1782,8 @@ function process_config($config) {
set_config('host_url', trim($config->host_url), $this->pluginconfig);
set_config('ldapencoding', trim($config->ldapencoding), $this->pluginconfig);
set_config('contexts', trim($config->contexts), $this->pluginconfig);
- set_config('user_type', moodle_strtolower(trim($config->user_type)), $this->pluginconfig);
- set_config('user_attribute', moodle_strtolower(trim($config->user_attribute)), $this->pluginconfig);
+ set_config('user_type', textlib::strtolower(trim($config->user_type)), $this->pluginconfig);
+ set_config('user_attribute', textlib::strtolower(trim($config->user_attribute)), $this->pluginconfig);
set_config('search_sub', $config->search_sub, $this->pluginconfig);
set_config('opt_deref', $config->opt_deref, $this->pluginconfig);
set_config('preventpassindb', $config->preventpassindb, $this->pluginconfig);
@@ -1803,15 +1791,15 @@ function process_config($config) {
set_config('bind_pw', $config->bind_pw, $this->pluginconfig);
set_config('ldap_version', $config->ldap_version, $this->pluginconfig);
set_config('objectclass', trim($config->objectclass), $this->pluginconfig);
- set_config('memberattribute', moodle_strtolower(trim($config->memberattribute)), $this->pluginconfig);
+ set_config('memberattribute', textlib::strtolower(trim($config->memberattribute)), $this->pluginconfig);
set_config('memberattribute_isdn', $config->memberattribute_isdn, $this->pluginconfig);
set_config('creators', trim($config->creators), $this->pluginconfig);
set_config('create_context', trim($config->create_context), $this->pluginconfig);
set_config('expiration', $config->expiration, $this->pluginconfig);
set_config('expiration_warning', trim($config->expiration_warning), $this->pluginconfig);
- set_config('expireattr', moodle_strtolower(trim($config->expireattr)), $this->pluginconfig);
+ set_config('expireattr', textlib::strtolower(trim($config->expireattr)), $this->pluginconfig);
set_config('gracelogins', $config->gracelogins, $this->pluginconfig);
- set_config('graceattr', moodle_strtolower(trim($config->graceattr)), $this->pluginconfig);
+ set_config('graceattr', textlib::strtolower(trim($config->graceattr)), $this->pluginconfig);
set_config('auth_user_create', $config->auth_user_create, $this->pluginconfig);
set_config('forcechangepassword', $config->forcechangepassword, $this->pluginconfig);
set_config('stdchangepassword', $config->stdchangepassword, $this->pluginconfig);
diff --git a/backup/converter/moodle1/handlerlib.php b/backup/converter/moodle1/handlerlib.php
index f0c97541ca95a..da87824949bb4 100644
--- a/backup/converter/moodle1/handlerlib.php
+++ b/backup/converter/moodle1/handlerlib.php
@@ -441,7 +441,6 @@ public function on_root_element_end() {
'users' => 0, // @todo how to detect this from moodle.xml?
'anonymize' => 0,
'role_assignments' => 0,
- 'user_files' => 0,
'activities' => 1,
'blocks' => 1,
'filters' => 0,
@@ -1190,8 +1189,7 @@ public function process_question(array $data, array $raw) {
// replay the upgrade step 2010080901 - updating question image
if (!empty($data['image'])) {
- $textlib = textlib_get_instance();
- if ($textlib->substr($textlib->strtolower($data['image']), 0, 7) == 'http://') {
+ if (textlib::substr(textlib::strtolower($data['image']), 0, 7) == 'http://') {
// it is a link, appending to existing question text
$data['questiontext'] .= ' ';
diff --git a/backup/converter/moodle1/lib.php b/backup/converter/moodle1/lib.php
index 86e2026b579fa..e79dbfea35080 100644
--- a/backup/converter/moodle1/lib.php
+++ b/backup/converter/moodle1/lib.php
@@ -1161,9 +1161,6 @@ class moodle1_file_manager implements loggable {
/** @var string the root of the converter temp directory */
protected $basepath;
- /** @var textlib instance used during the migration */
- protected $textlib;
-
/** @var array of file ids that were migrated by this instance */
protected $fileids = array();
@@ -1187,7 +1184,6 @@ public function __construct(moodle1_converter $converter, $contextid = null, $co
$this->userid = $userid;
// set other useful bits
$this->basepath = $converter->get_tempdir_path();
- $this->textlib = textlib_get_instance();
}
/**
@@ -1218,7 +1214,7 @@ public function migrate_file($sourcepath, $filepath = '/', $filename = null, $so
}
$filepath = clean_param($filepath, PARAM_PATH);
- if ($this->textlib->strlen($filepath) > 255) {
+ if (textlib::strlen($filepath) > 255) {
throw new moodle1_convert_exception('file_path_longer_than_255_chars');
}
diff --git a/backup/moodle2/backup_activity_task.class.php b/backup/moodle2/backup_activity_task.class.php
index f3a22b70b795e..360dd63117b52 100644
--- a/backup/moodle2/backup_activity_task.class.php
+++ b/backup/moodle2/backup_activity_task.class.php
@@ -16,17 +16,23 @@
// along with Moodle. If not, see .
/**
- * @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 @@ abstract class backup_activity_task extends backup_task {
/**
* 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');
}
-
}
diff --git a/backup/moodle2/backup_block_task.class.php b/backup/moodle2/backup_block_task.class.php
index 7d3f26e54c716..91e025378163d 100644
--- a/backup/moodle2/backup_block_task.class.php
+++ b/backup/moodle2/backup_block_task.class.php
@@ -16,12 +16,15 @@
// along with Moodle. If not, see .
/**
- * @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
diff --git a/backup/moodle2/backup_course_task.class.php b/backup/moodle2/backup_course_task.class.php
index 070506cef7a76..8c35274912c54 100644
--- a/backup/moodle2/backup_course_task.class.php
+++ b/backup/moodle2/backup_course_task.class.php
@@ -16,10 +16,13 @@
// along with Moodle. If not, see .
/**
- * @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
*/
/**
diff --git a/backup/moodle2/backup_coursereport_plugin.class.php b/backup/moodle2/backup_coursereport_plugin.class.php
index 8d89b31326cbc..ceab0838d4bc2 100644
--- a/backup/moodle2/backup_coursereport_plugin.class.php
+++ b/backup/moodle2/backup_coursereport_plugin.class.php
@@ -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
diff --git a/backup/moodle2/backup_custom_fields.php b/backup/moodle2/backup_custom_fields.php
index d899a65ef32ca..e0ceb334d95d4 100644
--- a/backup/moodle2/backup_custom_fields.php
+++ b/backup/moodle2/backup_custom_fields.php
@@ -16,12 +16,17 @@
// along with Moodle. If not, see .
/**
- * @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
*
diff --git a/backup/moodle2/backup_default_block_task.class.php b/backup/moodle2/backup_default_block_task.class.php
index b3f5eaeea609f..4b12633690f10 100644
--- a/backup/moodle2/backup_default_block_task.class.php
+++ b/backup/moodle2/backup_default_block_task.class.php
@@ -16,12 +16,17 @@
// along with Moodle. If not, see .
/**
- * @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
diff --git a/backup/moodle2/backup_final_task.class.php b/backup/moodle2/backup_final_task.class.php
index 78bab3ce630b7..abbecb8be797e 100644
--- a/backup/moodle2/backup_final_task.class.php
+++ b/backup/moodle2/backup_final_task.class.php
@@ -16,12 +16,17 @@
// along with Moodle. If not, see .
/**
- * @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
@@ -59,7 +64,7 @@ public function build() {
// done in a single pass
$this->add_step(new backup_annotate_all_question_files('question_files'));
- // Annotate all the user files (conditionally) (private, profile and icon files)
+ // Annotate all the user files (conditionally) (profile and icon files)
// Because each user has its own context, we need a separate/specialised step here
// This step also ensures that the contexts for all the users exist, so next
// step can be safely executed (join between users and contexts)
diff --git a/backup/moodle2/backup_format_plugin.class.php b/backup/moodle2/backup_format_plugin.class.php
index d1af1b923f417..978c69a5e92e9 100644
--- a/backup/moodle2/backup_format_plugin.class.php
+++ b/backup/moodle2/backup_format_plugin.class.php
@@ -16,12 +16,17 @@
// along with Moodle. If not, see .
/**
- * @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)
diff --git a/backup/moodle2/backup_gradingform_plugin.class.php b/backup/moodle2/backup_gradingform_plugin.class.php
index a06412a5466f0..7fd4029681d53 100644
--- a/backup/moodle2/backup_gradingform_plugin.class.php
+++ b/backup/moodle2/backup_gradingform_plugin.class.php
@@ -16,10 +16,13 @@
// along with Moodle. If not, see .
/**
- * @package core
- * @subpackage backup-moodle2
- * @copyright 2011 David Mudrak
- * @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
+ * @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 {
-
}
diff --git a/backup/moodle2/backup_plagiarism_plugin.class.php b/backup/moodle2/backup_plagiarism_plugin.class.php
index 17a1d23adc30e..86b3cc2aa1abc 100644
--- a/backup/moodle2/backup_plagiarism_plugin.class.php
+++ b/backup/moodle2/backup_plagiarism_plugin.class.php
@@ -16,12 +16,17 @@
// along with Moodle. If not, see .
/**
- * @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)
diff --git a/backup/moodle2/backup_plan_builder.class.php b/backup/moodle2/backup_plan_builder.class.php
index 0342462ffe0eb..d7a1f0aed752e 100644
--- a/backup/moodle2/backup_plan_builder.class.php
+++ b/backup/moodle2/backup_plan_builder.class.php
@@ -16,10 +16,13 @@
// along with Moodle. If not, see .
/**
- * @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();
diff --git a/backup/moodle2/backup_plugin.class.php b/backup/moodle2/backup_plugin.class.php
index da0abfa0cac0b..6a060abf8fbc5 100644
--- a/backup/moodle2/backup_plugin.class.php
+++ b/backup/moodle2/backup_plugin.class.php
@@ -16,12 +16,17 @@
// along with Moodle. If not, see .
/**
- * @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_plugin 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();
+
/**
* Class implementing the plugins support for moodle2 backups
*
diff --git a/backup/moodle2/backup_qtype_plugin.class.php b/backup/moodle2/backup_qtype_plugin.class.php
index 5d940c55f87ca..c6839a7094caa 100644
--- a/backup/moodle2/backup_qtype_plugin.class.php
+++ b/backup/moodle2/backup_qtype_plugin.class.php
@@ -16,12 +16,17 @@
// along with Moodle. If not, see .
/**
- * @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_qtype_plugin 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();
+
/**
* Class extending standard backup_plugin in order to implement some
* helper methods related with the questions (qtype plugin)
diff --git a/backup/moodle2/backup_report_plugin.class.php b/backup/moodle2/backup_report_plugin.class.php
index fbc2174744e9c..8f2b34fe50430 100644
--- a/backup/moodle2/backup_report_plugin.class.php
+++ b/backup/moodle2/backup_report_plugin.class.php
@@ -24,10 +24,11 @@
* backed up, a report should make use of the second and third
* parameters in get_plugin_element().
*
- * @package moodlecore
- * @subpackage backup-moodle2
- * @copyright 2011 Petr Skoda
- * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ * @package core_backup
+ * @subpackage moodle2
+ * @category backup
+ * @copyright 2011 Petr Skoda
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
abstract class backup_report_plugin extends backup_plugin {
// Use default parent behaviour
diff --git a/backup/moodle2/backup_root_task.class.php b/backup/moodle2/backup_root_task.class.php
index af710e1dd2227..011a7b5f602c1 100644
--- a/backup/moodle2/backup_root_task.class.php
+++ b/backup/moodle2/backup_root_task.class.php
@@ -16,12 +16,17 @@
// along with Moodle. If not, see .
/**
- * @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_root_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();
+
/**
* Start task that provides all the settings common to all backups and some initialization steps
*
@@ -91,13 +96,6 @@ protected function define_settings() {
$this->add_setting($roleassignments);
$users->add_dependency($roleassignments);
- // Define user_files (dependent of users and anonymize)
- $userfiles = new backup_user_files_setting('user_files', base_setting::IS_BOOLEAN, true);
- $userfiles->set_ui(new backup_setting_ui_checkbox($userfiles, get_string('rootsettinguserfiles', 'backup')));
- $this->add_setting($userfiles);
- $users->add_dependency($userfiles);
- $anonymize->add_dependency($userfiles, setting_dependency::DISABLED_TRUE);
-
// Define activities
$activities = new backup_activities_setting('activities', base_setting::IS_BOOLEAN, true);
$activities->set_ui(new backup_setting_ui_checkbox($activities, get_string('rootsettingactivities', 'backup')));
diff --git a/backup/moodle2/backup_section_task.class.php b/backup/moodle2/backup_section_task.class.php
index 8986d8c5f95d1..ab4b4c8a10daa 100644
--- a/backup/moodle2/backup_section_task.class.php
+++ b/backup/moodle2/backup_section_task.class.php
@@ -16,12 +16,17 @@
// along with Moodle. If not, see .
/**
- * @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_section_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();
+
/**
* section task that provides all the properties and common steps to be performed
* when one section is being backup
diff --git a/backup/moodle2/backup_settingslib.php b/backup/moodle2/backup_settingslib.php
index 6614aee4e1416..31e3c7374f14c 100644
--- a/backup/moodle2/backup_settingslib.php
+++ b/backup/moodle2/backup_settingslib.php
@@ -16,10 +16,13 @@
// along with Moodle. If not, see .
/**
- * @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 classes used to handle backup settings
+ *
+ * @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
*/
// TODO: Reduce these to the minimum because ui/dependencies are 100% separated
@@ -36,6 +39,15 @@ class backup_generic_setting extends root_backup_setting {}
*/
class backup_filename_setting extends backup_generic_setting {
+ /**
+ * Instantiates a setting object
+ *
+ * @param string $name Name of the setting
+ * @param string $vtype Type of the setting, eg {@link base_setting::IS_TEXT}
+ * @param mixed $value Value of the setting
+ * @param bool $visibility Is the setting visible in the UI, eg {@link base_setting::VISIBLE}
+ * @param int $status Status of the setting with regards to the locking, eg {@link base_setting::NOT_LOCKED}
+ */
public function __construct($name, $vtype, $value = null, $visibility = self::VISIBLE, $status = self::NOT_LOCKED) {
parent::__construct($name, $vtype, $value, $visibility, $status);
}
@@ -68,13 +80,6 @@ class backup_activities_setting extends backup_generic_setting {}
*/
class backup_anonymize_setting extends root_backup_setting {}
-/**
- * root setting to control if backup will include
- * user files or no (images, local storage), depends of @backup_users_setting
- * exactly in the same way than @backup_anonymize_setting so we extend from it
- */
-class backup_user_files_setting extends backup_anonymize_setting {}
-
/**
* root setting to control if backup will include
* role assignments or no (any level), depends of @backup_users_setting
diff --git a/backup/moodle2/backup_stepslib.php b/backup/moodle2/backup_stepslib.php
index 8454934ba0805..78d272144ee90 100644
--- a/backup/moodle2/backup_stepslib.php
+++ b/backup/moodle2/backup_stepslib.php
@@ -16,15 +16,16 @@
// along with Moodle. If not, see .
/**
- * @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 backup steps that will be used by common tasks in backup
+ *
+ * @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
*/
-/**
- * Define all the backup steps that will be used by common tasks in backup
- */
+defined('MOODLE_INTERNAL') || die();
/**
* create the temp dir where backup/restore will happen,
@@ -98,6 +99,7 @@ abstract class backup_activity_structure_step extends backup_structure_step {
* we are going to add subplugin information to
* @param bool $multiple to define if multiple subplugins can produce information
* for each instance of $element (true) or no (false)
+ * @return void
*/
protected function add_subplugin_structure($subplugintype, $element, $multiple) {
@@ -135,6 +137,8 @@ protected function add_subplugin_structure($subplugintype, $element, $multiple)
/**
* As far as activity backup steps are implementing backup_subplugin stuff, they need to
* have the parent task available for wrapping purposes (get course/context....)
+ *
+ * @return backup_activity_task
*/
public function get_task() {
return $this->task;
@@ -143,6 +147,9 @@ public function get_task() {
/**
* Wraps any activity backup structure within the common 'activity' element
* that will include common to all activities information like id, context...
+ *
+ * @param backup_nested_element $activitystructure the element to wrap
+ * @return backup_nested_element the $activitystructure wrapped by the common 'activity' element
*/
protected function prepare_activity_structure($activitystructure) {
@@ -1761,10 +1768,6 @@ protected function define_execution() {
// List of fileareas we are going to annotate
$fileareas = array('profile', 'icon');
- if ($this->get_setting_value('user_files')) { // private files only if enabled in settings
- $fileareas[] = 'private';
- }
-
// Fetch all annotated (final) users
$rs = $DB->get_recordset('backup_ids_temp', array(
'backupid' => $this->get_backupid(), 'itemname' => 'userfinal'));
diff --git a/backup/moodle2/backup_subplugin.class.php b/backup/moodle2/backup_subplugin.class.php
index ca3e953d3fcb7..7cb30e3896c03 100644
--- a/backup/moodle2/backup_subplugin.class.php
+++ b/backup/moodle2/backup_subplugin.class.php
@@ -16,12 +16,16 @@
// along with Moodle. If not, see .
/**
- * @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_subplugin 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();
+
/**
* Class implementing the subplugins support for moodle2 backups
*
diff --git a/backup/moodle2/backup_theme_plugin.class.php b/backup/moodle2/backup_theme_plugin.class.php
index d4a3a098f3cb6..7978c527fbec3 100644
--- a/backup/moodle2/backup_theme_plugin.class.php
+++ b/backup/moodle2/backup_theme_plugin.class.php
@@ -16,12 +16,17 @@
// along with Moodle. If not, see .
/**
- * @package moodlecore
- * @subpackage backup-moodle2
- * @copyright 2011 onwards The Open University
- * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ * Defines backup_theme_plugin class
+ *
+ * @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
*/
+defined('MOODLE_INTERNAL') || die();
+
/**
* Base class for theme backup plugins.
*
diff --git a/backup/moodle2/backup_xml_transformer.class.php b/backup/moodle2/backup_xml_transformer.class.php
index f0be3cd6e380a..a3770d035289d 100644
--- a/backup/moodle2/backup_xml_transformer.class.php
+++ b/backup/moodle2/backup_xml_transformer.class.php
@@ -16,12 +16,17 @@
// along with Moodle. If not, see .
/**
- * @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_xml_transformer 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();
+
/**
* Class implementing the @xml_contenttrasnformed logic to be applied in moodle2 backups
*
diff --git a/backup/moodle2/restore_activity_task.class.php b/backup/moodle2/restore_activity_task.class.php
index 50f305dbdc2dc..4872fc092627b 100644
--- a/backup/moodle2/restore_activity_task.class.php
+++ b/backup/moodle2/restore_activity_task.class.php
@@ -16,12 +16,17 @@
// along with Moodle. If not, see .
/**
- * @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 restore_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 restored
diff --git a/backup/moodle2/restore_block_task.class.php b/backup/moodle2/restore_block_task.class.php
index d4715d7bffa3e..64e5b9946986b 100644
--- a/backup/moodle2/restore_block_task.class.php
+++ b/backup/moodle2/restore_block_task.class.php
@@ -16,12 +16,17 @@
// along with Moodle. If not, see .
/**
- * @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 restore_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();
+
/**
* abstract block task that provides all the properties and common steps to be performed
* when one block is being restored
diff --git a/backup/moodle2/restore_course_task.class.php b/backup/moodle2/restore_course_task.class.php
index 1ab98bf330667..87828b4cbb8e8 100644
--- a/backup/moodle2/restore_course_task.class.php
+++ b/backup/moodle2/restore_course_task.class.php
@@ -16,12 +16,17 @@
// along with Moodle. If not, see .
/**
- * @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 restore_course_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();
+
/**
* course task that provides all the properties and common steps to be performed
* when one course is being restored
diff --git a/backup/moodle2/restore_coursereport_plugin.class.php b/backup/moodle2/restore_coursereport_plugin.class.php
index 9a94e234d17b7..af0ebb048b6b0 100644
--- a/backup/moodle2/restore_coursereport_plugin.class.php
+++ b/backup/moodle2/restore_coursereport_plugin.class.php
@@ -19,10 +19,11 @@
/**
* Restore for course plugin: course report.
*
- * @package moodlecore
- * @subpackage backup-moodle2
- * @copyright 2011 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 The Open University
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
abstract class restore_coursereport_plugin extends restore_plugin {
// Use default parent behaviour
diff --git a/backup/moodle2/restore_default_block_task.class.php b/backup/moodle2/restore_default_block_task.class.php
index c3267a2d0d0d9..78c3577041000 100644
--- a/backup/moodle2/restore_default_block_task.class.php
+++ b/backup/moodle2/restore_default_block_task.class.php
@@ -16,12 +16,17 @@
// along with Moodle. If not, see .
/**
- * @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 restore_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 restore blocks not having own DB structures to be added
*
diff --git a/backup/moodle2/restore_final_task.class.php b/backup/moodle2/restore_final_task.class.php
index cebf2ea9e113f..09a9db32031e7 100644
--- a/backup/moodle2/restore_final_task.class.php
+++ b/backup/moodle2/restore_final_task.class.php
@@ -16,12 +16,17 @@
// along with Moodle. If not, see .
/**
- * @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 restore_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
* restore like gradebook, interlinks... apart from some final cleaning
diff --git a/backup/moodle2/restore_format_plugin.class.php b/backup/moodle2/restore_format_plugin.class.php
index 454d3a80d7419..ce7f030f1103d 100644
--- a/backup/moodle2/restore_format_plugin.class.php
+++ b/backup/moodle2/restore_format_plugin.class.php
@@ -16,12 +16,17 @@
// along with Moodle. If not, see .
/**
- * @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 restore_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 restore_plugin in order to implement some
* helper methods related with the course formats (format plugin)
diff --git a/backup/moodle2/restore_gradingform_plugin.class.php b/backup/moodle2/restore_gradingform_plugin.class.php
index ff7f9985a34cc..6caa7dcd3b105 100644
--- a/backup/moodle2/restore_gradingform_plugin.class.php
+++ b/backup/moodle2/restore_gradingform_plugin.class.php
@@ -16,10 +16,12 @@
// along with Moodle. If not, see .
/**
- * @package core
- * @subpackage backup-moodle2
- * @copyright 2011 David Mudrak
- * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ * Defines restore_gradingform_plugin class
+ * @package core_backup
+ * @subpackage moodle2
+ * @category backup
+ * @copyright 2011 David Mudrak
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
defined('MOODLE_INTERNAL') || die();
diff --git a/backup/moodle2/restore_plagiarism_plugin.class.php b/backup/moodle2/restore_plagiarism_plugin.class.php
index 039d117b783ae..6b80a41e7dfde 100644
--- a/backup/moodle2/restore_plagiarism_plugin.class.php
+++ b/backup/moodle2/restore_plagiarism_plugin.class.php
@@ -16,12 +16,17 @@
// along with Moodle. If not, see .
/**
- * @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 restore_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 restore_plugin in order to implement some
* helper methods related with the plagiarism plugins
diff --git a/backup/moodle2/restore_plan_builder.class.php b/backup/moodle2/restore_plan_builder.class.php
index 22511ceb70389..faf4a1271f28a 100644
--- a/backup/moodle2/restore_plan_builder.class.php
+++ b/backup/moodle2/restore_plan_builder.class.php
@@ -16,10 +16,13 @@
// along with Moodle. If not, see .
/**
- * @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 restore_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();
diff --git a/backup/moodle2/restore_plugin.class.php b/backup/moodle2/restore_plugin.class.php
index 5ed177ea5f5f4..d85790b6bd06f 100644
--- a/backup/moodle2/restore_plugin.class.php
+++ b/backup/moodle2/restore_plugin.class.php
@@ -16,12 +16,17 @@
// along with Moodle. If not, see .
/**
- * @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 restore_plugin 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();
+
/**
* Class implementing the plugins support for moodle2 restore
*
diff --git a/backup/moodle2/restore_qtype_plugin.class.php b/backup/moodle2/restore_qtype_plugin.class.php
index 42c6c1d9910e7..40b06ac51a247 100644
--- a/backup/moodle2/restore_qtype_plugin.class.php
+++ b/backup/moodle2/restore_qtype_plugin.class.php
@@ -16,12 +16,17 @@
// along with Moodle. If not, see .
/**
- * @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 restore_qtype_plugin 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();
+
/**
* Class extending standard restore_plugin in order to implement some
* helper methods related with the questions (qtype plugin)
diff --git a/backup/moodle2/restore_report_plugin.class.php b/backup/moodle2/restore_report_plugin.class.php
index 7db2151b159e7..bc42c89655f64 100644
--- a/backup/moodle2/restore_report_plugin.class.php
+++ b/backup/moodle2/restore_report_plugin.class.php
@@ -19,10 +19,11 @@
/**
* Restore for plugin report.
*
- * @package moodlecore
- * @subpackage backup-moodle2
- * @copyright 2011 Petr Skoda
- * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ * @package core_backup
+ * @subpackage moodle2
+ * @category backup
+ * @copyright 2011 Petr Skoda
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
abstract class restore_report_plugin extends restore_plugin {
// Use default parent behaviour
diff --git a/backup/moodle2/restore_root_task.class.php b/backup/moodle2/restore_root_task.class.php
index a5163e969a7ec..319fe08ccd7a2 100644
--- a/backup/moodle2/restore_root_task.class.php
+++ b/backup/moodle2/restore_root_task.class.php
@@ -16,12 +16,16 @@
// along with Moodle. If not, see .
/**
- * @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 restore_root_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();
+
/**
* Start task that provides all the settings common to all restores and other initial steps
*
@@ -121,19 +125,6 @@ protected function define_settings() {
$this->add_setting($roleassignments);
$users->add_dependency($roleassignments);
- // Define user_files (dependent of users)
- $defaultvalue = false; // Safer default
- $changeable = false;
- if (isset($rootsettings['user_files']) && $rootsettings['user_files']) { // Only enabled when available
- $defaultvalue = true;
- $changeable = true;
- }
- $userfiles = new restore_user_files_setting('user_files', base_setting::IS_BOOLEAN, $defaultvalue);
- $userfiles->set_ui(new backup_setting_ui_checkbox($userfiles, get_string('rootsettinguserfiles', 'backup')));
- $userfiles->get_ui()->set_changeable($changeable);
- $this->add_setting($userfiles);
- $users->add_dependency($userfiles);
-
// Define activitites
$defaultvalue = false; // Safer default
$changeable = false;
diff --git a/backup/moodle2/restore_section_task.class.php b/backup/moodle2/restore_section_task.class.php
index 5c03bcb7b8502..9d48778fed1f6 100644
--- a/backup/moodle2/restore_section_task.class.php
+++ b/backup/moodle2/restore_section_task.class.php
@@ -16,12 +16,17 @@
// along with Moodle. If not, see .
/**
- * @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 restore_section_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();
+
/**
* section task that provides all the properties and common steps to be performed
* when one section is being restored
@@ -71,11 +76,9 @@ public function build() {
// Define the task contextid (the course one)
$this->contextid = get_context_instance(CONTEXT_COURSE, $this->get_courseid())->id;
- // Executed conditionally if restoring to new course or deleting or if overwrite_conf setting is enabled
- if ($this->get_target() == backup::TARGET_NEW_COURSE || $this->get_target() == backup::TARGET_CURRENT_DELETING ||
- $this->get_target() == backup::TARGET_EXISTING_DELETING || $this->get_setting_value('overwrite_conf') == true) {
- $this->add_step(new restore_section_structure_step('course_info', 'section.xml'));
- }
+ // We always try to restore as much info from sections as possible, no matter of the type
+ // of restore (new, existing, deleting, import...). MDL-27764
+ $this->add_step(new restore_section_structure_step('course_info', 'section.xml'));
// At the end, mark it as built
$this->built = true;
diff --git a/backup/moodle2/restore_settingslib.php b/backup/moodle2/restore_settingslib.php
index 6d8b162609a80..09f92fe0d3446 100644
--- a/backup/moodle2/restore_settingslib.php
+++ b/backup/moodle2/restore_settingslib.php
@@ -16,12 +16,17 @@
// along with Moodle. If not, see .
/**
- * @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 classes used to handle restore settings
+ *
+ * @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();
+
// TODO: Reduce these to the minimum because ui/dependencies are 100% separated
// Root restore settings
@@ -44,13 +49,6 @@ class restore_users_setting extends restore_generic_setting {}
*/
class restore_role_assignments_setting extends root_backup_setting {}
-/**
- * root setting to control if restore will create
- * user files or no (images, local storage), depends of @restore_users_setting
- * exactly in the same way than @restore_role_assignments_setting so we extend from it
- */
-class restore_user_files_setting extends restore_role_assignments_setting {}
-
/**
* root setting to control if restore will create activities
* A lot of other settings (_included at activity levels)
diff --git a/backup/moodle2/restore_stepslib.php b/backup/moodle2/restore_stepslib.php
index acf17be39b0b7..58048ec59a255 100644
--- a/backup/moodle2/restore_stepslib.php
+++ b/backup/moodle2/restore_stepslib.php
@@ -16,15 +16,16 @@
// along with Moodle. If not, see .
/**
- * @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 restore steps that will be used by common tasks in restore
+ *
+ * @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
*/
-/**
- * Define all the restore steps that will be used by common tasks in restore
- */
+defined('MOODLE_INTERNAL') || die();
/**
* delete old directories and conditionally create backup_temp_ids table
@@ -683,7 +684,7 @@ class restore_create_included_users extends restore_execution_step {
protected function define_execution() {
- restore_dbops::create_included_users($this->get_basepath(), $this->get_restoreid(), $this->get_setting_value('user_files'), $this->task->get_userid());
+ restore_dbops::create_included_users($this->get_basepath(), $this->get_restoreid(), $this->task->get_userid());
}
}
diff --git a/backup/moodle2/restore_subplugin.class.php b/backup/moodle2/restore_subplugin.class.php
index 8972e358405e2..bf21779f4fe7b 100644
--- a/backup/moodle2/restore_subplugin.class.php
+++ b/backup/moodle2/restore_subplugin.class.php
@@ -16,12 +16,17 @@
// along with Moodle. If not, see .
/**
- * @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 restore_subplugin 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();
+
/**
* Class implementing the subplugins support for moodle2 restore
*
diff --git a/backup/moodle2/restore_theme_plugin.class.php b/backup/moodle2/restore_theme_plugin.class.php
index 84931947dd57b..1935d448488d2 100644
--- a/backup/moodle2/restore_theme_plugin.class.php
+++ b/backup/moodle2/restore_theme_plugin.class.php
@@ -19,10 +19,11 @@
/**
* Restore for course plugin: theme.
*
- * @package moodlecore
- * @subpackage backup-moodle2
- * @copyright 2011 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 The Open University
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
abstract class restore_theme_plugin extends restore_plugin {
// Use default parent behaviour
diff --git a/backup/restorelib.php b/backup/restorelib.php
index 6eba7761df643..911df714a71bf 100644
--- a/backup/restorelib.php
+++ b/backup/restorelib.php
@@ -226,7 +226,7 @@ function restore_create_messages($restore,$xml_file) {
//Process contacts
if ($contactcount) {
if (!defined('RESTORE_SILENTLY')) {
- echo '
';
}
$counter = 0;
while ($counter < $contactcount) {
diff --git a/backup/util/dbops/backup_controller_dbops.class.php b/backup/util/dbops/backup_controller_dbops.class.php
index cd89d82f55fe3..dffdb8d73a06e 100644
--- a/backup/util/dbops/backup_controller_dbops.class.php
+++ b/backup/util/dbops/backup_controller_dbops.class.php
@@ -440,7 +440,6 @@ private static function apply_general_config_defaults(backup_controller $control
'backup_general_users' => 'users',
'backup_general_anonymize' => 'anonymize',
'backup_general_role_assignments' => 'role_assignments',
- 'backup_general_user_files' => 'user_files',
'backup_general_activities' => 'activities',
'backup_general_blocks' => 'blocks',
'backup_general_filters' => 'filters',
diff --git a/backup/util/dbops/backup_plan_dbops.class.php b/backup/util/dbops/backup_plan_dbops.class.php
index f6e25b7f49890..2ce9434ee3d39 100644
--- a/backup/util/dbops/backup_plan_dbops.class.php
+++ b/backup/util/dbops/backup_plan_dbops.class.php
@@ -204,7 +204,7 @@ public static function get_default_backup_filename($format, $type, $id, $users,
global $DB;
// Calculate backup word
- $backupword = str_replace(' ', '_', moodle_strtolower(get_string('backupfilename')));
+ $backupword = str_replace(' ', '_', textlib::strtolower(get_string('backupfilename')));
$backupword = trim(clean_filename($backupword), '_');
$shortname = '';
@@ -228,7 +228,7 @@ public static function get_default_backup_filename($format, $type, $id, $users,
break;
}
$shortname = str_replace(' ', '_', $shortname);
- $shortname = moodle_strtolower(trim(clean_filename($shortname), '_'));
+ $shortname = textlib::strtolower(trim(clean_filename($shortname), '_'));
}
$name = empty($shortname) ? $id : $shortname;
@@ -236,7 +236,7 @@ public static function get_default_backup_filename($format, $type, $id, $users,
// Calculate date
$backupdateformat = str_replace(' ', '_', get_string('backupnameformat', 'langconfig'));
$date = userdate(time(), $backupdateformat, 99, false);
- $date = moodle_strtolower(trim(clean_filename($date), '_'));
+ $date = textlib::strtolower(trim(clean_filename($date), '_'));
// Calculate info
$info = '';
diff --git a/backup/util/dbops/restore_dbops.class.php b/backup/util/dbops/restore_dbops.class.php
index 58342b2a59a20..25f2e533d1c4d 100644
--- a/backup/util/dbops/restore_dbops.class.php
+++ b/backup/util/dbops/restore_dbops.class.php
@@ -730,7 +730,7 @@ public static function send_files_to_pool($basepath, $restoreid, $component, $fi
* ready to be created. Also, annotate their newids
* once created for later reference
*/
- public static function create_included_users($basepath, $restoreid, $userfiles, $userid) {
+ public static function create_included_users($basepath, $restoreid, $userid) {
global $CFG, $DB;
$authcache = array(); // Cache to get some bits from authentication plugins
@@ -871,10 +871,6 @@ public static function create_included_users($basepath, $restoreid, $userfiles,
// Create user files in pool (profile, icon, private) by context
restore_dbops::send_files_to_pool($basepath, $restoreid, 'user', 'icon', $recuser->parentitemid, $userid);
restore_dbops::send_files_to_pool($basepath, $restoreid, 'user', 'profile', $recuser->parentitemid, $userid);
- if ($userfiles) { // private files only if enabled in settings
- restore_dbops::send_files_to_pool($basepath, $restoreid, 'user', 'private', $recuser->parentitemid, $userid);
- }
-
}
}
$rs->close();
diff --git a/backup/util/helper/backup_cron_helper.class.php b/backup/util/helper/backup_cron_helper.class.php
index 8631be6488df6..32ab61e3a1c6a 100644
--- a/backup/util/helper/backup_cron_helper.class.php
+++ b/backup/util/helper/backup_cron_helper.class.php
@@ -323,7 +323,6 @@ public static function launch_automated_backup($course, $starttime, $userid) {
$settings = array(
'users' => 'backup_auto_users',
'role_assignments' => 'backup_auto_role_assignments',
- 'user_files' => 'backup_auto_user_files',
'activities' => 'backup_auto_activities',
'blocks' => 'backup_auto_blocks',
'filters' => 'backup_auto_filters',
@@ -460,7 +459,7 @@ public static function remove_excess_backups($course) {
$storage = $config->backup_auto_storage;
$dir = $config->backup_auto_destination;
- $backupword = str_replace(' ', '_', moodle_strtolower(get_string('backupfilename')));
+ $backupword = str_replace(' ', '_', textlib::strtolower(get_string('backupfilename')));
$backupword = trim(clean_filename($backupword), '_');
if (!file_exists($dir) || !is_dir($dir) || !is_writable($dir)) {
diff --git a/backup/util/settings/backup_setting.class.php b/backup/util/settings/backup_setting.class.php
index 2d19245fda7e5..8b6c3f07964dc 100644
--- a/backup/util/settings/backup_setting.class.php
+++ b/backup/util/settings/backup_setting.class.php
@@ -16,16 +16,18 @@
// along with Moodle. If not, see .
/**
- * @package moodlecore
- * @subpackage backup-settings
- * @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_setting class
+ *
+ * @package core_backup
+ * @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();
+
/**
- * This abstract class defines one backup_setting
- *
- * TODO: Finish phpdocs
+ * Parent class for all backup settings
*/
abstract class backup_setting extends base_setting implements checksumable {
@@ -35,12 +37,12 @@ abstract class backup_setting extends base_setting implements checksumable {
const SECTION_LEVEL = 9;
const ACTIVITY_LEVEL = 13;
+ /** @var int Level of the setting, eg {@link self::ROOT_LEVEL} */
+ protected $level;
+
/**
- * One of the above constants
- * @var {int}
+ * {@inheritdoc}
*/
- protected $level; // level of the setting
-
public function __construct($name, $vtype, $value = null, $visibility = self::VISIBLE, $status = self::NOT_LOCKED) {
parent::__construct($name, $vtype, $value, $visibility, $status);
// Generate a default ui
@@ -48,9 +50,7 @@ public function __construct($name, $vtype, $value = null, $visibility = self::VI
}
/**
- * Returns the level of the setting
- *
- * @return {int} One of the above constants
+ * @return int Level of the setting, eg {@link self::ROOT_LEVEL}
*/
public function get_level() {
return $this->level;
@@ -112,7 +112,7 @@ public function is_checksum_correct($checksum) {
}
}
-/*
+/**
* Exception class used by all the @backup_setting stuff
*/
class backup_setting_exception extends base_setting_exception {
diff --git a/backup/util/settings/base_setting.class.php b/backup/util/settings/base_setting.class.php
index 82e6eb1b1d9ec..765c6ac1aab77 100644
--- a/backup/util/settings/base_setting.class.php
+++ b/backup/util/settings/base_setting.class.php
@@ -86,6 +86,15 @@ abstract class base_setting {
*/
protected $help = array();
+ /**
+ * Instantiates a setting object
+ *
+ * @param string $name Name of the setting
+ * @param string $vtype Type of the setting, eg {@link self::IS_TEXT}
+ * @param mixed $value Value of the setting
+ * @param bool $visibility Is the setting visible in the UI, eg {@link self::VISIBLE}
+ * @param int $status Status of the setting with regards to the locking, eg {@link self::NOT_LOCKED}
+ */
public function __construct($name, $vtype, $value = null, $visibility = self::VISIBLE, $status = self::NOT_LOCKED) {
// Check vtype
if ($vtype !== self::IS_BOOLEAN && $vtype !== self::IS_INTEGER &&
@@ -294,7 +303,7 @@ public function register_dependency(setting_dependency $dependency) {
if ($this->is_circular_reference($dependency->get_dependent_setting())) {
$a = new stdclass();
$a->alreadydependent = $this->name;
- $a->main = $dependentsetting->get_name();
+ $a->main = $dependency->get_dependent_setting()->get_name();
throw new base_setting_exception('setting_circular_reference', $a);
}
$this->dependencies[$dependency->get_dependent_setting()->get_name()] = $dependency;
diff --git a/backup/util/settings/root/root_backup_setting.class.php b/backup/util/settings/root/root_backup_setting.class.php
index 62a0f1740bf8c..7b459e6f30598 100644
--- a/backup/util/settings/root/root_backup_setting.class.php
+++ b/backup/util/settings/root/root_backup_setting.class.php
@@ -16,19 +16,24 @@
// along with Moodle. If not, see .
/**
- * @package moodlecore
- * @subpackage backup-settings
- * @copyright 2010 onwards Eloy Lafuente (stronk7) {@link http://stronk7.com}
- * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ * Defines root_backup_setting class
+ *
+ * @package core_backup
+ * @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 class containing all the common stuff for root backup settings
- *
- * TODO: Finish phpdocs
*/
abstract class root_backup_setting extends backup_setting {
+ /**
+ * {@inheritdoc}
+ */
public function __construct($name, $vtype, $value = null, $visibility = self::VISIBLE, $status = self::NOT_LOCKED) {
$this->level = self::ROOT_LEVEL;
parent::__construct($name, $vtype, $value, $visibility, $status);
diff --git a/backup/util/settings/simpletest/testsettings.php b/backup/util/settings/simpletest/testsettings.php
index fd079cc62c909..7d0d8a794fd3f 100644
--- a/backup/util/settings/simpletest/testsettings.php
+++ b/backup/util/settings/simpletest/testsettings.php
@@ -32,10 +32,12 @@
require_once($CFG->dirroot . '/backup/backup.class.php');
require_once($CFG->dirroot . '/backup/util/settings/base_setting.class.php');
require_once($CFG->dirroot . '/backup/util/settings/backup_setting.class.php');
+require_once($CFG->dirroot . '/backup/util/settings/setting_dependency.class.php');
require_once($CFG->dirroot . '/backup/util/settings/root/root_backup_setting.class.php');
require_once($CFG->dirroot . '/backup/util/settings/activity/activity_backup_setting.class.php');
require_once($CFG->dirroot . '/backup/util/settings/section/section_backup_setting.class.php');
require_once($CFG->dirroot . '/backup/util/settings/course/course_backup_setting.class.php');
+require_once($CFG->dirroot . '/backup/util/ui/backup_ui_setting.class.php');
/*
* setting tests (all)
@@ -209,6 +211,21 @@ function test_base_setting() {
$this->assertEqual($e->a->alreadydependent, 'test4');
}
+ $bs1 = new mock_base_setting('test1', base_setting::IS_INTEGER, null);
+ $bs2 = new mock_base_setting('test2', base_setting::IS_INTEGER, null);
+ $bs1->register_dependency(new setting_dependency_disabledif_empty($bs1, $bs2));
+ try {
+ // $bs1 is already dependent on $bs2 so this should fail.
+ $bs2->register_dependency(new setting_dependency_disabledif_empty($bs2, $bs1));
+ $this->assertTrue(false, 'base_setting_exception expected');
+ } catch (exception $e) {
+ $this->assertTrue($e instanceof base_setting_exception);
+ $this->assertEqual($e->errorcode, 'setting_circular_reference');
+ $this->assertTrue($e->a instanceof stdclass);
+ $this->assertEqual($e->a->main, 'test1');
+ $this->assertEqual($e->a->alreadydependent, 'test2');
+ }
+
// Create 3 settings and observe between them, last one must
// automatically inherit all the settings defined in the main one
$bs1 = new mock_base_setting('test1', base_setting::IS_INTEGER, null);
diff --git a/backup/util/ui/renderer.php b/backup/util/ui/renderer.php
index 08454409e316c..7afcdfd368af4 100644
--- a/backup/util/ui/renderer.php
+++ b/backup/util/ui/renderer.php
@@ -97,7 +97,9 @@ public function backup_details($details, $nextstageurl) {
$html .= html_writer::start_tag('div', array('class'=>'backup-section settings-section'));
$html .= $this->output->heading(get_string('backupsettings', 'backup'), 2, array('class'=>'header'));
foreach ($details->root_settings as $label=>$value) {
- if ($label == 'filename') continue;
+ if ($label == 'filename' or $label == 'user_files') {
+ continue;
+ }
$html .= $this->backup_detail_pair(get_string('rootsetting'.str_replace('_','',$label), 'backup'), $value?$yestick:$notick);
}
$html .= html_writer::end_tag('div');
@@ -568,6 +570,12 @@ public function render_import_course_search(import_course_search $component) {
$output = html_writer::start_tag('div', array('class' => 'import-course-search'));
if ($component->get_count() === 0) {
$output .= $this->output->notification(get_string('nomatchingcourses', 'backup'));
+
+ $output .= html_writer::start_tag('div', array('class'=>'ics-search'));
+ $output .= html_writer::empty_tag('input', array('type'=>'text', 'name'=>restore_course_search::$VAR_SEARCH, 'value'=>$component->get_search()));
+ $output .= html_writer::empty_tag('input', array('type'=>'submit', 'name'=>'searchcourses', 'value'=>get_string('search')));
+ $output .= html_writer::end_tag('div');
+
$output .= html_writer::end_tag('div');
return $output;
}
diff --git a/backup/util/ui/restore_ui_components.php b/backup/util/ui/restore_ui_components.php
index adae38a6474f8..b95681dee5afc 100644
--- a/backup/util/ui/restore_ui_components.php
+++ b/backup/util/ui/restore_ui_components.php
@@ -164,22 +164,37 @@ final public function search() {
$this->totalcount = 0;
$contextlevel = $this->get_itemcontextlevel();
list($sql, $params) = $this->get_searchsql();
- $resultset = $DB->get_recordset_sql($sql, $params, 0, 250);
- foreach ($resultset as $result) {
- context_instance_preload($result);
- $context = get_context_instance($contextlevel, $result->id);
- if (count($this->requiredcapabilities) > 0) {
- foreach ($this->requiredcapabilities as $cap) {
- if (!has_capability($cap['capability'], $context, $cap['user'])) {
- continue 2;
+ $blocksz = 5000;
+ $offs = 0;
+ // Get total number, to avoid some incorrect iterations
+ $countsql = preg_replace('/ORDER BY.*/', '', $sql);
+ $totalcourses = $DB->count_records_sql("SELECT COUNT(*) FROM ($countsql) sel", $params);
+ // User to be checked is always the same (usually null, get it form first element)
+ $firstcap = reset($this->requiredcapabilities);
+ $userid = isset($firstcap['user']) ? $firstcap['user'] : null;
+ // Extract caps to check, this saves us a bunch of iterations
+ $requiredcaps = array();
+ foreach ($this->requiredcapabilities as $cap) {
+ $requiredcaps[] = $cap['capability'];
+ }
+ // Iterate while we have records and haven't reached MAXRESULTS
+ while ($totalcourses > $offs and $this->totalcount < self::$MAXRESULTS) {
+ $resultset = $DB->get_records_sql($sql, $params, $offs, $blocksz);
+ foreach ($resultset as $result) {
+ context_instance_preload($result);
+ $context = get_context_instance($contextlevel, $result->id);
+ if (count($requiredcaps) > 0) {
+ if (!has_all_capabilities($requiredcaps, $context, $userid)) {
+ continue;
}
}
+ $this->results[$result->id] = $result;
+ $this->totalcount++;
+ if ($this->totalcount >= self::$MAXRESULTS) {
+ break;
+ }
}
- $this->results[$result->id] = $result;
- $this->totalcount++;
- if ($this->totalcount >= self::$MAXRESULTS) {
- break;
- }
+ $offs += $blocksz;
}
return $this->totalcount;
diff --git a/blocks/community/communitycourse.php b/blocks/community/communitycourse.php
index 8daffbf5e1615..dbd9e075d77f5 100644
--- a/blocks/community/communitycourse.php
+++ b/blocks/community/communitycourse.php
@@ -128,7 +128,7 @@
$remove = optional_param('remove', '', PARAM_INTEGER);
$communityid = optional_param('communityid', '', PARAM_INTEGER);
if ($remove != -1 and !empty($communityid) and confirm_sesskey()) {
- $communitymanager->block_community_remove_course($communityid, $USER->id);
+ $communitymanager->block_community_remove_course($communityid, $USER->id);
echo $OUTPUT->header();
echo $renderer->remove_success(new moodle_url(get_referer(false)));
echo $OUTPUT->footer();
@@ -245,4 +245,4 @@
}
}
-echo $OUTPUT->footer();
\ No newline at end of file
+echo $OUTPUT->footer();
diff --git a/blocks/community/db/install.xml b/blocks/community/db/install.xml
index 9803f0a9b3f8b..7ee85bb46ff81 100644
--- a/blocks/community/db/install.xml
+++ b/blocks/community/db/install.xml
@@ -1,13 +1,13 @@
-
-
-
+
+
diff --git a/blocks/community/locallib.php b/blocks/community/locallib.php
index f76088fc34ce1..5c39f75348e9b 100644
--- a/blocks/community/locallib.php
+++ b/blocks/community/locallib.php
@@ -82,7 +82,7 @@ public function block_community_download_course_backup($course) {
global $CFG, $USER;
require_once($CFG->libdir . "/filelib.php");
require_once($CFG->dirroot. "/course/publish/lib.php");
-
+
$params['courseid'] = $course->id;
$params['filetype'] = HUB_BACKUP_FILE_TYPE;
@@ -104,7 +104,7 @@ public function block_community_download_course_backup($course) {
$token = $registeredhub->token;
$curlurl .= '&token='.$token;
}
-
+
$ch = curl_init($curlurl);
curl_setopt($ch, CURLOPT_FILE, $fp);
$data = curl_exec($ch);
@@ -143,4 +143,4 @@ public function block_community_remove_course($communityid, $userid) {
array('userid' => $userid, 'id' => $communityid));
}
-}
\ No newline at end of file
+}
diff --git a/blocks/community/renderer.php b/blocks/community/renderer.php
index 1df8f82cb47df..4fb6c508bf03d 100644
--- a/blocks/community/renderer.php
+++ b/blocks/community/renderer.php
@@ -124,7 +124,7 @@ public function course_list($courses, $huburl, $contextcourseid) {
//create title html
$coursename = html_writer::tag('h3', $course->fullname,
array('class' => 'hubcoursetitle'));
- $coursenamehtml = html_writer::tag('div', $coursename,
+ $coursenamehtml = html_writer::tag('div', $coursename,
array('class' => 'hubcoursetitlepanel'));
// create screenshots html
diff --git a/blocks/community/yui/imagegallery/imagegallery.js b/blocks/community/yui/imagegallery/imagegallery.js
index 4671ad29ba67a..f91abb08e4203 100644
--- a/blocks/community/yui/imagegallery/imagegallery.js
+++ b/blocks/community/yui/imagegallery/imagegallery.js
@@ -44,12 +44,12 @@ YUI.add('moodle-block_community-imagegallery', function(Y) {
this.overlay.render();
this.overlay.hide();
-
+
//attach a show event on the image divs ()
for (var i=0;iâ†";
var nextimagelink = "
→
";
-
+
/// need to load the images in the overlay
var overlay = Y.one('#imageoverlay');
overlay.setContent('');
-
+
overlay.append(Y.Node.create(''));
this.overlay.destroy();
this.overlay = new M.core.dialogue({
- headerContent:previousimagelink + '
' + nextimagelink,
bodyContent:Y.one('#imageoverlay').get('innerHTML'),
visible: false, //by default it is not displayed
@@ -127,7 +127,7 @@ YUI.add('moodle-block_community-imagegallery', function(Y) {
if(overlaywidth > screenshot.width) {
overlaywidth = screenshot.width;
}
-
+
this.overlay.set('width', overlaywidth);
this.overlay.set("centered", true);
this.overlay.show();
@@ -196,4 +196,4 @@ YUI.add('moodle-block_community-imagegallery', function(Y) {
}, '@VERSION@', {
requires:['base','node','overlay', 'moodle-enrol-notification']
-});
\ No newline at end of file
+});
diff --git a/blocks/completionstatus/block_completionstatus.php b/blocks/completionstatus/block_completionstatus.php
index 7013b1292ce80..07a7b473a6c66 100644
--- a/blocks/completionstatus/block_completionstatus.php
+++ b/blocks/completionstatus/block_completionstatus.php
@@ -36,7 +36,7 @@
class block_completionstatus extends block_base {
public function init() {
- $this->title = get_string('completionstatus', 'block_completionstatus');
+ $this->title = get_string('pluginname', 'block_completionstatus');
}
public function get_content() {
diff --git a/blocks/completionstatus/lang/en/block_completionstatus.php b/blocks/completionstatus/lang/en/block_completionstatus.php
index 50bea4e88d16c..fcc965ac7fdc0 100644
--- a/blocks/completionstatus/lang/en/block_completionstatus.php
+++ b/blocks/completionstatus/lang/en/block_completionstatus.php
@@ -1,7 +1,6 @@
first} of {$a->second}';
$string['pluginname'] = 'Course completion status';
diff --git a/blocks/course_list/block_course_list.php b/blocks/course_list/block_course_list.php
index 3c773a63e2a4b..282f9e22d07d4 100644
--- a/blocks/course_list/block_course_list.php
+++ b/blocks/course_list/block_course_list.php
@@ -4,7 +4,7 @@
class block_course_list extends block_list {
function init() {
- $this->title = get_string('courses');
+ $this->title = get_string('pluginname', 'block_course_list');
}
function has_config() {
diff --git a/blocks/course_list/lang/en/block_course_list.php b/blocks/course_list/lang/en/block_course_list.php
index a30a5c01fe9e0..4e79fc13a4bdb 100644
--- a/blocks/course_list/lang/en/block_course_list.php
+++ b/blocks/course_list/lang/en/block_course_list.php
@@ -29,4 +29,4 @@
$string['confighideallcourseslink'] = 'Hide "All courses" link at the bottom of the block. Link hiding does not affects Admin\'s view';
$string['hideallcourseslink'] = 'Hide All courses link';
$string['owncourses'] = 'Admin user sees own courses';
-$string['pluginname'] = 'Course list';
+$string['pluginname'] = 'Courses';
diff --git a/blocks/dock.js b/blocks/dock.js
index c01445fb67f7d..5560a32d7aa7f 100644
--- a/blocks/dock.js
+++ b/blocks/dock.js
@@ -478,7 +478,7 @@ M.core_dock.delayEvent = function(event, options, target) {
*/
M.core_dock.fixTitleOrientation = function(item, title, text) {
var Y = this.Y;
-
+
var title = Y.one(title);
if(M.core_dock.cfg.orientation != 'vertical') {
@@ -809,7 +809,7 @@ M.core_dock.genericblock.prototype = {
*/
initialise_block : function(Y, node) {
M.core_dock.init(Y);
-
+
this.Y = Y;
if (!node) {
return false;
@@ -919,7 +919,7 @@ M.core_dock.genericblock.prototype = {
// Register an event so that when it is removed we can put it back as a block
dockitem.on('dockeditem:itemremoved', this.return_to_block, this, dockitem);
dock.add(dockitem);
-
+
if (!this.skipsetposition) {
// save the users preference
M.util.set_user_preference('docked_block_instance_'+this.id, 1);
diff --git a/blocks/html/lib.php b/blocks/html/lib.php
index 4d8fc11b22842..17d98cecb2823 100644
--- a/blocks/html/lib.php
+++ b/blocks/html/lib.php
@@ -18,11 +18,18 @@
/**
* Form for editing HTML block instances.
*
- * @package block_html
* @copyright 2010 Petr Skoda (http://skodak.org)
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ * @package block_html
+ * @category files
+ * @param stdClass $course course object
+ * @param stdClass $birecord_or_cm block instance record
+ * @param stdClass $context context object
+ * @param string $filearea file area
+ * @param array $args extra arguments
+ * @param bool $forcedownload whether or not force download
+ * @return bool
*/
-
function block_html_pluginfile($course, $birecord_or_cm, $context, $filearea, $args, $forcedownload) {
global $SCRIPT;
@@ -79,4 +86,4 @@ function block_html_global_db_replace($search, $replace) {
}
}
$instances->close();
-}
\ No newline at end of file
+}
diff --git a/blocks/navigation/block_navigation.php b/blocks/navigation/block_navigation.php
index 8bfa9b7179f10..d5610c06199bd 100644
--- a/blocks/navigation/block_navigation.php
+++ b/blocks/navigation/block_navigation.php
@@ -1,5 +1,4 @@
config->enabledock) || $this->config->enabledock=='yes'));
}
+ /**
+ * Gets Javascript that may be required for navigation
+ */
function get_required_javascript() {
global $CFG;
user_preference_allow_ajax_update('docked_block_instance_'.$this->instance->id, PARAM_INT);
@@ -124,6 +132,8 @@ function get_required_javascript() {
/**
* Gets the content for this block by grabbing it from $this->page
+ *
+ * @return object $this->content
*/
function get_content() {
global $CFG, $OUTPUT;
@@ -134,7 +144,7 @@ function get_content() {
// JS for navigation moved to the standard theme, the code will probably have to depend on the actual page structure
// $this->page->requires->js('/lib/javascript-navigation.js');
// Navcount is used to allow us to have multiple trees although I dont' know why
- // you would want to trees the same
+ // you would want two trees the same
block_navigation::$navcount++;
@@ -192,7 +202,7 @@ function get_content() {
$options = array();
$options['linkcategories'] = (!empty($this->config->linkcategories) && $this->config->linkcategories == 'yes');
-
+
// Grab the items to display
$renderer = $this->page->get_renderer('block_navigation');
$this->content = new stdClass();
@@ -208,10 +218,10 @@ function get_content() {
* Returns the attributes to set for this block
*
* This function returns an array of HTML attributes for this block including
- * the defaults
- * {@link block_tree->html_attributes()} is used to get the default arguments
+ * the defaults.
+ * {@link block_tree::html_attributes()} is used to get the default arguments
* and then we check whether the user has enabled hover expansion and add the
- * appropriate hover class if it has
+ * appropriate hover class if it has.
*
* @return array An array of HTML attributes
*/
@@ -227,85 +237,79 @@ public function html_attributes() {
* Trims the text and shorttext properties of this node and optionally
* all of its children.
*
+ * @param navigation_node $node
* @param int $mode One of navigation_node::TRIM_*
* @param int $long The length to trim text to
* @param int $short The length to trim shorttext to
* @param bool $recurse Recurse all children
- * @param textlib|null $textlib
*/
- public function trim(navigation_node $node, $mode=1, $long=50, $short=25, $recurse=true, $textlib=null) {
- if ($textlib == null) {
- $textlib = textlib_get_instance();
- }
+ public function trim(navigation_node $node, $mode=1, $long=50, $short=25, $recurse=true) {
switch ($mode) {
case self::TRIM_RIGHT :
- if ($textlib->strlen($node->text)>($long+3)) {
+ if (textlib::strlen($node->text)>($long+3)) {
// Truncate the text to $long characters
- $node->text = $this->trim_right($textlib, $node->text, $long);
+ $node->text = $this->trim_right($node->text, $long);
}
- if (is_string($node->shorttext) && $textlib->strlen($node->shorttext)>($short+3)) {
+ if (is_string($node->shorttext) && textlib::strlen($node->shorttext)>($short+3)) {
// Truncate the shorttext
- $node->shorttext = $this->trim_right($textlib, $node->shorttext, $short);
+ $node->shorttext = $this->trim_right($node->shorttext, $short);
}
break;
case self::TRIM_LEFT :
- if ($textlib->strlen($node->text)>($long+3)) {
+ if (textlib::strlen($node->text)>($long+3)) {
// Truncate the text to $long characters
- $node->text = $this->trim_left($textlib, $node->text, $long);
+ $node->text = $this->trim_left($node->text, $long);
}
- if (is_string($node->shorttext) && $textlib->strlen($node->shorttext)>($short+3)) {
+ if (is_string($node->shorttext) && textlib::strlen($node->shorttext)>($short+3)) {
// Truncate the shorttext
- $node->shorttext = $this->trim_left($textlib, $node->shorttext, $short);
+ $node->shorttext = $this->trim_left($node->shorttext, $short);
}
break;
case self::TRIM_CENTER :
- if ($textlib->strlen($node->text)>($long+3)) {
+ if (textlib::strlen($node->text)>($long+3)) {
// Truncate the text to $long characters
- $node->text = $this->trim_center($textlib, $node->text, $long);
+ $node->text = $this->trim_center($node->text, $long);
}
- if (is_string($node->shorttext) && $textlib->strlen($node->shorttext)>($short+3)) {
+ if (is_string($node->shorttext) && textlib::strlen($node->shorttext)>($short+3)) {
// Truncate the shorttext
- $node->shorttext = $this->trim_center($textlib, $node->shorttext, $short);
+ $node->shorttext = $this->trim_center($node->shorttext, $short);
}
break;
}
if ($recurse && $node->children->count()) {
foreach ($node->children as &$child) {
- $this->trim($child, $mode, $long, $short, true, $textlib);
+ $this->trim($child, $mode, $long, $short, true);
}
}
}
/**
* Truncate a string from the left
- * @param textlib $textlib
* @param string $string The string to truncate
* @param int $length The length to truncate to
* @return string The truncated string
*/
- protected function trim_left($textlib, $string, $length) {
- return '...'.$textlib->substr($string, $textlib->strlen($string)-$length, $length);
+ protected function trim_left($string, $length) {
+ return '...'.textlib::substr($string, textlib::strlen($string)-$length, $length);
}
/**
* Truncate a string from the right
- * @param textlib $textlib
* @param string $string The string to truncate
* @param int $length The length to truncate to
* @return string The truncated string
*/
- protected function trim_right($textlib, $string, $length) {
- return $textlib->substr($string, 0, $length).'...';
+ protected function trim_right($string, $length) {
+ return textlib::substr($string, 0, $length).'...';
}
/**
* Truncate a string in the center
- * @param textlib $textlib
* @param string $string The string to truncate
* @param int $length The length to truncate to
* @return string The truncated string
*/
- protected function trim_center($textlib, $string, $length) {
+ protected function trim_center($string, $length) {
$trimlength = ceil($length/2);
- $start = $textlib->substr($string, 0, $trimlength);
- $end = $textlib->substr($string, $textlib->strlen($string)-$trimlength);
+ $start = textlib::substr($string, 0, $trimlength);
+ $end = textlib::substr($string, textlib::strlen($string)-$trimlength);
$string = $start.'...'.$end;
return $string;
}
diff --git a/blocks/navigation/edit_form.php b/blocks/navigation/edit_form.php
index 0d36b6b09fa06..3134e59f23e74 100644
--- a/blocks/navigation/edit_form.php
+++ b/blocks/navigation/edit_form.php
@@ -1,5 +1,4 @@
.
+/**
+ * Outputs the navigation tree.
+ *
+ * @since 2.0
+ * @package block_navigation
+ * @copyright 2009 Sam Hemelryk
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ */
+
+/**
+ * Renderer for block navigation
+ *
+ * @package block_navigation
+ * @category navigation
+ * @copyright 2009 Sam Hemelryk
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ */
class block_navigation_renderer extends plugin_renderer_base {
-
+ /**
+ * Returns the content of the navigation tree.
+ *
+ * @param global_navigation $navigation
+ * @param int $expansionlimit
+ * @param array $options
+ * @return string $content
+ */
public function navigation_tree(global_navigation $navigation, $expansionlimit, array $options = array()) {
$navigation->add_class('navigation_node');
$content = $this->navigation_node(array($navigation), array('class'=>'block_tree list'), $expansionlimit, $options);
@@ -10,7 +48,16 @@ public function navigation_tree(global_navigation $navigation, $expansionlimit,
}
return $content;
}
-
+ /**
+ * Produces a navigation node for the navigation tree
+ *
+ * @param array $items
+ * @param array $attrs
+ * @param int $expansionlimit
+ * @param array $options
+ * @param int $depth
+ * @return string
+ */
protected function navigation_node($items, $attrs=array(), $expansionlimit=null, array $options = array(), $depth=1) {
// exit if empty, we don't want an empty ul element
@@ -116,4 +163,4 @@ protected function navigation_node($items, $attrs=array(), $expansionlimit=null,
}
}
-}
\ No newline at end of file
+}
diff --git a/blocks/navigation/version.php b/blocks/navigation/version.php
index 3d5bf5eed0fcf..fee1d15918cee 100644
--- a/blocks/navigation/version.php
+++ b/blocks/navigation/version.php
@@ -17,8 +17,7 @@
/**
* Version details
*
- * @package block
- * @subpackage navigation
+ * @package block_navigation
* @copyright 1999 onwards Martin Dougiamas (http://dougiamas.com)
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
diff --git a/blocks/online_users/db/access.php b/blocks/online_users/db/access.php
index d042fac3e4bcf..ff00c60bb0037 100644
--- a/blocks/online_users/db/access.php
+++ b/blocks/online_users/db/access.php
@@ -1,27 +1,28 @@
.
-///////////////////////////////////////////////////////////////////////////
-// //
-// NOTICE OF COPYRIGHT //
-// //
-// Moodle - Modular Object-Oriented Dynamic Learning Environment //
-// http://moodle.com //
-// //
-// Copyright (C) 1999 onwards Martin Dougiamas http://moodle.com //
-// //
-// This program 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 2 of the License, or //
-// (at your option) any later version. //
-// //
-// This program 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: //
-// //
-// http://www.gnu.org/copyleft/gpl.html //
-// //
-///////////////////////////////////////////////////////////////////////////
+/**
+ * Online users block caps.
+ *
+ * @package block_online_users
+ * @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(
diff --git a/blocks/participants/block_participants.php b/blocks/participants/block_participants.php
index 5779210ab75af..deeeb7d9989ee 100644
--- a/blocks/participants/block_participants.php
+++ b/blocks/participants/block_participants.php
@@ -19,10 +19,13 @@ function get_content() {
$this->content->icons = array();
$this->content->footer = '';
- /// MDL-13252 Always get the course context or else the context may be incorrect in the user/index.php
- $currentcontext = $this->page->context;
+ // user/index.php expect course context, so get one if page has module context.
+ $currentcontext = $this->page->context->get_course_context(false);
- if ($this->page->course->id == SITEID) {
+ if (empty($currentcontext)) {
+ $this->content = '';
+ return $this->content;
+ } else if ($this->page->course->id == SITEID) {
if (!has_capability('moodle/site:viewparticipants', get_context_instance(CONTEXT_SYSTEM))) {
$this->content = '';
return $this->content;
@@ -33,6 +36,7 @@ function get_content() {
return $this->content;
}
}
+
$icon = ' ';
$this->content->items[] = ''.$icon.get_string('participants').'';
@@ -46,5 +50,3 @@ function applicable_formats() {
}
}
-
-
diff --git a/blocks/private_files/block_private_files.php b/blocks/private_files/block_private_files.php
index 32e1282e5b3ea..594f27600f584 100644
--- a/blocks/private_files/block_private_files.php
+++ b/blocks/private_files/block_private_files.php
@@ -27,7 +27,7 @@
class block_private_files extends block_base {
function init() {
- $this->title = get_string('myfiles');
+ $this->title = get_string('pluginname', 'block_private_files');
}
function specialization() {
diff --git a/blocks/private_files/lang/en/block_private_files.php b/blocks/private_files/lang/en/block_private_files.php
index f13e21fcf5ea0..e3970e6fa3ba3 100644
--- a/blocks/private_files/lang/en/block_private_files.php
+++ b/blocks/private_files/lang/en/block_private_files.php
@@ -24,5 +24,5 @@
*/
$string['managemyfiles'] = 'Manage my files';
-$string['pluginname'] = 'User private files';
+$string['pluginname'] = 'My private files';
$string['privatefiles'] = 'Private files';
diff --git a/blocks/rss_client/block_rss_client.php b/blocks/rss_client/block_rss_client.php
index 8ca1504f974d4..086983d179270 100644
--- a/blocks/rss_client/block_rss_client.php
+++ b/blocks/rss_client/block_rss_client.php
@@ -26,7 +26,7 @@
class block_rss_client extends block_base {
function init() {
- $this->title = get_string('feedstitle', 'block_rss_client');
+ $this->title = get_string('pluginname', 'block_rss_client');
}
function preferred_width() {
@@ -267,13 +267,10 @@ function get_item_html($item){
*/
function format_title($title,$max=64) {
- // Loading the textlib singleton instance. We are going to need it.
- $textlib = textlib_get_instance();
-
- if ($textlib->strlen($title) <= $max) {
+ if (textlib::strlen($title) <= $max) {
return s($title);
} else {
- return s($textlib->substr($title,0,$max-3).'...');
+ return s(textlib::substr($title,0,$max-3).'...');
}
}
diff --git a/blocks/rss_client/db/access.php b/blocks/rss_client/db/access.php
index 45cbf7472c050..6eeb8629d9b73 100644
--- a/blocks/rss_client/db/access.php
+++ b/blocks/rss_client/db/access.php
@@ -1,32 +1,28 @@
:
-//
-// component_name should be the same as the directory name of the mod or block.
-//
-// Core moodle capabilities are defined thus:
-// moodle/:
-//
-// Examples: mod/forum:viewpost
-// block/recent_activity:view
-// moodle/site:deleteuser
-//
-// The variable name for the capability definitions array is $capabilities
-
+// 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 .
+
+/**
+ * RSS client block caps.
+ *
+ * @package block_rss_client
+ * @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(
diff --git a/blocks/rss_client/db/install.xml b/blocks/rss_client/db/install.xml
index e5f9ebf189f21..90096d38b416b 100644
--- a/blocks/rss_client/db/install.xml
+++ b/blocks/rss_client/db/install.xml
@@ -1,17 +1,17 @@
-
-
-
-
+
+
+
-
-
+
+
diff --git a/blocks/rss_client/editfeed.php b/blocks/rss_client/editfeed.php
index 5711917027518..d25e090769d47 100644
--- a/blocks/rss_client/editfeed.php
+++ b/blocks/rss_client/editfeed.php
@@ -220,7 +220,7 @@ public static function autodiscover_feed_url($url){
$settingsurl = new moodle_url('/admin/settings.php?section=blocksettingrss_client');
$PAGE->navbar->add(get_string('blocks'));
- $PAGE->navbar->add(get_string('feedstitle', 'block_rss_client'), $settingsurl);
+ $PAGE->navbar->add(get_string('pluginname', 'block_rss_client'), $settingsurl);
$PAGE->navbar->add(get_string('managefeeds', 'block_rss_client'));
$PAGE->navbar->add($strtitle);
diff --git a/blocks/rss_client/lang/en/block_rss_client.php b/blocks/rss_client/lang/en/block_rss_client.php
index aa809efb95c59..33ca8175a12cb 100644
--- a/blocks/rss_client/lang/en/block_rss_client.php
+++ b/blocks/rss_client/lang/en/block_rss_client.php
@@ -52,7 +52,6 @@
$string['feedsaddedit'] = 'Add/edit feeds';
$string['feedsconfigurenewinstance'] = 'Click here to configure this block to display RSS feeds.';
$string['feedsconfigurenewinstance2'] = 'Click the edit icon above to configure this block to display RSS feeds.';
-$string['feedstitle'] = 'Remote RSS Feeds';
$string['feedupdated'] = 'News feed updated';
$string['feedurl'] = 'Feed URL';
$string['findmorefeeds'] = 'Find more RSS feeds';
@@ -61,7 +60,7 @@
$string['nofeeds'] = 'There are no RSS feeds defined for this site.';
$string['numentries'] = 'Entries per feed';
$string['pickfeed'] = 'Pick a news feed';
-$string['pluginname'] = 'RSS client';
+$string['pluginname'] = 'Remote RSS feeds';
$string['remotenewsfeed'] = 'Remote news feed';
$string['rss_client:createprivatefeeds'] = 'Create private RSS feeds';
$string['rss_client:createsharedfeeds'] = 'Create shared RSS feeds';
diff --git a/blocks/rss_client/managefeeds.php b/blocks/rss_client/managefeeds.php
index 553a61932555e..321aed4d7a175 100644
--- a/blocks/rss_client/managefeeds.php
+++ b/blocks/rss_client/managefeeds.php
@@ -86,7 +86,7 @@
$settingsurl = new moodle_url('/admin/settings.php?section=blocksettingrss_client');
$managefeeds = new moodle_url('/blocks/rss_client/managefeeds.php', $urlparams);
$PAGE->navbar->add(get_string('blocks'));
-$PAGE->navbar->add(get_string('feedstitle', 'block_rss_client'), $settingsurl);
+$PAGE->navbar->add(get_string('pluginname', 'block_rss_client'), $settingsurl);
$PAGE->navbar->add(get_string('managefeeds', 'block_rss_client'), $managefeeds);
echo $OUTPUT->header();
diff --git a/blocks/rss_client/viewfeed.php b/blocks/rss_client/viewfeed.php
index ef8da2944bc3f..469e621283af8 100644
--- a/blocks/rss_client/viewfeed.php
+++ b/blocks/rss_client/viewfeed.php
@@ -74,7 +74,7 @@
$settingsurl = new moodle_url('/admin/settings.php?section=blocksettingrss_client');
$managefeeds = new moodle_url('/blocks/rss_client/managefeeds.php', $urlparams);
$PAGE->navbar->add(get_string('blocks'));
-$PAGE->navbar->add(get_string('feedstitle', 'block_rss_client'), $settingsurl);
+$PAGE->navbar->add(get_string('pluginname', 'block_rss_client'), $settingsurl);
$PAGE->navbar->add(get_string('managefeeds', 'block_rss_client'));
$PAGE->navbar->add($strviewfeed);
echo $OUTPUT->header();
diff --git a/blocks/section_links/config_instance.html b/blocks/section_links/config_instance.html
index af42b297beb22..efc2fbc4238f5 100644
--- a/blocks/section_links/config_instance.html
+++ b/blocks/section_links/config_instance.html
@@ -19,7 +19,7 @@
* Section links block
*
* @package moodlecore
- * @Author Jason Hardin
+ * @Author Jason Hardin
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
diff --git a/blocks/selfcompletion/block_selfcompletion.php b/blocks/selfcompletion/block_selfcompletion.php
index 9954a39443732..9fe4a84b37345 100644
--- a/blocks/selfcompletion/block_selfcompletion.php
+++ b/blocks/selfcompletion/block_selfcompletion.php
@@ -36,7 +36,7 @@
class block_selfcompletion extends block_base {
public function init() {
- $this->title = get_string('selfcompletion', 'block_selfcompletion');
+ $this->title = get_string('pluginname', 'block_selfcompletion');
}
public function get_content() {
diff --git a/blocks/selfcompletion/lang/en/block_selfcompletion.php b/blocks/selfcompletion/lang/en/block_selfcompletion.php
index 03cf0dc032d77..403d0b2f2a751 100644
--- a/blocks/selfcompletion/lang/en/block_selfcompletion.php
+++ b/blocks/selfcompletion/lang/en/block_selfcompletion.php
@@ -26,5 +26,4 @@
$string['alreadyselfcompleted'] = 'You have already marked yourself as complete in this course';
$string['completecourse'] = 'Complete course';
$string['pluginname'] = 'Self completion';
-$string['selfcompletion'] = 'Self completion';
$string['selfcompletionnotenabled'] = 'The self completion criteria has not been enabled for this course';
diff --git a/blog/lib.php b/blog/lib.php
index 080df708c88f7..ab9fd52fb856f 100644
--- a/blog/lib.php
+++ b/blog/lib.php
@@ -150,8 +150,6 @@ function blog_sync_external_entries($externalblog) {
$rssfile = new moodle_simplepie_file($externalblog->url);
$filetest = new SimplePie_Locator($rssfile);
- $textlib = textlib_get_instance(); // Going to use textlib services
-
if (!$filetest->is_feed($rssfile)) {
$externalblog->failedlastsync = 1;
$DB->update_record('blog_external', $externalblog);
@@ -203,8 +201,8 @@ function blog_sync_external_entries($externalblog) {
$newentry->subject = clean_param($entry->get_title(), PARAM_TEXT);
// Observe 128 max chars in DB
// TODO: +1 to raise this to 255
- if ($textlib->strlen($newentry->subject) > 128) {
- $newentry->subject = $textlib->substr($newentry->subject, 0, 125) . '...';
+ if (textlib::strlen($newentry->subject) > 128) {
+ $newentry->subject = textlib::substr($newentry->subject, 0, 125) . '...';
}
$newentry->summary = $entry->get_description();
@@ -239,8 +237,7 @@ function blog_sync_external_entries($externalblog) {
$oldesttimestamp = $timestamp;
}
- $textlib = textlib_get_instance();
- if ($textlib->strlen($newentry->uniquehash) > 255) {
+ if (textlib::strlen($newentry->uniquehash) > 255) {
// The URL for this item is too long for the field. Rather than add
// the entry without the link we will skip straight over it.
// RSS spec says recommended length 500, we use 255.
diff --git a/calendar/delete.php b/calendar/delete.php
index 8a3d0977036b4..7ab989a471fa8 100644
--- a/calendar/delete.php
+++ b/calendar/delete.php
@@ -68,8 +68,8 @@
// Is used several times, and sometimes with modification if required
$viewcalendarurl = new moodle_url(CALENDAR_URL.'view.php', array('view'=>'upcoming'));
-$viewcalendarurl->param('cal_y', date('Y', $event->timestart));
-$viewcalendarurl->param('cal_m', date('m', $event->timestart));
+$viewcalendarurl->param('cal_y', userdate($event->timestart, '%Y'));
+$viewcalendarurl->param('cal_m', userdate($event->timestart, '%m'));
// If confirm is set (PARAM_BOOL) then we have confirmation of initention to delete
if ($confirm) {
@@ -124,4 +124,4 @@
calendar_print_event($event, false);
echo $OUTPUT->box_end();
-echo $OUTPUT->footer();
\ No newline at end of file
+echo $OUTPUT->footer();
diff --git a/calendar/event.php b/calendar/event.php
index dd98be36decc5..130e682351f1b 100644
--- a/calendar/event.php
+++ b/calendar/event.php
@@ -168,9 +168,9 @@
$params = array(
'view' => 'day',
- 'cal_d' => date('j', $event->timestart),
- 'cal_m' => date('n', $event->timestart),
- 'cal_y' => date('y', $event->timestart),
+ 'cal_d' => userdate($event->timestart, '%d'),
+ 'cal_m' => userdate($event->timestart, '%m'),
+ 'cal_y' => userdate($event->timestart, '%Y'),
);
$eventurl = new moodle_url('/calendar/view.php', $params);
if (!empty($event->courseid) && $event->courseid != SITEID) {
diff --git a/calendar/event_form.php b/calendar/event_form.php
index 1dd18d1759d4a..9bbae6c259e8d 100644
--- a/calendar/event_form.php
+++ b/calendar/event_form.php
@@ -133,14 +133,16 @@ function definition () {
$mform->setDefault('repeats', 1);
$mform->disabledIf('repeats','repeat','notchecked');
- } else if ($repeatedevents > 0) {
+ } else if ($repeatedevents) {
$mform->addElement('hidden', 'repeatid');
$mform->setType('repeatid', PARAM_INT);
$mform->addElement('header', 'repeatedevents', get_string('repeatedevents', 'calendar'));
- $mform->addElement('checkbox', 'repeateditall', null, get_string('repeateditall', 'calendar', $repeatedevents), 'repeat');
- $mform->setDefault('repeateditall', 'checked');
+ $mform->addElement('radio', 'repeateditall', null, get_string('repeateditall', 'calendar', $this->_customdata->event->eventrepeats), 1);
+ $mform->addElement('radio', 'repeateditall', null, get_string('repeateditthis', 'calendar'), 0);
+
+ $mform->setDefault('repeateditall', 1);
}
diff --git a/calendar/export_execute.php b/calendar/export_execute.php
index 7f195becba551..ee0bed88d7a3e 100644
--- a/calendar/export_execute.php
+++ b/calendar/export_execute.php
@@ -152,7 +152,7 @@
$ev = new iCalendar_event;
$ev->add_property('uid', $event->id.'@'.$hostaddress);
$ev->add_property('summary', $event->name);
- $ev->add_property('description', $event->description);
+ $ev->add_property('description', clean_param($event->description, PARAM_NOTAGS));
$ev->add_property('class', 'PUBLIC'); // PUBLIC / PRIVATE / CONFIDENTIAL
$ev->add_property('last-modified', Bennu::timestamp_to_datetime($event->timemodified));
$ev->add_property('dtstamp', Bennu::timestamp_to_datetime()); // now
diff --git a/calendar/lib.php b/calendar/lib.php
index e4e76cd901d61..645ae189470e8 100644
--- a/calendar/lib.php
+++ b/calendar/lib.php
@@ -1510,7 +1510,7 @@ function calendar_get_default_courses() {
$courses = array();
if (!empty($CFG->calendar_adminseesall) && has_capability('moodle/calendar:manageentries', get_context_instance(CONTEXT_SYSTEM))) {
list ($select, $join) = context_instance_preload_sql('c.id', CONTEXT_COURSE, 'ctx');
- $sql = "SELECT c.* $select
+ $sql = "SELECT DISTINCT c.* $select
FROM {course} c
JOIN {event} e ON e.courseid = c.id
$join";
@@ -1622,13 +1622,13 @@ function calendar_format_event_time($event, $now, $linkparams = null, $usecommon
}
}
} else {
- $time = ' ';
+ $time = calendar_time_representation($event->timestart);
// Set printable representation
if (!$showtime) {
$day = calendar_day_representation($event->timestart, $now, $usecommonwords);
$url = calendar_get_link_href(new moodle_url(CALENDAR_URL.'view.php', $linkparams), $startdate['mday'], $startdate['mon'], $startdate['year']);
- $eventtime = html_writer::link($url, $day).trim($time);
+ $eventtime = html_writer::link($url, $day).', '.trim($time);
} else {
$eventtime = $time;
}
diff --git a/cohort/lib.php b/cohort/lib.php
index e33f77aed031d..367b19ec9dedc 100644
--- a/cohort/lib.php
+++ b/cohort/lib.php
@@ -71,8 +71,9 @@ function cohort_add_cohort($cohort) {
*/
function cohort_update_cohort($cohort) {
global $DB;
- if (isset($cohort->component) and empty($cohort->component)) {
- $cohort->component = NULL;
+ if (property_exists($cohort, 'component') and empty($cohort->component)) {
+ // prevent NULLs
+ $cohort->component = '';
}
$cohort->timemodified = time();
$DB->update_record('cohort', $cohort);
diff --git a/config-dist.php b/config-dist.php
index dbc732c31c6d4..abc8da1b26dc7 100644
--- a/config-dist.php
+++ b/config-dist.php
@@ -383,7 +383,7 @@
// memory limit to something higher.
// The value for the settings should be a valid PHP memory value. e.g. 512M, 1G
//
-// $CFG->extramemorylimit = 1G;
+// $CFG->extramemorylimit = '1G';
//
// The CSS files the Moodle produces can be extremely large and complex, especially
// if you are using a custom theme that builds upon several other themes.
diff --git a/course/completion.js b/course/completion.js
index 3be2c38c6fa54..4d9542a2c993e 100644
--- a/course/completion.js
+++ b/course/completion.js
@@ -18,17 +18,21 @@ M.core_completion.init = function(Y) {
} else {
var current = args.state.get('value');
-
+ var modulename = args.modulename.get('value');
if (current == 1) {
+ var altstr = M.str.completion['completion-alt-manual-y'].replace('{$a}', modulename);
+ var titlestr = M.str.completion['completion-title-manual-y'].replace('{$a}', modulename);
args.state.set('value', 0);
args.image.set('src', M.util.image_url('i/completion-manual-y', 'moodle'));
- args.image.set('alt', M.str.completion['completion-alt-manual-y']);
- args.image.set('title', M.str.completion['completion-title-manual-y']);
+ args.image.set('alt', altstr);
+ args.image.set('title', titlestr);
} else {
+ var altstr = M.str.completion['completion-alt-manual-n'].replace('{$a}', modulename);
+ var titlestr = M.str.completion['completion-title-manual-n'].replace('{$a}', modulename);
args.state.set('value', 1);
args.image.set('src', M.util.image_url('i/completion-manual-n', 'moodle'));
- args.image.set('alt', M.str.completion['completion-alt-manual-n']);
- args.image.set('title', M.str.completion['completion-title-manual-n']);
+ args.image.set('alt', altstr);
+ args.image.set('title', titlestr);
}
}
@@ -48,6 +52,7 @@ M.core_completion.init = function(Y) {
var completionstate = 0;
var state = null;
var image = null;
+ var modulename = null;
var inputs = Y.Node.getDOMNode(form).getElementsByTagName('input');
for (var i=0; icriteria_grade)) {
- if ($grade_item = grade_category::fetch_course_category($course->id)->grade_item) {
- $grade_item->gradepass = $data->criteria_grade_value;
- if (method_exists($grade_item, 'update')) {
- $grade_item->update('course/completion.php');
- }
- }
+ if ($grade_item = grade_category::fetch_course_category($course->id)->grade_item) {
+ $grade_item->gradepass = $data->criteria_grade_value;
+ if (method_exists($grade_item, 'update')) {
+ $grade_item->update('course/completion.php');
+ }
+ }
}
redirect($CFG->wwwroot."/course/view.php?id=$course->id", get_string('changessaved'));
diff --git a/course/format/topics/format.php b/course/format/topics/format.php
index cc7c3c03af0b0..b8ce8f2286241 100644
--- a/course/format/topics/format.php
+++ b/course/format/topics/format.php
@@ -42,7 +42,7 @@
if (($marker >=0) && has_capability('moodle/course:setcurrentsection', $context) && confirm_sesskey()) {
$course->marker = $marker;
- $DB->set_field("course", "marker", $marker, array("id"=>$course->id));
+ course_set_marker($course->id, $marker);
}
$streditsummary = get_string('editsummary');
diff --git a/course/info.php b/course/info.php
index aca5105489bc7..4da6eb3e0c60a 100644
--- a/course/info.php
+++ b/course/info.php
@@ -37,7 +37,7 @@
$PAGE->set_pagelayout('popup');
$PAGE->set_url('/course/info.php', array('id' => $course->id));
$PAGE->set_title(get_string("summaryof", "", $course->fullname));
- $PAGE->set_heading('Course info');
+ $PAGE->set_heading(get_string('courseinfo'));
$PAGE->set_course($course);
$PAGE->navbar->add(get_string('summary'));
diff --git a/course/lib.php b/course/lib.php
index d34d9ecbeb251..6282112f86a86 100644
--- a/course/lib.php
+++ b/course/lib.php
@@ -389,8 +389,7 @@ function print_log($course, $user=0, $date=0, $order="l.time ASC", $page=0, $per
// If $log->url has been trimmed short by the db size restriction
// code in add_to_log, keep a note so we don't add a link to a broken url
- $tl=textlib_get_instance();
- $brokenurl=($tl->strlen($log->url)==100 && $tl->substr($log->url,97)=='...');
+ $brokenurl=(textlib::strlen($log->url)==100 && textlib::substr($log->url,97)=='...');
$row = array();
if ($course->id == SITEID) {
@@ -1341,6 +1340,18 @@ function course_set_display($courseid, $display) {
return $display;
}
+/**
+ * Set highlighted section. Only one section can be highlighted at the time.
+ *
+ * @param int $courseid course id
+ * @param int $marker highlight section with this number, 0 means remove higlightin
+ * @return void
+ */
+function course_set_marker($courseid, $marker) {
+ global $DB;
+ $DB->set_field("course", "marker", $marker, array('id' => $courseid));
+}
+
/**
* For a given course section, marks it visible or hidden,
* and does the same for every activity in that section
@@ -1435,8 +1446,6 @@ function print_section($course, $section, $mods, $modnamesused, $absolute=false,
$initialised = true;
}
- $tl = textlib_get_instance();
-
$modinfo = get_fast_modinfo($course);
$completioninfo = new completion_info($course);
@@ -1561,8 +1570,8 @@ function print_section($course, $section, $mods, $modnamesused, $absolute=false,
// Avoid unnecessary duplication: if e.g. a forum name already
// includes the word forum (or Forum, etc) then it is unhelpful
// to include that in the accessible description that is added.
- if (false !== strpos($tl->strtolower($instancename),
- $tl->strtolower($altname))) {
+ if (false !== strpos(textlib::strtolower($instancename),
+ textlib::strtolower($altname))) {
$altname = '';
}
// File type after name, for alphabetic lists (screen reader).
@@ -1721,9 +1730,9 @@ function print_section($course, $section, $mods, $modnamesused, $absolute=false,
}
if ($completionicon) {
$imgsrc = $OUTPUT->pix_url('i/completion-'.$completionicon);
- $imgalt = s(get_string('completion-alt-'.$completionicon, 'completion'));
+ $imgalt = s(get_string('completion-alt-'.$completionicon, 'completion', $mod->name));
if ($completion == COMPLETION_TRACKING_MANUAL && !$isediting) {
- $imgtitle = s(get_string('completion-title-'.$completionicon, 'completion'));
+ $imgtitle = s(get_string('completion-title-'.$completionicon, 'completion', $mod->name));
$newstate =
$completiondata->completionstate==COMPLETION_COMPLETE
? COMPLETION_INCOMPLETE
@@ -1742,6 +1751,7 @@ function print_section($course, $section, $mods, $modnamesused, $absolute=false,
echo "