mirror of
https://github.com/moodle/moodle.git
synced 2025-04-14 04:52:36 +02:00
MDL-14129, create a new debug.php, and fix print_error() call
This commit is contained in:
parent
5bf2650871
commit
78664df0f7
@ -34,7 +34,7 @@ if ($frm = data_submitted() and confirm_sesskey()) {
|
||||
$plugin = "auth/$auth";
|
||||
$name = $matches[1];
|
||||
if (!set_config($name, $value, $plugin)) {
|
||||
print_error("Problem saving config $name as $value for plugin $plugin");
|
||||
print_error("cannotsaveconfig", 'error', '', array($name, $value, $plugin));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -9,14 +9,14 @@
|
||||
$blockid = required_param('block', PARAM_INT);
|
||||
|
||||
if(!$blockrecord = blocks_get_record($blockid)) {
|
||||
print_error('This block does not exist');
|
||||
print_error('blockdoesnotexist', 'error');
|
||||
}
|
||||
|
||||
admin_externalpage_setup('blocksetting'.$blockrecord->name);
|
||||
|
||||
$block = block_instance($blockrecord->name);
|
||||
if($block === false) {
|
||||
print_error('Problem in instantiating block object');
|
||||
print_error('blockcannotinistantiate', 'error');
|
||||
}
|
||||
|
||||
// Define the data we're going to silently include in the instance config form here,
|
||||
@ -34,7 +34,7 @@
|
||||
print_error('confirmsesskeybad', 'error');
|
||||
}
|
||||
if(!$block->has_config()) {
|
||||
print_error('This block does not support global configuration');
|
||||
print_error('blockcannotconfig', 'error');
|
||||
}
|
||||
$remove = array_keys($hiddendata);
|
||||
foreach($remove as $item) {
|
||||
|
@ -33,7 +33,7 @@
|
||||
|
||||
if (!empty($hide) && confirm_sesskey()) {
|
||||
if (!$block = get_record('block', 'id', $hide)) {
|
||||
print_error("Block doesn't exist!");
|
||||
print_error('blockdoesnotexist', 'error');
|
||||
}
|
||||
set_field('block', 'visible', '0', 'id', $block->id); // Hide block
|
||||
admin_get_root(true, false); // settings not required - only pages
|
||||
@ -41,7 +41,7 @@
|
||||
|
||||
if (!empty($show) && confirm_sesskey() ) {
|
||||
if (!$block = get_record('block', 'id', $show)) {
|
||||
print_error("Block doesn't exist!");
|
||||
print_error('blockdoesnotexist', 'error');
|
||||
}
|
||||
set_field('block', 'visible', '1', 'id', $block->id); // Show block
|
||||
admin_get_root(true, false); // settings not required - only pages
|
||||
@ -49,7 +49,7 @@
|
||||
|
||||
if (!empty($multiple) && confirm_sesskey()) {
|
||||
if (!$block = blocks_get_record($multiple)) {
|
||||
print_error("Block doesn't exist!");
|
||||
print_error('blockdoesnotexist', 'error');
|
||||
}
|
||||
$block->multiple = !$block->multiple;
|
||||
update_record('block', $block);
|
||||
@ -61,7 +61,7 @@
|
||||
print_heading($strmanageblocks);
|
||||
|
||||
if (!$block = blocks_get_record($delete)) {
|
||||
print_error("Block doesn't exist!");
|
||||
print_error('blockdoesnotexist', 'error');
|
||||
}
|
||||
|
||||
if (!block_is_compatible($block->name)) {
|
||||
|
@ -37,7 +37,7 @@
|
||||
}
|
||||
|
||||
if (!confirm_sesskey()) {
|
||||
print_error('This script was called wrongly');
|
||||
print_error('wrongcall', 'error');
|
||||
}
|
||||
|
||||
/// OK, here goes ...
|
||||
|
@ -52,8 +52,8 @@
|
||||
|
||||
case 'show':
|
||||
// check filterpath is valid
|
||||
if (!array_key_exists($filterpath, $installedfilters)) {
|
||||
print_error("Filter $filterpath is not currently installed", '', $url);
|
||||
if (!array_key_exists($filterpath, $installedfilters))
|
||||
print_error('filternotinstalled', 'error', $url, $filterpath);
|
||||
} elseif (array_search($filterpath,$activefilters)) {
|
||||
// filterpath is already active - doubleclick??
|
||||
} else {
|
||||
@ -67,7 +67,7 @@
|
||||
$key=array_search($filterpath, $activefilters);
|
||||
// check filterpath is valid
|
||||
if ($key===false) {
|
||||
print_error("Filter $filterpath is not currently active", '', $url);
|
||||
print_error("filternotactive", 'error', $url, $filterpath );
|
||||
} elseif ($key>=(count($activefilters)-1)) {
|
||||
// cannot be moved any further down - doubleclick??
|
||||
} else {
|
||||
@ -82,7 +82,7 @@
|
||||
$key=array_search($filterpath, $activefilters);
|
||||
// check filterpath is valid
|
||||
if ($key===false) {
|
||||
print_error("Filter $filterpath is not currently active", '', $url);
|
||||
print_error("filternotactive", 'error', $url, $filterpath );
|
||||
} elseif ($key<1) {
|
||||
//cannot be moved any further up - doubleclick??
|
||||
} else {
|
||||
|
@ -50,29 +50,29 @@
|
||||
$documentationlink = '<a href="http://docs.moodle.org/en/Installation">Installation docs</a>';
|
||||
|
||||
if (ini_get_bool('session.auto_start')) {
|
||||
print_error("The PHP server variable 'session.auto_start' should be Off - $documentationlink");
|
||||
print_error('phpvaroff', 'debug', '', array('session.auto_start', $documentationlink));
|
||||
}
|
||||
|
||||
if (ini_get_bool('magic_quotes_runtime')) {
|
||||
print_error("The PHP server variable 'magic_quotes_runtime' should be Off - $documentationlink");
|
||||
print_error('phpvaroff', 'debug', '', array('magic_quotes_runtime', $documentationlink));
|
||||
}
|
||||
|
||||
if (!ini_get_bool('file_uploads')) {
|
||||
print_error("The PHP server variable 'file_uploads' is not turned On - $documentationlink");
|
||||
print_error('phpvaron', 'debug', '', array('file_uploads', $documentationlink));
|
||||
}
|
||||
|
||||
if (empty($CFG->prefix) && $CFG->dbfamily != 'mysql') { //Enforce prefixes for everybody but mysql
|
||||
print_error('$CFG->prefix can\'t be empty for your target DB (' . $CFG->dbtype . ')');
|
||||
print_error('prefixcannotbeempty', 'debug', '', array($CFG->prefix, $CFG->dbtype));
|
||||
}
|
||||
|
||||
if ($CFG->dbfamily == 'oracle' && strlen($CFG->prefix) > 2) { //Max prefix length for Oracle is 2cc
|
||||
print_error('$CFG->prefix maximum allowed length for Oracle DBs is 2cc.');
|
||||
print_error('prefixlimit', 'debug', '', $CFG->prefix);
|
||||
}
|
||||
|
||||
/// Check that config.php has been edited
|
||||
|
||||
if ($CFG->wwwroot == "http://example.com/moodle") {
|
||||
print_error("Moodle has not been configured yet. You need to edit config.php first.");
|
||||
print_error('configmoodle', 'debug');
|
||||
}
|
||||
|
||||
|
||||
@ -80,12 +80,7 @@
|
||||
|
||||
$dirroot = dirname(realpath("../index.php"));
|
||||
if (!empty($dirroot) and $dirroot != $CFG->dirroot) {
|
||||
print_error("Please fix your settings in config.php:
|
||||
<p>You have:
|
||||
<p>\$CFG->dirroot = \"".addslashes($CFG->dirroot)."\";
|
||||
<p>but it should be:
|
||||
<p>\$CFG->dirroot = \"".addslashes($dirroot)."\";",
|
||||
"./");
|
||||
print_error('fixsetting', 'debug', '', array(addslashes($CFG->dirroot), addslashes($dirroot)));
|
||||
}
|
||||
|
||||
/// Set some necessary variables during set-up to avoid PHP warnings later on this page
|
||||
@ -104,7 +99,7 @@
|
||||
}
|
||||
|
||||
if (!$version or !$release) {
|
||||
print_error('Main version.php was not readable or specified'); // without version, stop
|
||||
print_error('withoutversion', 'debug'); // without version, stop
|
||||
}
|
||||
|
||||
/// Check if the main tables have been installed yet or not.
|
||||
@ -186,7 +181,7 @@
|
||||
} else if (file_exists("$CFG->libdir/db/$CFG->dbtype.sql")) {
|
||||
$status = modify_database("$CFG->libdir/db/$CFG->dbtype.sql"); //Old method
|
||||
} else {
|
||||
print_error("Error: Your database ($CFG->dbtype) is not yet fully supported by Moodle or install.xml is not present. See the lib/db directory.");
|
||||
print_error('dbnotsupport', 'debug', '', $CFG->dbtype);
|
||||
}
|
||||
|
||||
// all new installs are in unicode - keep for backwards compatibility and 1.8 upgrade checks
|
||||
@ -223,7 +218,7 @@
|
||||
notify($strdatabasesuccess, "green");
|
||||
require_once $CFG->dirroot.'/mnet/lib.php';
|
||||
} else {
|
||||
print_error("Error: Main databases NOT set up successfully");
|
||||
print_error('dbnotsetup', 'debug');
|
||||
}
|
||||
print_continue('index.php');
|
||||
print_footer('none');
|
||||
@ -367,7 +362,7 @@
|
||||
moodle_install_roles();
|
||||
set_config('rolesactive', 1);
|
||||
} else if (!update_capabilities()) {
|
||||
print_error('Had trouble upgrading the core capabilities for the Roles System');
|
||||
print_error('cannotupgradecapabilities', 'debug');
|
||||
}
|
||||
// update core events
|
||||
events_update_definition();
|
||||
@ -383,7 +378,7 @@
|
||||
print_footer('none');
|
||||
exit;
|
||||
} else {
|
||||
print_error('Upgrade failed! (Could not update version in config table)');
|
||||
print_error('cannotupdateversion', 'debug');
|
||||
}
|
||||
/// Main upgrade not success
|
||||
} else {
|
||||
@ -401,7 +396,7 @@
|
||||
}
|
||||
} else {
|
||||
if (!set_config("version", $version)) {
|
||||
print_error("A problem occurred inserting current version into databases");
|
||||
print_error('cannotupdateversion', 'debug');
|
||||
}
|
||||
}
|
||||
|
||||
@ -409,7 +404,7 @@
|
||||
|
||||
if ($release <> $CFG->release) { // Update the release version
|
||||
if (!set_config("release", $release)) {
|
||||
print_error("ERROR: Could not update release version in database!!");
|
||||
print_error("cannotupdaterelease", 'debug');
|
||||
}
|
||||
}
|
||||
|
||||
@ -495,7 +490,7 @@
|
||||
$newsite->timemodified = time();
|
||||
|
||||
if (!$newid = insert_record('course', $newsite)) {
|
||||
print_error("Serious Error! Could not set up the site!");
|
||||
print_error('cannotsetupsite', 'error');
|
||||
}
|
||||
// make sure course context exists
|
||||
get_context_instance(CONTEXT_COURSE, $newid);
|
||||
@ -508,7 +503,7 @@
|
||||
$cat->name = get_string('miscellaneous');
|
||||
$cat->depth = 1;
|
||||
if (!$catid = insert_record('course_categories', $cat)) {
|
||||
print_error("Serious Error! Could not set up a default course category!");
|
||||
print_error('cannotsetupcategory', 'error');
|
||||
}
|
||||
// make sure category context exists
|
||||
get_context_instance(CONTEXT_COURSECAT, $catid);
|
||||
|
@ -51,7 +51,7 @@
|
||||
if (langdoc_save_file($langdir, $currentfile, $_POST['filedata'])) {
|
||||
notify(get_string("changessaved")." ($langdir/$currentfile)", "green");
|
||||
} else {
|
||||
print_error("Could not save the file '$currentfile'!", '', "langdoc.php?currentfile=$currentfile&sesskey=$USER->sesskey");
|
||||
print_error("cannotsavefile", 'error', "langdoc.php?currentfile=$currentfile&sesskey=$USER->sesskey", $currentfile);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -63,7 +63,7 @@
|
||||
// Get all files from /docs directory
|
||||
|
||||
if (! $files = get_directory_list("$CFG->dirroot/lang/en_utf8/docs", "CVS")) {
|
||||
print_error("Could not find English language docs files!");
|
||||
print_error('cannotfinddocs', 'error', '', 'English');
|
||||
}
|
||||
|
||||
$options = array();
|
||||
@ -83,7 +83,7 @@
|
||||
// Get all files from /help directory
|
||||
|
||||
if (! $files = get_directory_list("$CFG->dirroot/lang/en_utf8/help", "CVS")) {
|
||||
print_error("Could not find English language help files!");
|
||||
print_error("cannotfindhelp", "error", "", "English");
|
||||
}
|
||||
|
||||
foreach ($files as $filekey => $file) { // check all the help files.
|
||||
|
19
lang/en_utf8/debug.php
Normal file
19
lang/en_utf8/debug.php
Normal file
@ -0,0 +1,19 @@
|
||||
<?php
|
||||
/*
|
||||
* debug information for developer only
|
||||
*/
|
||||
$string['cannotupgradecapabilities'] = 'Had trouble upgrading the core capabilities for the Roles System';
|
||||
$string['cannotupdateversion'] = 'Upgrade failed! (Could not update version in config table)';
|
||||
$string['cannotupdaterelease'] = 'ERROR: Could not update release version in database!!';
|
||||
$string['cannotsetupsite'] = 'Serious Error! Could not set up the site!';
|
||||
$string['configmoodle'] = 'Moodle has not been configured yet. You need to edit config.php first.';
|
||||
$string['dbnotsupport'] = 'Error: Your database ($a) is not yet fully supported by Moodle or install.xml is not present. See the lib/db directory.';
|
||||
$string['dbnotsetup'] = 'Error: Main databases NOT set up successfully';
|
||||
$string['fixsetting'] = 'Please fix your settings in config.php: <p>You have:</p> <p>\$CFG->dirroot = \"$a[0]\";</p> <p>but it should be:</p> <p>\$CFG->dirroot = \"$a[1]\"</p>';
|
||||
$string['phpvaroff'] = 'The PHP server variable \'$a[0]\' should be Off - $a[1]';
|
||||
$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';
|
||||
|
||||
?>
|
@ -22,6 +22,8 @@ $string['cannotfindhelp'] = 'Cannot find \"$a\" language help files';
|
||||
$string['cannotsavefile'] = 'Cannot save the file \"$a\".';
|
||||
$string['cannotsavemd5file'] = 'Cannot save md5 file.';
|
||||
$string['cannotsavezipfile'] = 'Cannot save ZIP file.';
|
||||
$string['cannotsetupcategory'] = 'Serious Error! Could not set up a default course category!';
|
||||
$string['cannotsetupsite'] = 'Serious Error! Could not set up the site!';
|
||||
$string['cannotunzipfile'] = 'Cannot unzip file.';
|
||||
$string['cannotviewprofile'] = 'You can not view the profile of this user.';
|
||||
$string['cantunenrollfrommetacourse'] = 'You can not unenrol from this meta course.';
|
||||
@ -47,6 +49,8 @@ $string['errorreadingfile'] = 'Error reading file \"$a\"';
|
||||
$string['errorunzippingfiles'] = 'Error unzipping files';
|
||||
$string['fieldrequired'] = '\"$a\" is a required field';
|
||||
$string['filenotfound'] = 'Sorry, the requested file could not be found';
|
||||
$string['filternotinstalled'] = 'Filter $a is not currently installed';
|
||||
$string['filternotactive'] = 'Filter $a is not currently active';
|
||||
$string['forumblockingtoomanyposts'] = 'You have exceeded the posting threshold set for this forum.';
|
||||
$string['groupalready'] = 'User already belongs to group $a';
|
||||
$string['groupexistforcourse'] = 'Group \"$a\" already exists for this course';
|
||||
@ -127,6 +131,7 @@ $string['usernotrenamedoff'] = 'User not renamed - renaming not allowed.';
|
||||
$string['usernotupdatedadmin'] = 'Can not update admin accounts.';
|
||||
$string['usernotupdatederror'] = 'User not updated - error.';
|
||||
$string['usernotupdatednotexists'] = 'User not updated - does not exist.';
|
||||
$string['wrongcall'] = 'This script is called wrongly';
|
||||
$string['wrongdestpath'] = 'Wrong destination path.';
|
||||
$string['wrongsourcebase'] = 'Wrong source URL base.';
|
||||
$string['wrongzipfilename'] = 'Wrong ZIP filename.';
|
||||
|
Loading…
x
Reference in New Issue
Block a user