17 require_once SQ_INCLUDE_PATH.
'/asset.inc';
18 require_once SQ_CORE_PACKAGE_PATH.
'/system/cron/cron_job/cron_job.inc';
37 var $error_log_file_name =
'cron_errors';
48 $this->_ser_attrs = TRUE;
49 parent::__construct($assetid);
55 $GLOBALS[
'SQ_SYSTEM']->am->includeAsset(
'root_user');
56 $GLOBALS[
'SQ_SYSTEM']->am->includeAsset(
'system_user_group');
74 require_once SQ_CORE_PACKAGE_PATH.
'/system/system_asset_fns.inc';
75 if (!system_asset_fns_create_pre_check($this)) {
78 $GLOBALS[
'SQ_SYSTEM']->changeDatabaseConnection(
'db2');
79 $GLOBALS[
'SQ_SYSTEM']->doTransaction(
'BEGIN');
81 if ($linkid = parent::create($link)) {
82 if (!system_asset_fns_create_cleanup($this)) {
88 $GLOBALS[
'SQ_SYSTEM']->doTransaction(
'COMMIT');
90 $GLOBALS[
'SQ_SYSTEM']->doTransaction(
'ROLLBACK');
93 $GLOBALS[
'SQ_SYSTEM']->restoreDatabaseConnection();
110 return $GLOBALS[
'SQ_SYSTEM']->am->getTypeInfo($this->
type(),
'name');
125 SQ_LINK_TYPE_1 => Array(
'cron_job' => Array(
'card' =>
'M',
'exclusive' => TRUE)),
126 SQ_LINK_TYPE_2 => Array(
'cron_job' => Array(
'card' =>
'M',
'exclusive' => TRUE)),
127 SQ_LINK_TYPE_3 => Array(
'cron_job' => Array(
'card' =>
'M',
'exclusive' => TRUE)),
128 SQ_LINK_NOTICE => Array(),
142 $lock_types = parent::lockTypes();
143 $lock_types[
'attr_links'] = ($lock_types[
'attributes'] | $lock_types[
'links']);
172 public function morph($new_type_code)
174 trigger_localised_error(
'CRON0024', E_USER_WARNING, $GLOBALS[
'SQ_SYSTEM']->am->getTypeInfo($this->type(),
'name'));
193 trigger_localised_error(
'CRON0041', E_USER_WARNING, $GLOBALS[
'SQ_SYSTEM']->am->getTypeInfo($this->type(),
'name'));
211 $link = $GLOBALS[
'SQ_SYSTEM']->am->getLinkById($linkid, $this->
id);
213 trigger_localised_error(
'SYS0243', E_USER_NOTICE, $linkid);
217 if ($GLOBALS[
'SQ_SYSTEM']->am->isSystemAssetType($link[
'minor_type_code'])){
218 trigger_localised_error(
'CORE0118', E_USER_WARNING, $GLOBALS[
'SQ_SYSTEM']->am->getTypeInfo($this->type(),
'name'));
222 return parent::deleteLink($linkid, $check_locked);
238 if (!$GLOBALS[
'SQ_SYSTEM']->userRoot()) {
239 trigger_localised_error(
'CRON0025', E_USER_WARNING, $name, $GLOBALS[
'SQ_SYSTEM']->am->getTypeInfo($this->type(),
'name'));
244 if ($name ==
'refresh_time') {
245 $value = (int) $value;
248 $one_day = 24 * $one_hour;
250 if ($value >= $one_day) {
252 if ($value % $one_day) {
253 trigger_localised_error(
'CRON0035', E_USER_WARNING, $one_day);
256 }
else if ($value >= $one_hour) {
258 if ($value % $one_hour || $one_day % $value) {
259 trigger_localised_error(
'CRON0036', E_USER_WARNING, $one_hour);
264 if ($one_hour % $value) {
265 trigger_localised_error(
'CRON0037', E_USER_WARNING, $one_hour);
273 if ($name ==
'last_run' && $this->
attr(
'epoch') == 0) {
277 return parent::setAttrValue($name, $value);
298 $link = Array(
'asset' => $this,
'link_type' => $link_type,
'is_exclusive' =>
'1');
300 $GLOBALS[
'SQ_SYSTEM']->setRunLevel(SQ_RUN_LEVEL_FORCED);
301 $linkid = $job->
create($link);
302 $GLOBALS[
'SQ_SYSTEM']->restoreRunLevel();
304 return ($linkid > 0);
319 $link = $GLOBALS[
'SQ_SYSTEM']->am->getLinkByAsset($this->
id, $job->id, SQ_LINK_TYPE_3);
320 if (empty($link))
return FALSE;
322 $GLOBALS[
'SQ_SYSTEM']->setRunLevel(SQ_RUN_LEVEL_FORCED);
324 $success = $this->
deleteLink($link[
'linkid']);
325 $GLOBALS[
'SQ_SYSTEM']->restoreRunLevel();
346 public function getJobs($type_code=
'cron_job', $strict_type_code=TRUE)
348 $links = $GLOBALS[
'SQ_SYSTEM']->am->getLinks($this->
id, SQ_SC_LINK_SIGNIFICANT, $type_code, $strict_type_code,
'major', NULL, NULL, TRUE);
350 foreach ($links as $link) {
351 $job = $GLOBALS[
'SQ_SYSTEM']->am->getAsset($link[
'minorid'], $link[
'minor_type_code']);
352 if (is_null($job))
continue;
369 return max((
int) $this->
attr(
'last_run'), (
int) $this->
attr(
'epoch')) + (int) $this->
attr(
'refresh_time');
382 $refresh_time = (int) $this->
attr(
'refresh_time');
383 if ($refresh_time >= 86400) {
384 $num = ($refresh_time / 86400);
385 return ($num > 1) ? $num.
' '.translate(
'days') : translate(
'day');
387 if ($refresh_time >= 3600) {
388 $num = ($refresh_time / 3600);
389 return ($num > 1) ? $num.
' '.translate(
'hours') : translate(
'hour');
391 if ($refresh_time >= 60) {
392 $num = ($refresh_time / 60);
393 return ($num > 1) ? $num.
' '.translate(
'minutes') : translate(
'minute');
395 return $refresh_time.
' '.translate(
'seconds');
420 $excluded_times = $this->
attr(
'exclude_times');
422 foreach ($excluded_times as $exclude_time) {
423 $excluded_days = Array();
424 foreach ($exclude_time[
'days'] as $excluded_day) {
425 $excluded_days[] = $days_array[$excluded_day];
428 $now_day = date(
'D', $start_time);
429 $now_time = date(
'G', $start_time);
430 if (in_array($now_day, $excluded_days)) {
432 if ($now_time >= $exclude_time[
'from'] && (($exclude_time[
'to'] < $exclude_time[
'from']) || ($now_time < $exclude_time[
'to']))) {
435 }
else if ($exclude_time[
'from'] > $exclude_time[
'to']) {
437 $yesterday_day = date(
'D', time()-86400);
438 if (in_array($yesterday_day, $excluded_days)) {
439 if ($now_time < $exclude_time[
'to'])
return TRUE;
456 $start_time = time();
458 $old_log_errors = ini_set(
'log_errors',
'1');
459 $old_error_log = ini_set(
'error_log', SQ_LOG_PATH.
'/'.$this->error_log_file_name.SQ_CONF_LOG_EXTENSION);
460 set_error_handler(Array($this,
'_errorHandler'));
463 trigger_localised_error(
'CRON0047', E_USER_NOTICE, $this->name);
468 trigger_localised_error(
'CRON0012', E_USER_WARNING);
472 if ($start_time < (
int) $this->
attr(
'epoch')) {
473 trigger_localised_error(
'CRON0011', E_USER_WARNING);
480 $long_jobs = Array();
483 if ($this->
attr(
'running')) {
486 if ((
int) $this->
attr(
'run_check') >= (
int) $this->
attr(
'warn_after_num_run_checks')) {
488 $root_user = $GLOBALS[
'SQ_SYSTEM']->am->getSystemAsset(
'root_user');
489 $sys_admins = $GLOBALS[
'SQ_SYSTEM']->am->getSystemAsset(
'system_user_group');
491 $ms = $GLOBALS[
'SQ_SYSTEM']->getMessagingService();
492 $msg = $ms->newMessage();
494 'system_name' => SQ_CONF_SYSTEM_NAME,
495 'num_attempts' => $this->
attr(
'warn_after_num_run_checks'),
496 'error_log_path' => SQ_LOG_PATH.
'/'.$this->error_log_file_name.SQ_CONF_LOG_EXTENSION,
497 'root_urls' => str_replace(
"\n",
',', SQ_CONF_SYSTEM_ROOT_URLS),
502 $config_user = $this->
attr(
'dead_lock_email_to');
505 $msg->to = array_merge(Array(0, $root_user->id), $config_user);
507 $msg->type =
'cron.deadlock';
508 $msg->replacements = $msg_reps;
516 if ($GLOBALS[
'SQ_SYSTEM']->am->acquireLock($this->id,
'attributes', 0, TRUE)) {
519 $GLOBALS[
'SQ_SYSTEM']->am->releaseLock($this->
id,
'attributes');
522 trigger_localised_error(
'CRON0016', E_USER_WARNING, $this->name);
530 $epoch = (int) $this->
attr(
'epoch');
531 $refresh_time = (int) $this->
attr(
'refresh_time');
533 $secs = $start_time - $epoch;
534 $periods = floor($secs / $refresh_time);
535 $this_run = $epoch + ($refresh_time * $periods);
539 if ($refresh_time >= (60 * 60 * 24)) {
540 $epoch_in_dst = (date(
'I', $epoch) ==
'1');
541 $start_in_dst = (date(
'I', $start_time) ==
'1');
544 if ($epoch_in_dst != $start_in_dst) {
548 $this_run += ($epoch_in_dst) ? +3600 : -3600;
555 $GLOBALS[
'SQ_SYSTEM']->am->releaseLock($this->
id,
'attributes');
557 $ms = $GLOBALS[
'SQ_SYSTEM']->getMessagingService();
558 $am = $GLOBALS[
'SQ_SYSTEM']->am;
561 $last_run = (int) $this->
attr(
'last_run');
562 $next_run = $this_run + $refresh_time;
568 $failed_runs = Array();
572 $ignore_jobs = Array();
574 while (!empty($jobs)) {
577 foreach ($jobs as $job_info) {
579 $cron_job = $am->getAsset($job_info[
'assetid'], $job_info[
'type_code']);
580 if (is_null($cron_job))
continue;
582 if ($cron_job->attr(
'long')) {
586 if (!$cron_job->attr(
'running')) {
588 $long_jobs[] = $job_info;
590 $ignore_jobs[] = $cron_job->id;
591 $am->forgetAsset($cron_job);
596 $GLOBALS[
'SQ_SYSTEM']->setRunLevel(SQ_RUN_LEVEL_FORCED);
599 $GLOBALS[
'SQ_SYSTEM']->restoreRunLevel();
601 $result = $cron_job->run();
603 $GLOBALS[
'SQ_SYSTEM']->setRunLevel(SQ_RUN_LEVEL_FORCED);
606 $GLOBALS[
'SQ_SYSTEM']->restoreRunLevel();
609 require_once SQ_INCLUDE_PATH.
'/general_occasional.inc';
612 if ($result & SQ_CRON_JOB_REMOVE) {
614 $ignore_jobs[] = $cron_job->id;
616 }
else if ($result & SQ_CRON_JOB_RETRY) {
620 if ($result & SQ_CRON_JOB_ERROR) {
622 if (isset($failed_runs[$cron_job->id])) {
623 $failed_runs[$cron_job->id]++;
625 $failed_runs[$cron_job->id] = 1;
629 if ($failed_runs[$cron_job->id] >= (
int) $this->attr(
'num_failed_attempts')) {
631 $ignore_jobs[] = $cron_job->id;
633 $user = $cron_job->getRunningUser();
634 $root_user = $GLOBALS[
'SQ_SYSTEM']->am->getSystemAsset(
'root_user');
635 $sys_admins = $GLOBALS[
'SQ_SYSTEM']->am->getSystemAsset(
'system_user_group');
637 $msg = $ms->newMessage();
639 'cron_job_code' => $GLOBALS[
'SQ_SYSTEM']->am->getTypeInfo($cron_job->type(),
'name'),
640 'asset_name' => $cron_job->name,
641 'assetid' => $cron_job->id,
643 $msg->to = Array($user->id, $root_user->id, $sys_admins->id);
645 $msg->type =
'cron.forced_fail';
646 $msg->replacements = $msg_reps;
648 $ms->enqueueMessage($msg);
656 $ignore_jobs[] = $cron_job->id;
660 $am->forgetAsset($cron_job);
670 if ($acquired = $GLOBALS[
'SQ_SYSTEM']->am->acquireLock($this->id,
'attr_links', 0, TRUE)) {
672 }
else if ($lock_count < 3) {
686 $GLOBALS[
'SQ_SYSTEM']->am->releaseLock($this->
id,
'attr_links');
689 trigger_localised_error(
'CRON0015', E_USER_WARNING, $this->name);
694 if (time() > $next_run) {
695 $this_run = $next_run;
696 $next_run += $refresh_time;
699 $jobs = $this->
getJobsToRun($last_run, $this_run, $ignore_jobs);
703 if ($GLOBALS[
'SQ_SYSTEM']->am->acquireLock($this->id,
'attributes', 0, TRUE)) {
705 $GLOBALS[
'SQ_SYSTEM']->am->releaseLock($this->
id,
'attributes');
707 trigger_localised_error(
'CRON0032', E_USER_WARNING, $this->name);
710 trigger_localised_error(
'CRON0016', E_USER_WARNING, $this->name);
714 foreach ($long_jobs as $job_info) {
715 $cron_job = $am->getAsset($job_info[
'assetid'], $job_info[
'type_code']);
716 if ($cron_job->attr(
'long') && !$cron_job->attr(
'running')) {
717 $result = $cron_job->run();
718 if ($result & SQ_CRON_JOB_REMOVE) {
720 }
else if ($result & SQ_CRON_JOB_ERROR) {
721 trigger_localised_error(
'CRON0049', E_USER_WARNING, $cron_job->id);
724 $am->forgetAsset($cron_job);
729 trigger_localised_error(
'CRON0015', E_USER_WARNING, $this->name);
735 ini_set(
'log_errors', $old_log_errors);
736 ini_set(
'error_log', $old_error_log);
737 restore_error_handler();
755 return 'DBMS_LOB.SUBSTR('.$expression.
', DBMS_LOB.GETLENGTH('.$expression.
'), 1)';
775 require_once SQ_FUDGE_PATH.
'/general/datetime.inc';
777 if ($end_ts < $start_ts) {
778 trigger_localised_error(
'CRON0014', E_USER_WARNING);
782 $end = getdate($end_ts);
783 $start = getdate($start_ts);
785 $time_since_last_run = $end_ts - $start_ts;
788 $one_day = 24 * $one_hour;
789 $one_week = 7 * $one_day;
791 $over_one_hour_ago = ($time_since_last_run >= $one_hour);
792 $over_one_day_ago = ($time_since_last_run >= $one_day);
793 $over_one_week_ago = ($time_since_last_run >= $one_week);
796 if ($end[
'mon'] == 1) {
797 $days_last_month = days_in_month(12, $end[
'year'] - 1);
799 $days_last_month = days_in_month($end[
'mon'] - 1, $end[
'year']);
802 $over_one_month_ago = ($time_since_last_run >= ($days_last_month * $one_day));
804 $days_last_year = (is_leap_year($end[
'year'] - 1)) ? 366 : 365;
806 $over_one_year_ago = ($time_since_last_run >= ($days_last_year * $one_day));
811 foreach (Array(
'minutes',
'hours',
'wday',
'mday',
'mon',
'year') as $field) {
823 $end_f[$field] = str_pad($end[$field], $places,
'0', STR_PAD_LEFT);
824 $start_f[$field] = str_pad($start[$field], $places,
'0', STR_PAD_LEFT);
830 $build_up[
'hour'][
'bridge'] =
'('.$this->_clob2Str(
'COALESCE(av.custom_val, at.default_val)').
')
833 OR ('.$this->
_clob2Str(
'COALESCE(av.custom_val, at.default_val)').
')
836 $build_up[
'hour'][
'all'] =
'('.$this->_clob2Str(
'COALESCE(av.custom_val, at.default_val)').
') > '.
MatrixDAL::quote(
'%A%'.$start_f[
'minutes']).
'
839 $build_up[
'day'][
'bridge'] = str_replace(Array(
'%A%',
'%B%',
'%C%',
'%D%'), Array(
'%A%'.$start_f[
'hours'].
':',
'%B%23:',
'%C%00:',
'%D%'.$end_f[
'hours'].
':'), $build_up[
'hour'][
'bridge']);
840 $build_up[
'day'][
'all'] = str_replace(Array(
'%A%',
'%B%'), Array(
'%A%'.$start_f[
'hours'].
':',
'%B%'.$end_f[
'hours'].
':'), $build_up[
'hour'][
'all']);
842 $build_up[
'week'][
'bridge'] = str_replace(Array(
'%A%',
'%B%',
'%C%',
'%D%'),
843 Array(
'%A%'.$start_f[
'wday'].
' ',
'%B%6 ',
'%C%0 ',
'%D%'.$end_f[
'wday'].
' '),
844 $build_up[
'day'][
'bridge']);
846 $build_up[
'week'][
'all'] = str_replace(Array(
'%A%',
'%B%'),
847 Array(
'%A%'.$start_f[
'wday'].
' ',
'%B%'.$end_f[
'wday'].
' '),
848 $build_up[
'day'][
'all']);
850 $build_up[
'month'][
'bridge'] = str_replace(Array(
'%A%',
'%B%',
'%C%',
'%D%'),
851 Array(
'%A%'.$start_f[
'mday'].
' ',
'%B%'.days_in_month($start[
'mon'], $start[
'year']).
' ',
'%C%00 ',
'%D%'.$end_f[
'mday'].
' '),
852 $build_up[
'day'][
'bridge']);
854 $build_up[
'month'][
'all'] = str_replace(Array(
'%A%',
'%B%'),
855 Array(
'%A%'.$start_f[
'mday'].
' ',
'%B%'.$end_f[
'mday'].
' '),
856 $build_up[
'day'][
'all']);
858 $build_up[
'year'][
'bridge'] = str_replace(Array(
'%A%',
'%B%',
'%C%',
'%D%'),
859 Array(
'%A%'.$start_f[
'mon'].
'-',
'%B%12-',
'%C%00-',
'%D%'.$end_f[
'mon'].
'-'),
860 $build_up[
'month'][
'bridge']);
862 $build_up[
'year'][
'all'] = str_replace(Array(
'%A%',
'%B%'),
863 Array(
'%A%'.$start_f[
'mon'].
'-',
'%B%'.$end_f[
'mon'].
'-'),
864 $build_up[
'month'][
'all']);
866 $build_up[
'one_off'][
'all'] = str_replace(Array(
'%A%',
'%B%'),
867 Array(
'%A%'.$start_f[
'year'].
'-',
'%B%'.$end_f[
'year'].
'-'),
868 $build_up[
'year'][
'all']);
872 if ($over_one_hour_ago) {
873 $hourly =
'('.$this->_clob2Str(
'COALESCE(av.custom_val, at.default_val)').
') LIKE '.
MatrixDAL::quote(
'HR=%');
876 $type = ($end[
'minutes'] < $start[
'minutes']) ?
'bridge' :
'all';
877 $hourly = preg_replace(
'/%[ABCD]%/',
'HR=', $build_up[
'hour'][$type]);
881 if ($over_one_day_ago) {
882 $daily =
'('.$this->_clob2Str(
'COALESCE(av.custom_val, at.default_val)').
') LIKE '.
MatrixDAL::quote(
'DL=%');
885 $type = ($end[
'hours'] < $start[
'hours']) ?
'bridge' :
'all';
886 $daily = preg_replace(
'/%[ABCD]%/',
'DL=', $build_up[
'day'][$type]);
890 if ($over_one_week_ago) {
891 $weekly =
'('.$this->_clob2Str(
'COALESCE(av.custom_val, at.default_val)').
') LIKE '.
MatrixDAL::quote(
'WK=%');
894 $type = ($end[
'wday'] < $start[
'wday']) ?
'bridge' :
'all';
895 $weekly = preg_replace(
'/%[ABCD]%/',
'WK=', $build_up[
'week'][$type]);
899 if ($over_one_month_ago) {
900 $monthly =
'('.$this->_clob2Str(
'COALESCE(av.custom_val, at.default_val)').
') LIKE '.
MatrixDAL::quote(
'MT=%');
903 $type = ($end[
'mday'] < $start[
'mday']) ?
'bridge' :
'all';
904 $monthly = preg_replace(
'/%[ABCD]%/',
'MT=', $build_up[
'month'][$type]);
908 if ($over_one_year_ago) {
909 $yearly =
'('.$this->_clob2Str(
'COALESCE(av.custom_val, at.default_val)').
') LIKE '.
MatrixDAL::quote(
'YR=%');
912 $type = ($end[
'mon'] < $start[
'mon']) ?
'bridge' :
'all';
913 $yearly = preg_replace(
'/%[ABCD]%/',
'YR=', $build_up[
'year'][$type]);
916 $one_off = preg_replace(
'/%[ABCD]%/',
'OO=', $build_up[
'one_off'][
'all']);
918 $every_time =
'('.$this->_clob2Str(
'COALESCE(av.custom_val, at.default_val)').
') = '.
MatrixDAL::quote(
'ET=');
921 $repeating_time_interval =
'UPPER(av.custom_val) LIKE '.MatrixDAL::quote(
'%TI=%');
923 $sql =
'SELECT l.linkid, a.assetid, a.type_code
924 FROM ('.SQ_TABLE_RUNNING_PREFIX.
'ast_lnk l
925 INNER JOIN '.SQ_TABLE_RUNNING_PREFIX.
'ast a ON l.minorid = a.assetid)
926 INNER JOIN '.SQ_TABLE_RUNNING_PREFIX.
'ast_attr at ON at.type_code = a.type_code
927 LEFT OUTER JOIN '.SQ_TABLE_RUNNING_PREFIX.
'ast_attr_val av ON (av.assetid = a.assetid AND av.attrid = at.attrid)';
928 $where =
'l.majorid = '.MatrixDAL::quote($this->
id).
'
942 OR '.$repeating_time_interval.
'
945 if (!empty($ignore_jobs)) {
946 for ($i = 0; $i < count($ignore_jobs); $i++) {
949 $where .=
' AND a.assetid NOT IN ('.implode(
',', $ignore_jobs).
')';
952 $where = $GLOBALS[
'SQ_SYSTEM']->constructRollbackWhereClause($where,
'a');
953 $where = $GLOBALS[
'SQ_SYSTEM']->constructRollbackWhereClause($where,
'av');
961 $GLOBALS[
'CRON_MANAGER_GET_JOBS_TO_RUN_START_TS'] = $start_ts;
962 unset($GLOBALS[
'CRON_MANAGER_GET_JOBS_TO_RUN_START_TS']);
984 $terminate = ((E_USER_ERROR | E_ERROR) & $err_no);
988 if ((error_reporting() & $err_no) || $terminate) {
991 $err_file = hide_system_root($err_file);
992 $err_msg = hide_system_root($err_msg);
994 $err_name = get_error_name($err_no);
997 if (ini_get(
'log_errors')) {
998 $text_msg = strip_tags(preg_replace(Array(
'/<br\\/?>/i',
'/<p[^>]*>/i'), Array(
"\n",
"\n\n"), $err_msg));
999 log_error($text_msg, $err_no, $err_file, $err_line, $this->error_log_file_name);
1003 $err_msg = strip_tags(preg_replace(Array(
'/<br\\/?>/i',
'/<p[^>]*>/i'), Array(
"\n",
"\n\n"), $err_msg));
1004 $lines = explode(
"\n", $err_msg);
1005 $len = 7 + strlen($err_file);
1006 $len = max($len, 7 + strlen($err_line));
1007 foreach ($lines as $line) {
1008 $len = max($len, strlen($line));
1011 $str =
'+'.str_repeat(
'-', $len).
"+\n".
1012 '| '.$err_name.str_repeat(
' ', $len - 2 - strlen($err_name)).
" |\n".
1013 '|'.str_repeat(
'-', $len).
"|\n".
1014 '| File : '.$err_file.str_repeat(
' ', $len - 9 - strlen($err_file)).
" |\n".
1015 '| Line : '.$err_line.str_repeat(
' ', $len - 9 - strlen($err_line)).
" |\n".
1016 '|'.str_repeat(
'-', $len).
"|\n";
1017 foreach ($lines as $line) {
1018 $str .=
'| '.$line.str_repeat(
' ', $len - 2 - strlen($line)).
" |\n";
1021 $str .=
'+'.str_repeat(
'-', $len).
"+\n";
1023 if (!isset($this->_tmp[
'running_errors'])) {
1024 $this->_tmp[
'running_errors'] =
'';
1026 $this->_tmp[
'running_errors'] .= $str;
1031 if ($terminate && empty($this->_tmp[
'terminate_error'])) {
1032 $this->_tmp[
'terminate_error'] = TRUE;
1034 $root_user = $GLOBALS[
'SQ_SYSTEM']->am->getSystemAsset(
'root_user');
1035 $sys_admins = $GLOBALS[
'SQ_SYSTEM']->am->getSystemAsset(
'system_user_group');
1037 $ms = $GLOBALS[
'SQ_SYSTEM']->getMessagingService();
1038 $msg = $ms->newMessage();
1040 'system_name' => SQ_CONF_SYSTEM_NAME,
1041 'error_log_path' => SQ_LOG_PATH.
'/'.$this->error_log_file_name.SQ_CONF_LOG_EXTENSION,
1042 'root_urls' => str_replace(
"\n",
',', SQ_CONF_SYSTEM_ROOT_URLS),
1044 $msg->replacements = $msg_reps;
1047 $msg->to = Array(0, $root_user->id, $sys_admins->id);
1049 $msg->type =
'cron.term';
1067 return (
int) $this->
attr(
'last_run');