Error handling works better now
This commit is contained in:
parent
f46fdfd814
commit
7b3c35107d
28
cron.php
28
cron.php
|
@ -20,17 +20,19 @@
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function handleCliShutdown() {
|
// Unfortunately we need this class for shutdown function
|
||||||
$error = error_get_last();
|
class my_temporary_cron_class {
|
||||||
if($error !== NULL){
|
public static $sent = false;
|
||||||
echo 'Unexpected error!'.PHP_EOL;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function handleWebShutdown(){
|
function handleUnexpectedShutdown() {
|
||||||
$error = error_get_last();
|
if( !my_temporary_cron_class::$sent ){
|
||||||
if($error !== NULL){
|
if( OC::$CLI ){
|
||||||
OC_JSON::error( array( 'data' => array( 'message' => 'Unexpected error!')));
|
echo 'Unexpected error!'.PHP_EOL;
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
OC_JSON::error( array( 'data' => array( 'message' => 'Unexpected error!')));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -59,9 +61,11 @@ else{
|
||||||
register_shutdown_function('handleWebShutdown');
|
register_shutdown_function('handleWebShutdown');
|
||||||
if( $appmode == 'cron' ){
|
if( $appmode == 'cron' ){
|
||||||
OC_JSON::error( array( 'data' => array( 'message' => 'Backgroundjobs are using system cron!')));
|
OC_JSON::error( array( 'data' => array( 'message' => 'Backgroundjobs are using system cron!')));
|
||||||
exit();
|
|
||||||
}
|
}
|
||||||
OC_BackgroundJob_Worker::doNextStep();
|
else{
|
||||||
OC_JSON::success();
|
OC_BackgroundJob_Worker::doNextStep();
|
||||||
|
OC_JSON::success();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
my_temporary_cron_class::$sent = true;
|
||||||
exit();
|
exit();
|
||||||
|
|
Loading…
Reference in New Issue