Skip to content

Commit

Permalink
Added option for rescheduling cron task on manual run.
Browse files Browse the repository at this point in the history
  • Loading branch information
cheesegrits committed Jan 23, 2018
1 parent 84599fd commit 03acd07
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 4 deletions.
10 changes: 6 additions & 4 deletions administrator/components/com_fabrik/controllers/crons.php
Expand Up @@ -112,7 +112,7 @@ public function run()
$table = FabTable::getInstance('cron', 'FabrikTable');
$table->load($row->id);
$plugin->setRow($table);
$plugin->getParams();
$pluginParams = $plugin->getParams();
$thisListModel = clone ($listModel);
$thisAdminListModel = clone ($adminListModel);
$tid = (int) $rowParams->table;
Expand Down Expand Up @@ -155,9 +155,11 @@ public function run()
$mailer->sendMail($config->get('mailfrom'), $config->get('fromname'), $recipient, $subject, $this->log->message, true);
}

$table->lastrun = JFactory::getDate()->toSql();
$table->store();

if ($pluginParams->get('cron_reschedule_manual', '0') === '1')
{
$table->lastrun = JFactory::getDate()->toSql();
$table->store();
}
}

$this->setRedirect('index.php?option=com_fabrik&view=crons', $c . ' records updated');
Expand Down
Expand Up @@ -135,6 +135,8 @@ COM_FABRIK_CRON_FIELD_UNIT_DESC="Select a time unit that will combine with the '
COM_FABRIK_CRON_FIELD_UNIT_LABEL="Unit"
COM_FABRIK_CRON_FIELD_ROW_LIMIT_DESC="By default Fabrik will select all rows in the selected list for cron processing, subject to any pre-filters, but NOT subject to any pagination limits. This can result in memory and execution time problems on larger tables. To place a hard limit on the number of rows selected for processing (ordered as specified in your list setting), set this Row Limit."
COM_FABRIK_CRON_FIELD_ROW_LIMIT_LABEL="Row Limit"
COM_FABRIK_CRON_FIELD_RESCHEDULE_MANUAL_DESC="If set to Yes, will update the lastrun date and reschedule when manually running the plugin on the backend, as well as when running through via the cron system plugin. If set to No, will only reschedule when running via the system plugin."
COM_FABRIK_CRON_FIELD_RESCHEDULE_MANUAL_LABEL="Reschedule Manual"
COM_FABRIK_CRON_HOUR="hour"
COM_FABRIK_CRON_MINUTE="minute"
COM_FABRIK_CRON_MONTH="Month"
Expand Down
10 changes: 10 additions & 0 deletions administrator/components/com_fabrik/models/forms/cron.xml
Expand Up @@ -122,6 +122,16 @@
<option value="1">JYES</option>
</field>

<field name="cron_reschedule_manual"
type="radio"
class="btn-group"
default="0"
description="COM_FABRIK_CRON_FIELD_RESCHEDULE_MANUAL_DESC"
label="COM_FABRIK_CRON_FIELD_RESCHEDULE_MANUAL_LABEL">
<option value="0">JNO</option>
<option value="1">JYES</option>
</field>

</fieldset>

<fieldset label="connection" name="connection">
Expand Down

0 comments on commit 03acd07

Please sign in to comment.