$heading = format_string($heading); // Fix for MDL-8582
if (CLI_SCRIPT) {
- $output = $heading;
+ $output = $heading."\n";
if ($return) {
return $output;
} else {
- console_write($output . "\n",'',false);
+ echo $output;
return;
}
}
if (!CLI_SCRIPT) {
echo $output;
} else {
- console_write($output."\n", '', false);
+ echo $output."\n";
}
}
}
}
if (CLI_SCRIPT) {
- // Errors in cron should be mtrace'd.
- mtrace($message);
+ echo("!!! $message !!!\n");
+ if (debugging('', DEBUG_DEVELOPER)) {
+ if ($debuginfo) {
+ debugging($debuginfo, DEBUG_DEVELOPER, $backtrace);
+ } else {
+ notify('Stack trace:'.print_backtrace($backtrace, true), 'notifytiny');
+ }
+ }
die;
}
$message = clean_text($message); // In case nasties are in here
if (CLI_SCRIPT) {
- // notices in cron should be mtrace'd.
- mtrace($message);
+ echo("!!$message!!\n");
die;
}
$output = '<div class="'.$style.'" style="text-align:'. $align .'">'. $message .'</div>'."\n";
} else {
if ($style === 'notifysuccess') {
- $output = '++'.$message.'++';
+ $output = '++'.$message.'++'."\n";
} else {
- $output = '!!'.$message.'!!';
+ $output = '!!'.$message.'!!'."\n";
}
}
return $output;
}
- if (!CLI_SCRIPT) {
- echo $output;
- } else {
- console_write($output."\n", '', false);
- }
+ echo $output;
}
return ($inpopup);
}
-//=========================================================================//
-/**
- * Write to standard out and error with exit in error.
- *
- * @uses $_SERVER
- * @param string $identifier
- * @param string $module name of module $module
- * @param bool $use_string_lib
- */
-function console_write($identifier, $module='install', $use_string_lib=true) {
- if (!isset($_SERVER['REMOTE_ADDR'])) {
- // real CLI script
- if ($use_string_lib) {
- fwrite(STDOUT, get_string($identifier, $module));
- } else {
- fwrite(STDOUT, $identifier);
- }
- } else {
- // emulated cli script - something like cron
- if ($use_string_lib) {
- echo get_string($identifier, $module);
- } else {
- echo $identifier;
- }
- }
-}
-
-//=========================================================================//
-/**
- * Write to standard out and error with exit in error.
- *
- * @param string $identifier
- * @param string $module name of module $module
- * @param bool $use_string_lib
- * @return void Die! Die! Die!
- */
-function console_write_error($identifier, $module='install', $use_string_lib=true) {
- if (!isset($_SERVER['REMOTE_ADDR'])) {
- // real CLI script
- if ($use_string_lib) {
- fwrite(STDERR, get_string($identifier, $module));
- } else {
- fwrite(STDERR, $identifier);
- }
- fwrite(STDERR, "\n\n".get_string('aborting', $module)."\n\n");
- } else {
- // emulated cli script - something like cron
- if ($use_string_lib) {
- echo get_string($identifier, $module);
- } else {
- echo $identifier;
- }
- echo "\n\n".get_string('aborting', $module)."\n\n";
- }
-
- die; die; die;
-}
-
/**
* To use this class.
* - construct