Remove fatalErrorHandler from scheduled jobs
[civicrm-core.git] / CRM / Core / JobManager.php
index ed2954fc1d14335b1d6ce2f92654e34b003f73ea..d30646262e9f2f9dc99086c8d1c05187cee49a1d 100644 (file)
@@ -40,9 +40,6 @@ class CRM_Core_JobManager {
    * Class constructor.
    */
   public function __construct() {
-    $config = CRM_Core_Config::singleton();
-    $config->fatalErrorHandler = 'CRM_Core_JobManager_scheduledJobFatalErrorHandler';
-
     $this->jobs = $this->_getJobs();
   }
 
@@ -73,6 +70,7 @@ class CRM_Core_JobManager {
     $statusPref = [
       'name' => 'checkLastCron',
       'check_info' => gmdate('U'),
+      'prefs' => '',
     ];
     CRM_Core_BAO_StatusPreference::create($statusPref);
   }
@@ -181,7 +179,7 @@ class CRM_Core_JobManager {
    */
   private function _getJob($id = NULL, $entity = NULL, $action = NULL) {
     if (is_null($id) && is_null($action)) {
-      CRM_Core_Error::fatal('You need to provide either id or name to use this method');
+      throw new CRM_Core_Exception('You need to provide either id or name to use this method');
     }
     $dao = new CRM_Core_DAO_Job();
     $dao->id = $id;
@@ -275,12 +273,3 @@ class CRM_Core_JobManager {
   }
 
 }
-
-/**
- * @param $message
- *
- * @throws Exception
- */
-function CRM_Core_JobManager_scheduledJobFatalErrorHandler($message) {
-  throw new Exception("{$message['message']}: {$message['code']}");
-}