#705242 by moshe weitzman: Fixed _drupal_log_error() messy for CLI requests.

merge-requests/26/head
Angie Byron 2010-02-11 03:49:45 +00:00
parent 29adf425b5
commit 12fb65aad2
1 changed files with 7 additions and 0 deletions

View File

@ -1183,6 +1183,13 @@ function _drupal_log_error($error, $fatal = FALSE) {
drupal_add_http_header('500 Service unavailable (with message)');
}
if (drupal_is_cli()) {
if ($fatal) {
// When called from CLI, simply output a plain text message.
print html_entity_decode(strip_tags(t('%type: %message in %function (line %line of %file).', $error))). "\n";
exit;
}
}
if (isset($_SERVER['HTTP_X_REQUESTED_WITH']) && $_SERVER['HTTP_X_REQUESTED_WITH'] == 'XMLHttpRequest') {
if ($fatal) {
// When called from JavaScript, simply output the error message.