diff --git a/admin/cli/mysql_collation.php b/admin/cli/mysql_collation.php index adaadbba6c7..ae3c709816b 100644 --- a/admin/cli/mysql_collation.php +++ b/admin/cli/mysql_collation.php @@ -53,7 +53,7 @@ Options: -h, --help Print out this help Example: -\$ sudo -u www-data /usr/bin/php admin/cli/mysql_collation.php --collation=utf8_general_ci +\$ sudo -u www-data /usr/bin/php admin/cli/mysql_collation.php --collation=utf8mb4_unicode_ci "; if (!empty($options['collation'])) { @@ -145,9 +145,22 @@ if (!empty($options['collation'])) { $skipped++; } else { - $DB->change_database_structure("ALTER TABLE $table->name DEFAULT CHARACTER SET $charset DEFAULT COLLATE = $collation"); - echo "CONVERTED\n"; - $converted++; + try { + $DB->change_database_structure("ALTER TABLE $table->name CONVERT TO CHARACTER SET $charset COLLATE $collation"); + echo "CONVERTED\n"; + $converted++; + } catch (ddl_exception $e) { + $result = mysql_set_row_format($table->name, $charset, $collation, $engine); + if ($result) { + echo "CONVERTED\n"; + $converted++; + } else { + // We don't know what the problem is. Stop the conversion. + cli_error("Error: Tried to convert $table->name, but there was a problem. Please check the details of this + table and try again."); + die(); + } + } } $sql = "SHOW FULL COLUMNS FROM $table->name WHERE collation IS NOT NULL"; @@ -290,3 +303,26 @@ function mysql_get_column_collations($tablename) { $rs->close(); return $collations; } + +function mysql_set_row_format($tablename, $charset, $collation, $engine) { + global $DB; + + $sql = "SELECT row_format + FROM INFORMATION_SCHEMA.TABLES + WHERE table_schema = DATABASE() AND table_name = ?"; + $rs = $DB->get_record_sql($sql, array($tablename)); + if ($rs) { + if ($rs->row_format == 'Compact' || $rs->row_format == 'Redundant') { + $rowformat = $DB->get_row_format_sql($engine, $collation); + // Try to convert to compressed format and then try updating the collation again. + $DB->change_database_structure("ALTER TABLE $tablename $rowformat"); + $DB->change_database_structure("ALTER TABLE $tablename CONVERT TO CHARACTER SET $charset COLLATE $collation"); + } else { + // Row format may not be the problem. Can not diagnose problem. Send fail reply. + return false; + } + } else { + return false; + } + return true; +} diff --git a/admin/registration/forms.php b/admin/registration/forms.php index 92b15e8cb44..6e0b8a99bd1 100644 --- a/admin/registration/forms.php +++ b/admin/registration/forms.php @@ -232,7 +232,7 @@ class site_registration_form extends moodleform { } $language = get_config('hub', 'site_language_' . $cleanhuburl); if ($language === false) { - $language = current_language(); + $language = explode('_', current_language())[0]; } $geolocation = get_config('hub', 'site_geolocation_' . $cleanhuburl); $contactable = get_config('hub', 'site_contactable_' . $cleanhuburl); diff --git a/admin/roles/usersroles.php b/admin/roles/usersroles.php index 5e871e6198b..c455902c03e 100644 --- a/admin/roles/usersroles.php +++ b/admin/roles/usersroles.php @@ -193,8 +193,8 @@ function print_report_tree($contextid, $contexts, $systemcontext, $fullname, $al $strgoto = get_string('gotoassignroles', 'core_role', $a); $strcheck = get_string('checkuserspermissionshere', 'core_role', $a); } - echo ' ' . $OUTPUT->pix_icon('t/edit', 'core', $stredit) . ' '; - echo ' ' . $OUTPUT->pix_icon('t/preview', 'core', $strcheckpermissions) . ' '; + echo ' ' . $OUTPUT->pix_icon('t/edit', $stredit) . ' '; + echo ' ' . $OUTPUT->pix_icon('t/preview', $strcheckpermissions) . ' '; echo "
\n"; } } diff --git a/admin/tool/langimport/index.php b/admin/tool/langimport/index.php index 0e98a5d2de4..92a09dad241 100644 --- a/admin/tool/langimport/index.php +++ b/admin/tool/langimport/index.php @@ -40,7 +40,7 @@ if (empty($CFG->langotherroot)) { $mode = optional_param('mode', 0, PARAM_INT); // action $pack = optional_param_array('pack', array(), PARAM_SAFEDIR); // pack to install $uninstalllang = optional_param_array('uninstalllang', array(), PARAM_LANG);// installed pack to uninstall -$confirmtounistall = optional_param('confirmtouninstall', '', PARAM_ALPHAEXT); // uninstallation confirmation +$confirmtounistall = optional_param('confirmtouninstall', '', PARAM_SAFEPATH); // uninstallation confirmation $purgecaches = optional_param('purgecaches', false, PARAM_BOOL); // explicit caches reset if ($purgecaches) { @@ -74,7 +74,7 @@ if ($mode == DELETION_OF_SELECTED_LANG and (!empty($uninstalllang) or !empty($co // Actually deleting languages, languages to delete are passed as GET parameter as string // ...need to populate them to array. if (empty($uninstalllang)) { - $uninstalllang = explode('-', $confirmtounistall); + $uninstalllang = explode('/', $confirmtounistall); } if (in_array('en', $uninstalllang)) { @@ -84,8 +84,10 @@ if ($mode == DELETION_OF_SELECTED_LANG and (!empty($uninstalllang) or !empty($co } else if (empty($confirmtounistall) and confirm_sesskey()) { // User chose langs to be deleted, show confirmation. echo $OUTPUT->header(); echo $OUTPUT->confirm(get_string('uninstallconfirm', 'tool_langimport', implode(', ', $uninstalllang)), - 'index.php?mode='.DELETION_OF_SELECTED_LANG.'&confirmtouninstall='.implode('-', $uninstalllang), - 'index.php'); + new moodle_url($PAGE->url, array( + 'mode' => DELETION_OF_SELECTED_LANG, + 'confirmtouninstall' => implode('/', $uninstalllang), + )), $PAGE->url); echo $OUTPUT->footer(); die; diff --git a/admin/tool/log/backup/moodle2/restore_tool_log_logstore_subplugin.class.php b/admin/tool/log/backup/moodle2/restore_tool_log_logstore_subplugin.class.php index 0c00f00880a..c48c2c86c24 100644 --- a/admin/tool/log/backup/moodle2/restore_tool_log_logstore_subplugin.class.php +++ b/admin/tool/log/backup/moodle2/restore_tool_log_logstore_subplugin.class.php @@ -84,8 +84,7 @@ abstract class restore_tool_log_logstore_subplugin extends restore_subplugin { } } - // Roll dates. - $data->timecreated = $this->apply_date_offset($data->timecreated); + // There is no need to roll dates. Logs are supposed to be immutable. See MDL-44961. // Revert other to its original php way. $data->other = unserialize(base64_decode($data->other)); diff --git a/admin/tool/lp/templates/competency_rule_config.mustache b/admin/tool/lp/templates/competency_rule_config.mustache index b0e9db8440b..167a4237e8e 100644 --- a/admin/tool/lp/templates/competency_rule_config.mustache +++ b/admin/tool/lp/templates/competency_rule_config.mustache @@ -81,10 +81,11 @@ {{/config}} -