if ($result) {
if ($CFG->version >= $version) {
// something really wrong is going on in main upgrade script
- print_error("Upgrade savepoint: Can not upgrade main version from $CFG->version to $version.");
+ print_error('cannotdowngrade', 'debug', '', array($CFG->version, $version));
}
set_config('version', $version);
} else {
/// Install capabilities
if (!update_capabilities($type.'/'.$plug)) {
- print_error('Could not set up the capabilities for '.$plugin->name.'!');
+ print_error('cannotsetupcapforplugin', '', '', $plugin->name);
}
/// Install events
events_update_definition($type.'/'.$plug);
// OK so far, now update the plugins record
set_config($pluginversion, $plugin->version);
if (!update_capabilities($type.'/'.$plug)) {
- print_error('Could not update '.$plugin->name.' capabilities!');
+ print_error('cannotupdateplugincap', '', '', $plugin->name);
}
events_update_definition($type.'/'.$plug);
notify(get_string('modulesuccess', '', $plugin->name), 'notifysuccess');
}
} else {
upgrade_log_start();
- print_error('Version mismatch: '. $plugin->name .' can\'t downgrade '. $CFG->$pluginversion .' -> '. $plugin->version .' !');
+ print_error('cannotdowngrade', 'debug', '', array($CFG->pluginversion, $plugin->version));
}
}
global $CFG, $interactive, $DB;
if (!$mods = get_list_of_plugins('mod') ) {
- print_error('No modules installed!');
+ print_error('nomodules', 'debug');
}
$updated_modules = false;
// OK so far, now update the modules record
$module->id = $currmodule->id;
if (!$DB->update_record('modules', $module)) {
- print_error('Could not update '. $module->name .' record in modules table!');
+ print_error('cannotupdatemod', '', '', $module->name);
}
remove_dir($CFG->dataroot . '/cache', true); // flush cache
notify(get_string('modulesuccess', '', $module->name), 'notifysuccess');
/// Update the capabilities table?
if (!update_capabilities('mod/'.$module->name)) {
- print_error('Could not update '.$module->name.' capabilities!');
+ print_error('cannotupdatemodcap', '', '', $module->name);
}
events_update_definition('mod/'.$module->name);
} else {
upgrade_log_start();
- print_error('Version mismatch: '. $module->name .' can\'t downgrade '. $currmodule->version .' -> '. $module->version .' !');
+ print_error('cannotdowngrade', 'debug', '', array($currmodule->version, $module->version));
}
} else { // module not installed yet, so install it
/// Capabilities
if (!update_capabilities('mod/'.$module->name)) {
- print_error('Could not set up the capabilities for '.$module->name.'!');
+ print_error('cannotsetupcapformod', '', '', $module->name);
}
/// Events
$user = $user_input;
}
if (!$user->id = $DB->insert_record('user', $user)) {
- print_error('SERIOUS ERROR: Could not create admin user record !!!');
+ print_error('cannotcreateadminuser', 'debug');
}
if (!$user = $DB->get_record('user', array('id'=>$user->id))) { // Double check.
- print_error('User ID was incorrect (can\'t find it)');
+ print_error('invaliduserid');
}
// Assign the default admin roles to the new user.
if (!$adminroles = get_roles_with_capability('moodle/legacy:admin', CAP_ALLOW)) {
- print_error('No admin role could be found');
+ print_error('noadminrole', 'debug');
}
$sitecontext = get_context_instance(CONTEXT_SYSTEM);
foreach ($adminroles as $adminrole) {
redirect("$CFG->wwwroot/user/editadvanced.php?id=$user->id"); // Edit thyself
}
} else {
- print_error('Can not create admin!');
+ print_error('cannotcreateadminuser', 'debug');
}
}
* @return bool Authentication success or failure.
*/
function user_login($username, $password) {
- print_error('Abstract user_login() method must be overriden.');
+ print_error('mustbeoveride', 'debug', '', 'user_login()' );
}
/**
*/
function user_signup($user, $notify=true) {
//override when can signup
- print_error('user_signup method must be overriden if signup enabled');
+ print_error('mustbeoveride', 'debug', '', 'user_signup()' );
}
/**
*/
function user_confirm($username, $confirmsecret) {
//override when can confirm
- print_error('user_confirm method must be overriden if confirm enabled');
+ print_error('mustbeoveride', 'debug', '', 'user_confirm()' );
}
/**
if (!empty($CFG->rolesactive)) {
if (in_array($table, array('user_students', 'user_teachers', 'user_coursecreators', 'user_admins'))) {
if (debugging()) { var_dump(debug_backtrace()); }
- print_error('This SQL relies on obsolete tables ('.$table.')! Your code must be fixed by a developer.');
+ print_error('sqlrelyonobsoletetable', 'debug', '', $table);
}
}
if (!empty($CFG->rolesactive)) {
if (in_array($table, array('user_students', 'user_teachers', 'user_coursecreators', 'user_admins'))) {
if (debugging()) { var_dump(debug_backtrace()); }
- print_error('This SQL relies on obsolete tables ('.$table.')! Your code must be fixed by a developer.');
+ print_error('sqlrelyonobsoletetable', 'debug', '', $table);
}
}
strpos($sql, ' '.$CFG->prefix.'user_coursecreators ') ||
strpos($sql, ' '.$CFG->prefix.'user_admins ')) {
if (debugging()) { var_dump(debug_backtrace()); }
- print_error('This SQL relies on obsolete tables! Your code must be fixed by a developer.');
+ print_error('sqlrelyonobsoletetable', 'debug', '',
+ 'user_student, user_teachers, user_coursecreators, user_admins');
}
}
return $status;
}
-?>
\ No newline at end of file
+?>
if (! $course = get_record("course", "id", $id) ) {
- print_error("That's an invalid course id");
+ print_error('invalidcourseid');
}
require_login($course);
}
if (! $basedir = make_upload_directory("$course->id")) {
- print_error("The site administrator needs to fix the file permissions");
+ print_error('cannotcreateuploaddir');
}
$baseweb = $CFG->wwwroot;
}
if (!zip_files($files,"$basedir/$wdir/$name")) {
- print_error("zipfileserror","error");
+ print_error('zipfileserror');
}
clearfilelist();
function insert($source=null) {
if (empty($this->courseid)) {
- print_error('Can not insert grade category without course id!');
+ print_error('cannotinsertgrade');
}
if (empty($this->parent)) {
}
if ($parentid == $this->id) {
- print_error('Can not assign self as parent!');
+ print_error('cannotassignselfasparent');
}
if (empty($this->parent) and $this->is_course_category()) {
- print_error('Course category can not have parent!');
+ print_error('cannothaveparentcate');
}
// find parent and check course id
global $CFG;
if (count($grade_grades) !== count($grade_items)) {
- print_error('Incorrect size of arrays in params of grade_grade::get_hiding_affected()!');
+ print_error('invalidarraysize', 'debug', '', 'grade_grade::get_hiding_affected()!');
}
$dependson = array();
global $CFG;
if (empty($this->courseid)) {
- print_error('Can not insert grade item without course id!');
+ print_error('cannotinsertgrade');
}
// load scale if needed
*/
function set_parent($parentid) {
if ($this->is_course_item() or $this->is_category_item()) {
- print_error('Can not set parent for category or course item!');
+ print_error('cannotsetparentforcatoritem');
}
if ($this->categoryid == $parentid) {
* @return object grade_object instance or false if none found.
*/
function fetch($params) {
- print_error('Abstract method fetch() not overridden in '.get_class($this));
+ print_error('mustbeoveride', 'debug', '', 'fetch()');
}
/**
* @return array array of grade_object insatnces or false if none found.
*/
function fetch_all($params) {
- print_error('Abstract method fetch_all() not overridden in '.get_class($this));
+ print_error('mustbeoveride', 'debug', '', 'fetch_all()');
}
/**
if ($instances = grade_object::fetch_all_helper($table, $classname, $params)) {
if (count($instances) > 1) {
// we should not tolerate any errors here - problems might appear later
- print_error('Found more than one record in fetch() !');
+ print_error('morethanonerecordinfetch');
}
return reset($instances);
} else {
if ($userid) {
// one raw grade updated for one user
if (empty($updated_item)) {
- print_error("updated_item_id can not be null!");
+ print_error("cannotbenull", 'debug', '', "updated_item");
}
if ($course_item->needsupdate) {
$updated_item->force_regrading();
global $CFG;
if (!$mods = get_list_of_plugins('mod') ) {
- print_error('No modules installed!');
+ print_error('nomodules', 'debug');
}
foreach ($mods as $mod) {
}
if (!$mods = get_list_of_plugins('mod') ) {
- print_error('No modules installed!');
+ print_error('nomodules', 'debug');
}
foreach ($mods as $mod) {
}
}
} else {
- print_error('Upgrade of local database customisations failed! (Could not update version in config table)');
+ print_error('cannotupgradedbcustom', 'debug');
}
} else {
if (!defined('CLI_UPGRADE') || !CLI_UPGRADE ) {
$DB->set_debug(false);
}
- print_error('Upgrade failed! See local/version.php');
+ print_error('upgradefail', 'debug', '', 'local/version.php');
}
} else if ($local_version < $CFG->local_version) {
} else if (isset($_GET[$parname])) {
$param = $_GET[$parname];
} else {
- print_error('A required parameter ('.$parname.') was missing');
+ print_error('missingparam', '', '', $parname);
}
return clean_param($param, $type);
}
default: // throw error, switched parameters in optional_param or another serious problem
- print_error("Unknown parameter type: $type");
+ print_error("unknowparamtype", '', '', $type);
}
}
$COURSE = clone($course);
} else {
if (!$COURSE = get_record('course', 'id', $courseorid)) {
- print_error('Invalid course ID');
+ print_error('invalidcourseid');
}
}
}
global $nomoodlecookie, $USER, $SESSION, $CFG;
if (empty($nomoodlecookie)) {
- print_error('Incorrect use of require_key_login() - session cookies must be disabled!');
+ print_error('sessioncookiesdisable');
}
/// extra safety
$keyvalue = required_param('key', PARAM_ALPHANUM);
if (!$key = get_record('user_private_key', 'script', $script, 'value', $keyvalue, 'instance', $instance)) {
- print_error('Incorrect key');
+ print_error('invalidkey');
}
if (!empty($key->validuntil) and $key->validuntil < time()) {
- print_error('Expired key');
+ print_error('expiredkey');
}
if ($key->iprestriction) {
$remoteaddr = getremoteaddr();
if ($remoteaddr == '' or !address_in_subnet($remoteaddr, $key->iprestriction)) {
- print_error('Client IP address mismatch');
+ print_error('ipmismatch');
}
}
if (!$user = get_record('user', 'id', $key->userid)) {
- print_error('Incorrect user record');
+ print_error('invaliduserid');
}
/// emulate normal session
}
if (!insert_record('user_private_key', $key)) {
- print_error('Can not insert new key');
+ print_error('cannotinsertkey');
}
return $key->value;
// check the plugin exists first
if (! exists_auth_plugin($auth)) {
- print_error("Authentication plugin '$auth' not found.");
+ print_error('authpluginnotfound', 'debug', '', $auth);
}
// return auth plugin instance
$result = true;
if (! $course = get_record('course', 'id', $courseid)) {
- print_error('Course ID was incorrect (can\'t find it)');
+ print_error('invalidcourseid');
}
$strdeleted = get_string('deleted');
}
}
} else {
- print_error('No modules are installed!');
+ print_error('nomodules', 'debug');
}
/// Give local code a chance to delete its references to this course.
$newpassword = generate_password();
if (!$userauth->user_update_password(addslashes_recursive($user), addslashes($newpassword))) {
- print_error("Could not set user password!");
+ print_error("cannotsetpassword");
}
$a = new object();
if(is_file($file)) {
require($file);
if(!isset($DEFINEDPAGES)) {
- print_error('Imported '.$file.' but found no page classes');
+ print_error('nopageclass', 'debug', '', $page);
}
return $types[$path] = $DEFINEDPAGES;
}
// Do NOT load up "expensive" resouces (e.g. SQL data) here!
function init_quick($data) {
if(empty($data->pageid) && !defined('ADMIN_STICKYBLOCKS')) {
- print_error('Cannot quickly initialize page: empty course id');
+ print_error('cannotinitpage', '', '', null);
}
parent::init_quick($data);
}
}
if(empty($this->courserecord) && !defined('ADMIN_STICKYBLOCKS')) {
- print_error('Cannot fully initialize page: invalid course id '. $this->id);
+ print_error('cannotinitpage', '', '', $this->id);
}
$this->context = get_context_instance(CONTEXT_COURSE, $this->id);
return;
}
if(empty($this->activityname)) {
- print_error('Page object derived from page_generic_activity but did not define $this->activityname');
+ print_error('noactivityname', 'debug');
}
if (!$this->modulerecord = get_coursemodule_from_instance($this->activityname, $this->id)) {
- print_error('Cannot fully initialize page: invalid '.$this->activityname.' instance id '. $this->id);
+ print_error('cannotinitpager', 'debug', '', array($this->activityname, $this->id));
}
$this->courserecord = get_record('course', 'id', $this->modulerecord->course);
if(empty($this->courserecord)) {
- print_error('Cannot fully initialize page: invalid course id '. $this->modulerecord->course);
+ print_error('invalidcourseid');
}
$this->activityrecord = get_record($this->activityname, 'id', $this->id);
if(empty($this->activityrecord)) {
- print_error('Cannot fully initialize page: invalid '.$this->activityname.' id '. $this->id);
+ print_error('cannotinitpager', 'debug', '', array($this->activityname, $this->id));
}
$this->full_init_done = true;
}
return true;
}
- print_error('Incorrect eventadata submitted: '.$eventdata);
+ print_error('invalideventdata', '', '', $eventdata);
}
// test handler class with static method
return true;
}
- print_error('Incorrect eventadata submitted: '.$eventdata);
+ print_error('invalideventdata', '', '', $eventdata);
}
}
}
-?>
\ No newline at end of file
+?>