getSystemUser(); $GLOBALS['log']->debug('--------------------------------------------> at cron.php <--------------------------------------------'); $cron_driver = !empty($sugar_config['cron_class'])?$sugar_config['cron_class']:'SugarCronJobs'; $GLOBALS['log']->debug("Using $cron_driver as CRON driver"); if(file_exists("custom/include/SugarQueue/$cron_driver.php")) { require_once "custom/include/SugarQueue/$cron_driver.php"; } else { require_once "include/SugarQueue/$cron_driver.php"; } $jobq = new $cron_driver(); $jobq->runCycle(); $exit_on_cleanup = true; sugar_cleanup(false); // some jobs have annoying habit of calling sugar_cleanup(), and it can be called only once // but job results can be written to DB after job is finished, so we have to disconnect here again // just in case we couldn't call cleanup if(class_exists('DBManagerFactory')) { $db = DBManagerFactory::getInstance(); $db->disconnect(); } if($exit_on_cleanup) exit($jobq->runOk()?0:1);