MDL-14129, remove error() call

This commit is contained in:
dongsheng 2008-07-21 07:18:58 +00:00
parent 764a1dfad1
commit 06e84d52bd
6 changed files with 40 additions and 32 deletions

View File

@ -11,6 +11,7 @@ $string['blockcannotconfig'] = 'This block does not support global configuration
$string['blocknameconflict'] = 'Naming conflict: block $a[0] has the same title with an existing block: $a[1]!';
$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['boundsyntaxnotsupport'] = 'Pg $1, $2 bound syntax not supported yet :-(';
$string['cannotassignanthing'] = 'Cannot assign moodle/site:doanything';
$string['cannotassignrole'] = 'Cannot assign role in course';
$string['cannotassignselfasparent'] = 'Cannot assign self as parent!';
@ -22,7 +23,7 @@ $string['cannotaddrss'] = 'You do not have permission to add rss feeds';
$string['cannotaddmodule'] = '$a module could not be added to the module list!';
$string['cannotaddnewmodule'] = 'Could not add a new module of $a';
$string['cannotaddnewinstance'] = 'Could not add a new instance of $a';
$string['cannotsaveconfig'] = 'Problem saving config \"$a[0]\" as \"$a[1]\" for plugin \"$a[2]\"';
$string['cannotsaveconfig'] = 'Problem saving config \"$a[0]\" as \"$a[1]\" for plugin \"$a[2]\"';
$string['cannotsavecomment'] = 'Cannot save comment';
$string['cannotsavefile'] = 'Cannot save the file\"$a[0]\/$a[1]\"!';
$string['cannotsavedata'] = 'Cannot save data';
@ -191,6 +192,7 @@ $string['ddlxmlfileerror'] = 'XML database file errors found';
$string['destinationcmnotexit'] = 'The destination course module does not exist';
$string['downloadedfilecheckfailed'] = 'Downloaded file check failed';
$string['duplicateusername'] = 'Duplicate username - skipping record';
$string['duplicateparaminsql'] = 'ERROR: duplicate parameter name in query';
$string['duplicaterolename'] = 'There is already a role with this name!';
$string['duplicateroleshortname'] = 'There is already a role with this short name!';
$string['emailfail'] = 'Emailing failed';
@ -259,11 +261,14 @@ $string['invalidmodule'] = 'Invalid module';
$string['invalidmoduleid'] = 'Invalid module ID: $a';
$string['invalidmodulename'] = 'Invalid module name: $a';
$string['invalidnum'] = 'Invalid numeric value';
$string['invalidnumkey'] = '$conditions array may not contain numeric keys, please fix the code!';
$string['invalidoutcome'] = 'Incorrect outcome id';
$string['invalidpagesize'] = 'Invalid page size';
$string['invalidpaymentmethod'] = 'Invalid payment method: $a';
$stirng['invalidqueryparam'] = 'ERROR: Incorrect number of query parameters!!';
$string['invalidrequest'] = 'Invalid request';
$string['invalidrole'] = 'Invalid role';
$string['invalidroleid'] = 'Invalid role ID';
$string['invalidscaleid'] = 'Incorrect scale id';
$string['invalidseeky'] = 'Incorrect sesskey submitted, form not accepted!';
$string['invalidsesskey'] = 'Incorrect sesskey submitted, form not accepted!';
@ -290,6 +295,7 @@ $string['loginasnoenrol'] = 'You cannot use enrol or unenrol when in course \"Lo
$string['logfilenotavailable'] = 'Logs not available';
$string['messagingdisable'] = 'Messaging is disabled on this site';
$string['missingfield'] = 'Field \"$a\" is missing';
$string['missingkeyinsql'] = 'ERROR: missing param \"$a\" in query'
$string['missingvarname'] = 'Required variable name is missing!';
$string['missinguseranditemid'] = 'Missing userid and itemid';
$string['missingparam'] = 'A required parameter ($a) was missing';
@ -297,6 +303,7 @@ $string['missingparameter'] = 'Parameter missing';
$string['missingrequiredfield'] = 'Some required field is missing';
$string['mimetexisnotexist'] = 'Your system is not configured to run mimeTeX. You need to download the appropriate executable for you PHP_OS platform from <a href=\"http://moodle.org/download/mimetex/\">http://moodle.org/download/mimetex/</a>, or obtain the C source from <a href=\"http://www.forkosh.com/mimetex.zip\"> http://www.forkosh.com/mimetex.zip</a>, compile it and put the executable into your moodle/filter/tex/ directory.';
$string['mimetexnotexecutable'] = 'Custom mimetex is not executable!';
$string['mixedtypesqlparam'] = 'ERROR: Mixed types of sql query parameters!!';
$string['mnetdisable'] = 'MNET is disabled';
$string['mnetlocal'] = 'Remote MNET users cannot login locally';
$string['moduledoesnotexist'] = 'This module does not exist';
@ -321,6 +328,7 @@ $string['notlocalisederrormessage'] = '$a';
$string['nousers'] = 'No such user!';
$string['nonmeaningfulcontent'] = 'Non meaningful content';
$string['noparticipatorycms'] = 'Sorry, but you have no participatory course modules to report on';
$string['noparticipants'] = 'No participants found for this course';
$string['nopermissions'] = 'Sorry, but you do not currently have permissions to do that ($a)';
$string['nopermissiontocomment'] = 'You can\'t add comments to this glossary!';
$string['nopermissiontodelentry'] = 'You can\'t delete other people\'s entries!';
@ -378,6 +386,7 @@ $string['tagnotfound'] = 'The specified tag was not found in the database';
$string['tagdisabled'] = 'Tags are disabled!';
$string['themenotinstall'] = 'This theme is not installed!';
$string['transactionvoid'] = 'Transaction cannot be voided because it has already been voided';
$string['typenotimplement'] = 'TODO: type not implemented';
$string['unicodeupgradeerror'] = 'Sorry, but your database is not already in Unicode, and this version of Moodle is not able to migrate your database to Unicode. Please upgrade to Moodle 1.7.x first and perform the Unicode migration from the Admin page. After that is done you should be able to migrate to Moodle $a';
$string['unspecifycourseid'] = 'Must specify course id, short name or idnumber';
$string['statsdisable'] = 'Stats is not enabled';
@ -431,4 +440,4 @@ $string['wrongsourcebase'] = 'Wrong source URL base';
$string['wrongzipfilename'] = 'Wrong ZIP file name';
$string['xmldberror'] = 'XMLDB error!';
?>
?>

View File

@ -278,7 +278,7 @@ abstract class moodle_database {
}
} else {
error('todo: type not implemented');
print_error('typenotimplement');
}
return array($sql, $params);
}
@ -318,7 +318,7 @@ abstract class moodle_database {
}
if ($dollar_count) {
if ($count) {
error('ERROR: Mixed types of sql query parameters!!');
print_error('mixedtypesqlparam');
}
$type = SQL_PARAMS_DOLLAR;
$count = $dollar_count;
@ -326,7 +326,7 @@ abstract class moodle_database {
}
if ($q_count) {
if ($count) {
error('ERROR: Mixed types of sql query parameters!!');
print_error('mixedtypesqlparam');
}
$type = SQL_PARAMS_QM;
$count = $q_count;
@ -345,7 +345,7 @@ abstract class moodle_database {
}
if ($count > count($params)) {
error('ERROR: Incorrect number of query parameters!!');
print_error('invalidqueryparam');
}
if ($type & $allowed_types) { // bitwise AND
@ -368,12 +368,12 @@ abstract class moodle_database {
foreach ($named_matches[0] as $key) {
$key = trim($key, ':');
if (!array_key_exists($key, $params)) {
error('ERROR: missing param "'.$key.'" in query');
print_error('missingkeyinsql', '', '', $key);
}
$finalparams[$key] = $params[$key];
}
if ($count != count($finalparams)) {
error('ERROR: duplicate parameter name in query');
print_error('duplicateparaminsql');
}
if ($target_type & SQL_PARAMS_QM) {
@ -382,11 +382,11 @@ abstract class moodle_database {
} else if ($target_type & SQL_PARAMS_NAMED) {
return array($sql, $finalparams, SQL_PARAMS_NAMED);
} else { // $type & SQL_PARAMS_DOLLAR
error('Pg $1, $2 bound syntax not supported yet :-(');
print_error('boundsyntaxnotsupport');
}
} else if ($type == SQL_PARAMS_DOLLAR) {
error('Pg $1, $2 bound syntax not supported yet :-(');
print_error('boundsyntaxnotsupport');
} else { // $type == SQL_PARAMS_QM
if (count($params) != $count) {
@ -408,7 +408,7 @@ abstract class moodle_database {
}
return array($sql, $finalparams, SQL_PARAMS_NAMED);
} else { // $type & SQL_PARAMS_DOLLAR
error('Pg $1, $2 bound syntax not supported yet :-(');
print_error('boundsyntaxnotsupport');
}
}
}
@ -1334,7 +1334,7 @@ abstract class moodle_database {
$params = array();
foreach ($conditions as $key=>$value) {
if (is_int($key)) {
error('$conditions array may not contain numeric keys, please fix the code!');
print_error('invalidnumkey');
}
if (is_null($value)) {
$where[] = "$key IS NULL";

View File

@ -332,7 +332,7 @@ function groups_get_activity_groupmode($cm, $course=null) {
$course = $COURSE;
} else {
if (!$course = $DB->get_record('course', array('id'=>$cm->course))) {
error('Incorrect course id in cm');
print_error('invalidcourseid');
}
}

View File

@ -178,7 +178,7 @@ function upgrade_local_db($continueto) {
/// Capabilities
if (!update_capabilities('local')) {
error('Could not set up the capabilities for local!');
print_error('cannotsetupcapformod', 'error', '', 'local');
}
upgrade_log_finish();

View File

@ -8,7 +8,7 @@ $key = required_param('key', PARAM_ALPHANUM);
$id = required_param('id', PARAM_INT);
if (!$user = $DB->get_record('user', array('id' => $id))) {
error("Unknown user ID");
print_error('invaliduserid');
}
$preferences = get_user_preferences(null, null, $user->id);
@ -37,8 +37,7 @@ if (empty($preferences['newemailattemptsleft'])) {
} else {
// update user email
if (!$DB->set_field('user', 'email', $user->email, array('id' => $user->id))) {
error('Error updating user record');
print_error('cannotupdateuser');
} else {
events_trigger('user_updated', $user);
$a->email = $user->email;

View File

@ -25,17 +25,17 @@
if ($contextid) {
if (! $context = get_context_instance_by_id($contextid)) {
error("Context ID is incorrect");
print_error('invalidcontext');
}
if (! $course = $DB->get_record('course', array('id'=>$context->instanceid))) {
error("Course ID is incorrect");
print_error('invalidcourseid');
}
} else {
if (! $course = $DB->get_record('course', array('id'=>$courseid))) {
error("Course ID is incorrect");
print_error('invalidcourseid');
}
if (! $context = get_context_instance(CONTEXT_COURSE, $course->id)) {
error("Context ID is incorrect");
print_error('invalidcontext');
}
}
// not needed anymore
@ -102,7 +102,7 @@
if (has_capability('moodle/role:assign', $context)) {
redirect($CFG->wwwroot.'/'.$CFG->admin.'/roles/assign.php?contextid='.$context->id);
} else {
error ('No participants found for this course');
print_error('noparticipants');
}
}
@ -278,7 +278,7 @@
// (at or below DEFAULT_PAGE_SIZE) and $USER can enrol/unenrol
// (will take 1 extra DB query - 2 on Oracle)
//
if ($course->id != SITEID && $perpage <= DEFAULT_PAGE_SIZE
if ($course->id != SITEID && $perpage <= DEFAULT_PAGE_SIZE
&& has_capability('moodle/role:assign',$context)) {
$allowenroldetails=true;
} else {
@ -580,7 +580,7 @@
if ($roleid > 0) {
if (!$currentrole = $DB->get_record('role', array('id'=>$roleid))) {
error('That role does not exist');
print_error('invalidroleid');
}
$a->number = $totalcount;
// MDL-12217, use course specific rolename
@ -829,7 +829,7 @@
$rastring .= ' ('. $ra['enrolplugin'] .')<br />';
}
}
$data[] = $rastring;
$data[] = $rastring;
if ($groupmode != 0) {
// htmlescape with s() and implode the array
$data[] = implode(', ', array_map('s',$userlist_extra[$user->id]['group']));
@ -960,10 +960,10 @@ function get_participants_extra ($userids, $avoidroles, $course, $context) {
// Note: this returns strange redundant rows, perhaps
// due to the multiple OUTER JOINs. If we can tweak the
// JOINs to avoid it ot
$sql = "SELECT DISTINCT ra.userid,
ctx.id AS ctxid, ctx.path AS ctxpath, ctx.depth AS ctxdepth,
$sql = "SELECT DISTINCT ra.userid,
ctx.id AS ctxid, ctx.path AS ctxpath, ctx.depth AS ctxdepth,
ctx.contextlevel AS ctxlevel, ctx.instanceid AS ctxinstanceid,
cc.name AS ccname,
cc.name AS ccname,
ra.roleid AS roleid,
ra.enrol AS enrolplugin,
g.id AS gid, g.name AS gname
@ -982,8 +982,8 @@ function get_participants_extra ($userids, $avoidroles, $course, $context) {
/* and if groupings is enabled... */
$gpjoin
WHERE ra.userid IN ( $userids )
AND ra.contextid in ( $contextids )
WHERE ra.userid IN ( $userids )
AND ra.contextid in ( $contextids )
$avoidrolescond
ORDER BY ra.userid, ctx.depth DESC";
@ -995,10 +995,10 @@ function get_participants_extra ($userids, $avoidroles, $course, $context) {
// $extra [ $userid ] [ 'group' ] [ $groupid => 'group name']
// [ 'gping' ] [ $gpingid => 'gping name']
// [ 'ra' ] [ [ "$ctxid:$roleid" => [ctxid => $ctxid
// ctxdepth => $ctxdepth,
// ctxdepth => $ctxdepth,
// ctxpath => $ctxpath,
// ctxname => 'name' (categories only)
// ctxinstid =>
// ctxinstid =>
// roleid => $roleid
// enrol => $pluginname
//