diff --git a/backup/backup_check.html b/backup/backup_check.html
index f17be59115a..feb1d12079c 100644
--- a/backup/backup_check.html
+++ b/backup/backup_check.html
@@ -7,16 +7,16 @@
if (!empty($course->id)) {
if (!has_capability('moodle/site:backup', get_context_instance(CONTEXT_COURSE, $course->id))) {
if (empty($to)) {
- print_error("You need to be a teacher or admin user to use this page.", '', "$CFG->wwwroot/login/index.php");
+ print_error("cannotuseadminadminorteacher", '', "$CFG->wwwroot/login/index.php");
} else {
if (!has_capability('moodle/site:backup', get_context_instance(CONTEXT_COURSE, $to))) {
- print_error("You need to be a teacher or admin user to use this page.", '', "$CFG->wwwroot/login/index.php");
+ print_error("cannotuseadminadminorteacher", '', "$CFG->wwwroot/login/index.php");
}
}
}
} else {
if (!has_capability('moodle/site:backup', get_context_instance(CONTEXT_SYSTEM))) {
- print_error("You need to be an admin user to use this page.", '', "$CFG->wwwroot/login/index.php");
+ print_error("cannotuseadmin", '', "$CFG->wwwroot/login/index.php");
}
}
@@ -30,14 +30,14 @@
//Check site
if (!$site = get_site()) {
- print_error("Site not found!");
+ print_error("siteisnotdefined", 'debug');
}
if ($count == 0) {
notice("No backupable modules are installed!");
}
if (!execute_sql("DELETE FROM {$CFG->prefix}backup_ids WHERE backup_code = '{$backupprefs->backup_unique_code}'",false)){
- print_error('Couldn\'t delete previous backup ids.');
+ print_error('cannotdeletebackupids');
}
?>
diff --git a/backup/backup_execute.html b/backup/backup_execute.html
index 2e754d7ab67..bd617878a3a 100644
--- a/backup/backup_execute.html
+++ b/backup/backup_execute.html
@@ -7,23 +7,23 @@
if (!empty($course->id)) {
if (!has_capability('moodle/site:backup', get_context_instance(CONTEXT_COURSE, $course->id))) {
if (empty($to)) {
- print_error("You need to be a teacher or admin user to use this page.", '', "$CFG->wwwroot/login/index.php");
+ print_error("cannotuseadminadminorteacher", '', "$CFG->wwwroot/login/index.php");
} else {
if (!has_capability('moodle/site:backup', get_context_instance(CONTEXT_COURSE, $to))) {
- print_error("You need to be a teacher or admin user to use this page.", '', "$CFG->wwwroot/login/index.php");
+ print_error("cannotuseadminadminorteacher", '', "$CFG->wwwroot/login/index.php");
}
}
}
} else {
if (!has_capability('moodle/site:backup', get_context_instance(CONTEXT_SYSTEM))) {
- print_error("You need to be an admin user to use this page.", '', "$CFG->wwwroot/login/index.php");
+ print_error("cannotuseadmin", '', "$CFG->wwwroot/login/index.php");
}
}
//Check site
if (!$site = get_site()) {
- print_error("Site not found!");
+ print_error("siteisnotdefined", 'debug');
}
$preferences = new StdClass;
diff --git a/backup/backup_form.html b/backup/backup_form.html
index 16e4004988b..fc1fe182536 100644
--- a/backup/backup_form.html
+++ b/backup/backup_form.html
@@ -7,22 +7,22 @@
if (!empty($course->id)) {
if (!has_capability('moodle/site:backup', get_context_instance(CONTEXT_COURSE, $course->id))) {
if (empty($to)) {
- print_error("You need to be a teacher or admin user to use this page.", '', "$CFG->wwwroot/login/index.php");
+ print_error("cannotuseadminadminorteacher", '', "$CFG->wwwroot/login/index.php");
} else {
if (!has_capability('moodle/site:backup', get_context_instance(CONTEXT_COURSE, $to))) {
- print_error("You need to be a teacher or admin user to use this page.", '', "$CFG->wwwroot/login/index.php");
+ print_error("cannotuseadminadminorteacher", '', "$CFG->wwwroot/login/index.php");
}
}
}
} else {
if (!has_capability('moodle/site:backup', get_context_instance(CONTEXT_SYSTEM))) {
- print_error("You need to be an admin user to use this page.", '', "$CFG->wwwroot/login/index.php");
+ print_error("cannotuseadmin", '', "$CFG->wwwroot/login/index.php");
}
}
//Check site
if (!$site = get_site()) {
- print_error("Site not found!");
+ print_error("siteisnotdefined", 'debug');
}
//Checks for the required files/functions to backup every mod
diff --git a/backup/restore_check.html b/backup/restore_check.html
index 3210bd184d9..c49b46dbd01 100644
--- a/backup/restore_check.html
+++ b/backup/restore_check.html
@@ -45,7 +45,8 @@
// check for session objects
if (empty($info) or empty($course_header)) {
- print_error( 'important information missing from SESSION' );
+ print_error('sessionmissing', 'debug', '',
+ 'info and course_header');
}
@@ -189,17 +190,17 @@
//Check admin
if (!empty($id)) {
if (!has_capability('moodle/site:restore', get_context_instance(CONTEXT_COURSE, $id))) {
- print_error("You need to be a teacher or admin user to use this page.", '', "$CFG->wwwroot/login/index.php");
+ print_error("cannotuseadminadminorteacher", '', "$CFG->wwwroot/login/index.php");
}
} else {
if (!has_capability('moodle/site:restore', get_context_instance(CONTEXT_SYSTEM))) {
- print_error("You need to be an admin user to use this page.", '', "$CFG->wwwroot/login/index.php");
+ print_error("cannotuseadmin", '', "$CFG->wwwroot/login/index.php");
}
}
//Check site
if (!$site = get_site()) {
- print_error("Site not found!");
+ print_error("siteisnotdefined", 'debug');
}
//Depending the selected restoreto:
@@ -271,9 +272,9 @@
} else if ((($restore->restoreto == 0 or $restore->restoreto == 1) and ($restore->course_id != 0)) or ($restore->restoreto == 2)) {
//Final access control check
if ($restore->course_id == 0 and !user_can_create_courses()) {
- print_error("You need to be a creator or admin to restore into new course!");
+ print_error("cannotrestoreadminorcreator");
} else if ($restore->course_id != 0 and !has_capability('moodle/site:restore', get_context_instance(CONTEXT_COURSE, $restore->course_id))) {
- print_error("You need to be an edit teacher or admin to restore into selected course!");
+ print_error("cannotrestoreadminoredit");
}
$show_continue_button = true;
//Check if we've selected any mod's user info and restore->users
diff --git a/backup/restore_execute.html b/backup/restore_execute.html
index 58757595d37..1216fe39331 100644
--- a/backup/restore_execute.html
+++ b/backup/restore_execute.html
@@ -24,30 +24,30 @@
if (!empty($id)) {
if (!has_capability('moodle/site:restore', get_context_instance(CONTEXT_COURSE, $id))) {
if (empty($to)) {
- print_error("You need to be a teacher or admin user to use this page.", '', "$CFG->wwwroot/login/index.php");
+ print_error("cannotuseadminadminorteacher", '', "$CFG->wwwroot/login/index.php");
} else {
if (!has_capability('moodle/site:restore', get_context_instance(CONTEXT_COURSE, $to))
&& !has_capability('moodle/site:import', get_context_instance(CONTEXT_COURSE, $to))) {
- print_error("You need to be a teacher or admin user to use this page.", '', "$CFG->wwwroot/login/index.php");
+ print_error("cannotuseadminadminorteacher", '', "$CFG->wwwroot/login/index.php");
}
}
}
} else {
if (!has_capability('moodle/site:restore', get_context_instance(CONTEXT_SYSTEM))) {
- print_error("You need to be an admin user to use this page.", '', "$CFG->wwwroot/login/index.php");
+ print_error("cannotuseadmin", '', "$CFG->wwwroot/login/index.php");
}
}
//Check site
if (!$site = get_site()) {
- print_error("Site not found!");
+ print_error("siteisnotdefined", 'debug');
}
$errorstr = '';
$status = restore_execute($restore,$info,$course_header,$errorstr);
if (!$status) {
- print_error ("An error has occurred and the restore could not be completed!");
+ print_error ("cannotrestore");
}
if (empty($restore->importing)) {
diff --git a/backup/restore_form.html b/backup/restore_form.html
index ce89b3a71d3..a6c5e4e5856 100644
--- a/backup/restore_form.html
+++ b/backup/restore_form.html
@@ -6,10 +6,10 @@
//Get objects from session
if (!($info = $SESSION->info)) {
- print_error( 'info object missing from session' );
+ print_error('sessionmissing' ,'debug', '', 'info');
}
if (!($course_header = $SESSION->course_header)) {
- print_error( 'course_header object missing from session' );
+ print_error('sessionmissing' ,'debug', '', 'course_header');
}
$restore_gradebook_history = optional_param('restore_gradebook_history', 0, PARAM_INT);
@@ -26,17 +26,17 @@
//Check admin
if (!empty($id)) {
if (!has_capability('moodle/site:restore', get_context_instance(CONTEXT_COURSE, $id))) {
- print_error("You need to be a teacher or admin user to use this page.", '', "$CFG->wwwroot/login/index.php");
+ print_error('cannotuseadminadminorteacher', '', '$CFG->wwwroot/login/index.php');
}
} else {
if (!has_capability('moodle/site:restore', get_context_instance(CONTEXT_SYSTEM))) {
- print_error("You need to be an admin user to use this page.", '', "$CFG->wwwroot/login/index.php");
+ print_error('cannotuseadmin', '', '$CFG->wwwroot/login/index.php');
}
}
//Check site
if (!$site = get_site()) {
- print_error("Site not found!");
+ print_error("siteisnotdefined", 'debug');
}
//Checks for the required files/functions to restore every mod
diff --git a/backup/restore_precheck.html b/backup/restore_precheck.html
index b0e052de49d..84b7eb44e2d 100644
--- a/backup/restore_precheck.html
+++ b/backup/restore_precheck.html
@@ -16,23 +16,23 @@
if (!empty($id)) {
if (!has_capability('moodle/site:restore', get_context_instance(CONTEXT_COURSE, $id))) {
if (empty($to)) {
- print_error("You need to be a teacher or admin user to use this page.", '', "$CFG->wwwroot/login/index.php");
+ print_error("cannotuseadminadminorteacher", '', "$CFG->wwwroot/login/index.php");
} else {
if (!has_capability('moodle/site:restore', get_context_instance(CONTEXT_COURSE, $to))
&& !has_capability('moodle/site:import', get_context_instance(CONTEXT_COURSE, $to))) {
- print_error("You need to be a teacher or admin user to use this page.", '', "$CFG->wwwroot/login/index.php");
+ print_error("cannotuseadminadminorteacher", '', "$CFG->wwwroot/login/index.php");
}
}
}
} else {
if (!has_capability('moodle/site:restore', get_context_instance(CONTEXT_SYSTEM))) {
- print_error("You need to be an admin user to use this page.", '', "$CFG->wwwroot/login/index.php");
+ print_error("cannotuseadmin", '', "$CFG->wwwroot/login/index.php");
}
}
//Check site
if (!$site = get_site()) {
- print_error("Site not found!");
+ print_error("siteisnotdefined", 'debug');
}
$errorstr = '';
@@ -42,7 +42,7 @@
$status = restore_precheck($id,$file,$errorstr);
if (!$status) {
- print_error("An error occured");
+ print_error("pleasereport");
}
?>
diff --git a/lang/en_utf8/debug.php b/lang/en_utf8/debug.php
index 9369db2c8aa..c0a00d71b74 100644
--- a/lang/en_utf8/debug.php
+++ b/lang/en_utf8/debug.php
@@ -22,6 +22,7 @@ $string['phpvaron'] = 'The PHP server variable \'$a[0]\' is not turned On - $a[1
$string['prefixcannotbeempty'] = 'Table prefix \"$a[0]\" cannot be empty for your target DB ($a[1])';
$string['prefixlimit'] = 'Table prefix \"$a\" maximum allowed length for Oracle DBs is 2cc.';
$string['withoutversion'] = 'Main version.php was not readable or specified';
+$string['sessionmissing'] = '$a object missing from session';
$string['siteisnotdefined'] = 'Site is not defined!';
?>
diff --git a/lang/en_utf8/error.php b/lang/en_utf8/error.php
index 7aa9496c746..2e8ab5aebe4 100644
--- a/lang/en_utf8/error.php
+++ b/lang/en_utf8/error.php
@@ -25,6 +25,7 @@ $string['cannotcreatesitedir'] = 'Cannot create site folder. The site administra
$string['cannotcreateorfindstructs'] = 'Error finding or creating section structures for this course';
$string['cannotcustomizelocallang'] = 'You do not have permission to customize the strings translation. This permission is controlled by the capability "moodle/site:langeditlocal". Set this capability to allow you to edit local language packages in case you want to modify translations for your site.';
$string['cannotdeletelangcache'] = 'Language cache can not be deleted, please fix permissions in dataroot/cache/languages!';
+$string['cannotdeletebackupids'] = 'Couldn\'t delete previous backup ids.';
$string['cannotdeletecourse'] = 'You do not have the permission to delete this course.';
$string['cannotdeleterole'] = 'It can not be deleted, because $a';
$string['cannotdeleterolewithid'] = 'Could not delete role with ID $a';
@@ -47,6 +48,7 @@ $string['cannotmetacourse'] = 'Could not add the selected course to this meta co
$string['cannotoverridebaserole'] = 'Can not override base role capabilities';
$string['cannotreadtmpfile'] = 'Error reading temporary file';
$string['cannotremovefrommeta'] = 'Could not remove the selected course from this meta course!';
+$string['cannotrestore'] = 'An error has occurred and the restore could not be completed!';
$string['cannotsavefile'] = 'Cannot save the file \"$a\".';
$string['cannotsavemd5file'] = 'Cannot save md5 file.';
$string['cannotsavezipfile'] = 'Cannot save ZIP file.';
@@ -65,6 +67,8 @@ $string['cannotupdatesubcate'] = 'Could not update a child category!';
$string['cannotupdatesubcourse'] = 'Could not update a child course!';
$string['cannotuseadmin'] = 'You need to be an admin user to use this page.';
$string['cannotuseadminadminorteacher'] = 'You need to be a teacher or admin user to use this page.';
+$string['cannotrestoreadminorcreator'] = 'You need to be a creator or admin user to restore into new course!';
+$string['cannotrestoreadminoredit'] = 'You need to be a edit teacher or admin user to restore into selected course!';
$string['cannotusepage'] = 'Only teacher and administrator can use this page.';
$string['cannotviewprofile'] = 'You can not view the profile of this user.';
$string['cantunenrollfrommetacourse'] = 'You can not unenrol from this meta course.';