17 require_once SQ_INCLUDE_PATH.
'/general_occasional.inc';
18 define(
'SQ_REMOVE_FUTURE_LINEAGE_CRON_ADD', 1);
19 define(
'SQ_REMOVE_FUTURE_LINEAGE_CRON_DELETE', 2);
20 define(
'SQ_REMOVE_FUTURE_LINEAGE_CRON_BOTH', 3);
51 public static function execute($settings, &$state)
54 if (empty($settings[
'job_type'])) {
59 if (empty($state[
'asset'])) {
61 if (empty($state[
'assetid'])) {
64 $state[
'asset'] = $GLOBALS[
'SQ_SYSTEM']->am->getAsset($state[
'assetid']);
68 $cron_mgr = $GLOBALS[
'SQ_SYSTEM']->am->getSystemAsset(
'cron_manager');
69 if (is_null($cron_mgr))
return FALSE;
71 $GLOBALS[
'SQ_SYSTEM']->am->includeAsset(
'cron_job_future_lineage');
73 if (empty($future_lineage_jobs))
return TRUE;
77 foreach ($future_lineage_jobs as $job) {
79 $job_type = $job->attr(
'link_info') ? SQ_REMOVE_FUTURE_LINEAGE_CRON_ADD : SQ_REMOVE_FUTURE_LINEAGE_CRON_DELETE;
81 if ($settings[
'job_type'] == SQ_REMOVE_FUTURE_LINEAGE_CRON_BOTH || $settings[
'job_type'] == $job_type) {
82 if (!$cron_mgr->removeJob($job)) {
83 trigger_localised_error(
'CORE0308', E_USER_WARNING, $job->id);
107 public static function getInterface($settings, $prefix, $write_access=FALSE)
109 if (empty($settings[
'job_type'])) {
111 $selected_type = SQ_REMOVE_FUTURE_LINEAGE_CRON_BOTH;
113 $selected_type = $settings[
'job_type'];
119 if (!$write_access) {
120 $form_element_extras =
'disabled="disabled"';
122 $form_element_extras =
'';
126 echo translate(
'trigger_remove_future_lineage_cron');
127 combo_box($prefix.
'[job_type]', $jobs_types, FALSE, $selected_type, NULL, $form_element_extras);
128 $html = ob_get_contents();
149 $job_type = array_get_index($request_data,
'job_type', FALSE);
151 return 'Cron job type not specified';
157 if (!isset($jobs_types[$job_type])) {
158 return 'Specified cron job type is invalid';
160 $settings[
'job_type'] = $job_type;
178 SQ_REMOVE_FUTURE_LINEAGE_CRON_ADD =>
"Create",
179 SQ_REMOVE_FUTURE_LINEAGE_CRON_DELETE =>
"Delete",
180 SQ_REMOVE_FUTURE_LINEAGE_CRON_BOTH =>
"Create/Delete",