Browse Source

! Don't try to load the theme from cron because of an error, because there's no way that can't end badly.

Signed-off-by: Peter Spicer <[email protected]>
Peter Spicer 11 years ago
parent
commit
bd2a2a6cbe
1 changed files with 11 additions and 1 deletions
  1. 11 1
      Sources/Errors.php

+ 11 - 1
Sources/Errors.php

@@ -276,7 +276,7 @@ function setup_fatal_error_context($error_message, $error_code)
 		return false;
 
 	// Maybe they came from dlattach or similar?
-	if (SMF != 'SSI' && empty($context['theme_loaded']))
+	if (SMF != 'SSI' && SMF != 'BACKGROUND' && empty($context['theme_loaded']))
 		loadTheme();
 
 	// Don't bother indexing errors mate...
@@ -313,6 +313,16 @@ function setup_fatal_error_context($error_message, $error_code)
 		if (empty($ssi_on_error_method) || $ssi_on_error_method !== true)
 			exit;
 	}
+	// Alternatively from the cron call?
+	elseif (SMF == 'BACKGROUND')
+	{
+		// We can't rely on even having language files available.
+		if (defined('FROM_CLI') && FROM_CLI)
+			echo 'cron error: ', $context['error_message'];
+		else
+			echo 'An error occurred. More information may be available in your logs.';
+		exit;
+	}
 
 	// We want whatever for the header, and a footer. (footer includes sub template!)
 	obExit(null, true, false, true);