Skip to content
Snippets Groups Projects
Commit 7b3c3510 authored by Jakob Sack's avatar Jakob Sack
Browse files

Error handling works better now

parent f46fdfd8
Branches
No related tags found
No related merge requests found
......@@ -20,19 +20,21 @@
*
*/
function handleCliShutdown() {
$error = error_get_last();
if($error !== NULL){
echo 'Unexpected error!'.PHP_EOL;
}
// Unfortunately we need this class for shutdown function
class my_temporary_cron_class {
public static $sent = false;
}
function handleWebShutdown(){
$error = error_get_last();
if($error !== NULL){
function handleUnexpectedShutdown() {
if( !my_temporary_cron_class::$sent ){
if( OC::$CLI ){
echo 'Unexpected error!'.PHP_EOL;
}
else{
OC_JSON::error( array( 'data' => array( 'message' => 'Unexpected error!')));
}
}
}
$RUNTIME_NOSETUPFS = true;
require_once('lib/base.php');
......@@ -59,9 +61,11 @@ else{
register_shutdown_function('handleWebShutdown');
if( $appmode == 'cron' ){
OC_JSON::error( array( 'data' => array( 'message' => 'Backgroundjobs are using system cron!')));
exit();
}
else{
OC_BackgroundJob_Worker::doNextStep();
OC_JSON::success();
}
}
my_temporary_cron_class::$sent = true;
exit();
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment