diff --git a/backup/util/ui/backup_moodleform.class.php b/backup/util/ui/backup_moodleform.class.php index f586d408da3..8fa06542f84 100644 --- a/backup/util/ui/backup_moodleform.class.php +++ b/backup/util/ui/backup_moodleform.class.php @@ -122,6 +122,8 @@ class backup_confirmation_form extends backup_moodleform { if (!array_key_exists('setting_root_filename', $errors)) { if (trim($data['setting_root_filename']) == '') { $errors['setting_root_filename'] = get_string('errorfilenamerequired', 'backup'); + } else if (strlen(trim($data['setting_root_filename'])) > 255) { + $errors['setting_root_filename'] = get_string('errorfilenametoolong', 'backup'); } else if (!preg_match('#\.mbz$#i', $data['setting_root_filename'])) { $errors['setting_root_filename'] = get_string('errorfilenamemustbezip', 'backup'); } diff --git a/lang/en/backup.php b/lang/en/backup.php index 5e2e3d43ce7..46ed93e7b4a 100644 --- a/lang/en/backup.php +++ b/lang/en/backup.php @@ -140,6 +140,7 @@ $string['error_block_for_module_not_found'] = 'Orphan block instance (id: {$a->b $string['error_course_module_not_found'] = 'Orphan course module (id: {$a}) found. This module will not be backed up.'; $string['errorcopyingbackupfile'] = "Failed to copy the backup file to the temporary folder before restoring."; $string['errorfilenamerequired'] = 'You must enter a valid filename for this backup'; +$string['errorfilenametoolong'] = 'The filename length you enter must be less than 255 characters'; $string['errorfilenamemustbezip'] = 'The filename you enter must be a ZIP file and have the .mbz extension'; $string['errorminbackup20version'] = 'This backup file has been created with one development version of Moodle backup ({$a->backup}). Minimum required is {$a->min}. Cannot be restored.'; $string['errorinvalidformat'] = 'Unknown backup format';