public $a;
public $link;
public $debuginfo;
- public $extralocations;
/**
* Constructor
* @param string $link The url where the user will be prompted to continue. If no url is provided the user will be directed to the site index page.
* @param object $a Extra words and phrases that might be required in the error string
* @param string $debuginfo optional debugging information
- * @param array $extralocations An array of strings with other locations to look for string files
*/
- function __construct($errorcode, $module='error', $link='', $a=NULL, $debuginfo=null, $extralocations=null) {
- if (empty($module) || $module === 'moodle' || $module === 'core') {
+ function __construct($errorcode, $module='', $link='', $a=NULL, $debuginfo=null) {
+ if (empty($module) || $module == 'moodle' || $module == 'core') {
$module = 'error';
}
- $this->errorcode = $errorcode;
- $this->module = $module;
- $this->link = $link;
- $this->a = $a;
- $this->debuginfo = $debuginfo;
- $this->extralocations = $extralocations;
-
- $message = get_string($errorcode, $module, $a, $extralocations);
- if ($module === 'error' and strpos($message, '[[') === 0) {
- //search in moodle file if error specified - needed for backwards compatibility
- $message = get_string($errorcode, 'moodle', $a, $extralocations);
- }
+ $this->errorcode = $errorcode;
+ $this->module = $module;
+ $this->link = $link;
+ $this->a = $a;
+ $this->debuginfo = $debuginfo;
+
+ $message = get_string($errorcode, $module, $a);
parent::__construct($message, 0);
}
array_unshift($backtrace, $place);
if ($ex instanceof moodle_exception) {
- _print_normal_error($ex->errorcode, $ex->module, $ex->a, $ex->link, $backtrace, $ex->debuginfo, $ex->extralocations);
+ _print_normal_error($ex->errorcode, $ex->module, $ex->a, $ex->link, $backtrace, $ex->debuginfo);
} else {
_print_normal_error('generalexceptionmessage', 'error', $ex->getMessage(), '', $backtrace);
}
* @param string $module name of module
* @param string $link The url where the user will be prompted to continue. If no url is provided the user will be directed to the site index page.
* @param object $a Extra words and phrases that might be required in the error string
- * @param array $extralocations An array of strings with other locations to look for string files
* @return terminates script, does not return!
*/
-function print_error($errorcode, $module='error', $link='', $a=NULL, $extralocations=NULL) {
+function print_error($errorcode, $module='error', $link='', $a=NULL) {
global $CFG, $UNITTEST;
// If unittest running, throw exception instead
if (!isset($CFG->theme) or !isset($CFG->stylesheets)) {
// error found before setup.php finished
- _print_early_error($errorcode, $module, $a, $extralocations);
+ _print_early_error($errorcode, $module, $a);
} else {
- _print_normal_error($errorcode, $module, $a, $link, debug_backtrace(), null, $extralocations);
+ _print_normal_error($errorcode, $module, $a, $link, debug_backtrace());
}
}
/**
* Internal function - do not use directly!!
*/
-function _print_normal_error($errorcode, $module, $a, $link, $backtrace, $debuginfo=null, $extralocations=null, $showerrordebugwarning=false) {
+function _print_normal_error($errorcode, $module, $a, $link, $backtrace, $debuginfo=null, $showerrordebugwarning=false) {
global $CFG, $SESSION, $THEME, $DB;
if ($DB) {
$modulelink = $module;
}
- $message = get_string($errorcode, $module, $a, $extralocations);
+ $message = get_string($errorcode, $module, $a);
if ($module === 'error' and strpos($message, '[[') === 0) {
//search in moodle file if error specified - needed for backwards compatibility
- $message = get_string($errorcode, 'moodle', $a, $extralocations);
+ $message = get_string($errorcode, 'moodle', $a);
}
if (defined('FULLME') && FULLME == 'cron') {
* Internal function - do not use directly!!
* This function is used if fatal error occures before the themes are fully initialised (eg. in lib/setup.php)
*/
-function _print_early_error($errorcode, $module, $a, $extralocations=NULL) {
- $message = get_string($errorcode, $module, $a, $extralocations);
+function _print_early_error($errorcode, $module, $a) {
+ $message = get_string($errorcode, $module, $a);
if ($module === 'error' and strpos($message, '[[') === 0) {
//search in moodle file if error specified - needed for backwards compatibility
- $message = get_string($errorcode, 'moodle', $a, $extralocations);
+ $message = get_string($errorcode, 'moodle', $a);
}
$message = clean_text($message);