]> git.mjollnir.org Git - moodle.git/commitdiff
MDL-14129, fix print_error call
authordongsheng <dongsheng>
Thu, 24 Apr 2008 02:48:36 +0000 (02:48 +0000)
committerdongsheng <dongsheng>
Thu, 24 Apr 2008 02:48:36 +0000 (02:48 +0000)
backup/lib.php
backup/restore.php
backup/restorelib.php
backup/try.php
lang/en_utf8/error.php

index f54eef308d1434dc7a849c67be1f26b4126607ac..b992db1b41b76872c0db99a979b3c7b10fb830a2 100644 (file)
                     }
                 }
                 } else {
-                    print_error("Upgrade of backup system failed! (Could not update version in config table)");
+                    print_error("upgradeversionfail");
                 }
             } else {
-                print_error("Backup tables could NOT be set up successfully!");
+                print_error("backuptablefail");
             }
         }
 
                     }
                 }
                 } else {
-                    print_error("Upgrade of backup system failed! (Could not update version in config table)");
+                    print_error("upgradeversionfail");
                 }
             } else {
-                print_error("Upgrade failed!  See backup/version.php");
+                print_error('upgradefail', '', '','See backup/version.php');
             }
 
         } else if ($backup_version < $CFG->backup_version) {
 
         if(!function_exists('utf8_encode')) {
             if (empty($justcheck)) {
-                print_error('You need to add XML support to your PHP installation');
+                print_error('needphpext', '', '', 'XML');
             } else {
                 return false;
             }
index 826bb96ce5727bfd894bf24df9828b75fc00f06e..475054aba7d44809be0ef5d17eab8ec60fe036bf 100644 (file)
         require_login($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, SITEID))) {
-            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("cannotfindsite");
     }
 
     //Check necessary functions exists. Thanks to gregb@crowncollege.edu
 
     //Get and check course
     if (! $course = get_record("course", "id", $id)) {
-        print_error("Course ID was incorrect (can't find it)");
+        print_error('invalidcourseid', '', '', $id);
     }
 
     //Print header
     } else if ($launch == "execute") {
         //Prevent multiple restore executions...
         if (empty($SESSION->cancontinue)) {
-            print_error("Multiple restore execution not allowed!");
+            print_error('multiplerestorenotallow');
         }
         //Unset this for the future
         unset($SESSION->cancontinue);
index b2ddf34e520ca8a5cc6c49e0640bc3b28d89c500..f8b4919ff8f1af5712d4ab22b9044b13b0e50a72 100644 (file)
@@ -2445,7 +2445,7 @@ define('RESTORE_GROUPS_GROUPINGS', 3);
                     } else {
                         // should not happen, as we check in restore_chech.php
                         // but handle the error if it does
-                        print_error("This backup file contains external Moodle Network Hosts that are not configured locally.");
+                        print_error('backupcontainexternal', 'error');
                     }
                 }
                 unset($user->mnethosturl);
@@ -8192,7 +8192,7 @@ define('RESTORE_GROUPS_GROUPINGS', 3);
         //Open file for writing
         //First, we check the course_id backup data folder exists and create it as necessary in CFG->dataroot
         if (!$dest_dir = make_upload_directory("$restore->course_id/backupdata")) {   // Backup folder
-            print_error("Could not create backupdata folder.  The site administrator needs to fix the file permissions");
+            print_error('cannotcreatebackupdir');
         }
         $status = check_dir_exists($dest_dir,true);
         $restorelog_file = fopen("$dest_dir/restorelog.html","a");
index 16d0c0e077d10871bc0f48f0dbcad55ec0ac5d7a..a845a6c3c4deb81a663dd7c828ffb80113c0fcd6 100644 (file)
@@ -11,7 +11,7 @@
 
     //Check site
     if (!$site = get_site()) {
-        print_error("Site not found!");
+        print_error("cannotfindsite");
     }
 
     //Check necessary functions exists. Thanks to gregb@crowncollege.edu
index 80fbbf3cde514acbd3304983fef8dda89fdab223..811b5dd69186286af5734c221fd6720e81bcf061 100644 (file)
@@ -7,10 +7,12 @@ $string['blockdoesnotexist'] = 'This block does not exist';
 $string['blockcannotinistantiate'] = 'Problem in instantiating block object';
 $string['blockcannotconfig'] = 'This block does not support global configuration';
 $string['backupcontainexternal'] = 'This backup file contains external Moodle Network Hosts that are not configured locally.';
+$string['backuptablefail'] = 'Backup tables could NOT be set up successfully!';
 $string['cannotassignrole'] = 'Cannot assign role in course';
 $string['cannotaddrss'] = 'You do not have permission to add rss feeds';
 $string['cannotsaveconfig'] = 'Problem saving config \"$a[0]\" as \"$a[1]\" for plugin \"$a[2]\"'; 
 $string['cannotsavefile'] = 'Cannot save the file\"$a[0]\/$a[1]\"!';
+$string['cannotcreatebackupdir'] = 'Could not create backupdata folder.  The site administrator needs to fix the file permissions';
 $string['cannotcreatelangdir'] = 'Cannot create lang dir.';
 $string['cannotcreatelangbase'] = 'Error: Could not create base lang directory.';
 $string['cannotcreatetempdir'] = 'Cannot create temp dir.';
@@ -121,6 +123,8 @@ $string['moduledoesnotexist'] = 'The instance of this module doesn\'t exist';
 $string['modulemissingcode'] = 'Module $a is missing the code needed to perform this function';
 $string['modulerequirementsnotmet'] = 'Module \"$a->modulename\" ($a->moduleversion) could not be installed.  It requires a newer version of Moodle (currently you are using $a->currentmoodle, you need $a->requiremoodle).';
 $string['mustbeteacher'] = 'You must be a teacher to look at this page';
+$string['multiplerestorenotallow'] = 'Multiple restore execution not allowed!';
+$string['needphpext'] = 'You need to add $a support to your PHP installation';
 $string['noblocks'] = 'No blocks found!';
 $string['nocontext'] = 'Sorry, but that course is not a valid context';
 $string['noinstances'] = 'There are no instances of $a in this course!';
@@ -180,6 +184,8 @@ $string['usernotupdatedadmin'] = 'Can not update admin accounts.';
 $string['usernotupdatederror'] = 'User not updated - error.';
 $string['usernotupdatednotexists'] = 'User not updated - does not exist.';
 $string['updatersserror'] = 'There was an error trying to update rss feed with id: $a';
+$string['upgradeversionfail'] = 'Upgrade of backup system failed! (Could not update version in config table)';
+$string['upgradefail'] = 'Upgrade failed! $a';
 $string['wrongcall'] = 'This script is called wrongly';
 $string['wrongcontextid'] = 'Context ID was incorrect (cannot find it)';
 $string['wrongdestpath'] = 'Wrong destination path.';