Merge branch 'MDL-33812-22' of git://github.com/FMCorz/moodle into MOODLE_22_STABLE
This commit is contained in:
@@ -0,0 +1,17 @@
|
||||
This files describes API changes in /backup/*,
|
||||
information provided here is intended especially for developers.
|
||||
|
||||
=== 2.4 ===
|
||||
|
||||
* Since 2.3.1+ the backup file name schema has changed. The ID of the course will always be part of
|
||||
the filename regardless of the setting 'backup_shortname'. See MDL-33812.
|
||||
|
||||
=== 2.3 ===
|
||||
|
||||
* Since 2.3.1+ the backup file name schema has changed. The ID of the course will always be part of
|
||||
the filename regardless of the setting 'backup_shortname'. See MDL-33812.
|
||||
|
||||
=== 2.2 ===
|
||||
|
||||
* Since 2.2.4+ the backup file name schema has changed. The ID of the course will always be part of
|
||||
the filename regardless of the setting 'backup_shortname'. See MDL-33812.
|
||||
@@ -197,19 +197,19 @@ abstract class backup_plan_dbops extends backup_dbops {
|
||||
* @param int $courseid/$sectionid/$cmid
|
||||
* @param bool $users Should be true is users were included in the backup
|
||||
* @param bool $anonymised Should be true is user information was anonymized.
|
||||
* @param bool $useidasname true to use id, false to use strings (default)
|
||||
* @param bool $useidonly only use the ID in the file name
|
||||
* @return string The filename to use
|
||||
*/
|
||||
public static function get_default_backup_filename($format, $type, $id, $users, $anonymised, $useidasname = false) {
|
||||
public static function get_default_backup_filename($format, $type, $id, $users, $anonymised, $useidonly = false) {
|
||||
global $DB;
|
||||
|
||||
// Calculate backup word
|
||||
$backupword = str_replace(' ', '_', moodle_strtolower(get_string('backupfilename')));
|
||||
$backupword = trim(clean_filename($backupword), '_');
|
||||
|
||||
// Not $useidonly, lets fetch the name
|
||||
$shortname = '';
|
||||
// Not $useidasname, lets calculate it, else $id will be used
|
||||
if (!$useidasname) {
|
||||
if (!$useidonly) {
|
||||
// Calculate proper name element (based on type)
|
||||
switch ($type) {
|
||||
case backup::TYPE_1COURSE:
|
||||
@@ -231,7 +231,11 @@ abstract class backup_plan_dbops extends backup_dbops {
|
||||
$shortname = moodle_strtolower(trim(clean_filename($shortname), '_'));
|
||||
}
|
||||
|
||||
$name = empty($shortname) ? $id : $shortname;
|
||||
// The name will always contain the ID, but we append the course short name if requested.
|
||||
$name = $id;
|
||||
if (!$useidonly && $shortname != '') {
|
||||
$name .= '-' . $shortname;
|
||||
}
|
||||
|
||||
// Calculate date
|
||||
$backupdateformat = str_replace(' ', '_', get_string('backupnameformat', 'langconfig'));
|
||||
|
||||
@@ -561,17 +561,7 @@ abstract class backup_cron_automated_helper {
|
||||
if (!empty($dir) && ($storage == 1 || $storage == 2)) {
|
||||
// Calculate backup filename regex, ignoring the date/time/info parts that can be
|
||||
// variable, depending of languages, formats and automated backup settings
|
||||
|
||||
// MDL-33531: use different filenames depending on backup_shortname option
|
||||
if ( !empty($config->backup_shortname) ) {
|
||||
$context = get_context_instance(CONTEXT_COURSE, $course->id);
|
||||
$courseref = format_string($course->shortname, true, array('context' => $context));
|
||||
$courseref = str_replace(' ', '_', $courseref);
|
||||
$courseref = moodle_strtolower(trim(clean_filename($courseref), '_'));
|
||||
} else {
|
||||
$courseref = $course->id;
|
||||
}
|
||||
$filename = $backupword . '-' . backup::FORMAT_MOODLE . '-' . backup::TYPE_1COURSE . '-' .$courseref . '-';
|
||||
$filename = $backupword . '-' . backup::FORMAT_MOODLE . '-' . backup::TYPE_1COURSE . '-' .$course->id . '-';
|
||||
$regex = '#^'.preg_quote($filename, '#').'.*\.mbz$#';
|
||||
|
||||
// Store all the matching files into fullpath => timemodified array
|
||||
|
||||
+1
-1
@@ -67,7 +67,7 @@ $string['availablelicenses'] = 'Available licences';
|
||||
$string['backgroundcolour'] = 'Transparent colour';
|
||||
$string['backups'] = 'Backups';
|
||||
$string['backup_shortname'] = 'Use course name in backup filename';
|
||||
$string['backup_shortnamehelp'] = 'Use the course name as part of the backup filename instead of the course id number.';
|
||||
$string['backup_shortnamehelp'] = 'Use the course name as part of the backup filename.';
|
||||
$string['badwordsconfig'] = 'Enter your list of bad words separated by commas.';
|
||||
$string['badwordsdefault'] = 'If the custom list is empty, a default list from the language pack will be used.';
|
||||
$string['badwordslist'] = 'Custom bad words list';
|
||||
|
||||
Reference in New Issue
Block a user