summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJakob Sack <mail@jakobsack.de>2012-08-09 22:22:43 +0200
committerJakob Sack <mail@jakobsack.de>2012-08-09 22:22:43 +0200
commit66511469e04fdf17dfc45711ad98518fab94a712 (patch)
treea3e955e16d20f720efe866c060efb1dcb8e1945f
parenta6a1f892f06e23a405d14d5e0b3eb843c0154909 (diff)
downloadnextcloud-server-66511469e04fdf17dfc45711ad98518fab94a712.tar.gz
nextcloud-server-66511469e04fdf17dfc45711ad98518fab94a712.zip
Backgroundjobs: Improve error handling in cron.php
-rw-r--r--cron.php16
1 files changed, 16 insertions, 0 deletions
diff --git a/cron.php b/cron.php
index 9d7e396d61e..646e37e4c1c 100644
--- a/cron.php
+++ b/cron.php
@@ -20,11 +20,26 @@
*
*/
+function handleCliShutdown() {
+ $error = error_get_last();
+ if($error !== NULL){
+ echo 'Unexpected error!'.PHP_EOL;
+ }
+}
+
+function handleWebShutdown(){
+ $error = error_get_last();
+ if($error !== NULL){
+ OC_JSON::error( array( 'data' => array( 'message' => 'Unexpected error!')));
+ }
+}
+
$RUNTIME_NOSETUPFS = true;
require_once('lib/base.php');
$appmode = OC_Appconfig::getValue( 'core', 'backgroundjobs_mode', 'ajax' );
if( OC::$CLI ){
+ register_shutdown_function('handleCliShutdown');
if( $appmode != 'cron' ){
OC_Appconfig::setValue( 'core', 'backgroundjobs_mode', 'cron' );
}
@@ -41,6 +56,7 @@ if( OC::$CLI ){
OC_BackgroundJob_Worker::doAllSteps();
}
else{
+ register_shutdown_function('handleWebShutdown');
if( $appmode == 'cron' ){
OC_JSON::error( array( 'data' => array( 'message' => 'Backgroundjobs are using system cron!')));
exit();