public function updated_config($ui) { $ui->save(); // if they selected an option other than manually, set up the cron $frequency = Options::get('exportsnapshot__frequency'); // delete the crontab entry, if there is one CronTab::delete_cronjob('snapshot'); switch ($frequency) { case 'manually': // do nothing break; case 'hourly': CronTab::add_hourly_cron('snapshot', array('ExportSnapshot', 'run'), _t('Hourly Export Snapshot', 'exportsnapshot')); break; case 'daily': CronTab::add_daily_cron('snapshot', array('ExportSnapshot', 'run'), _t('Daily Export Snapshot', 'exportsnapshot')); break; case 'weekly': CronTab::add_weekly_cron('snapshot', array('ExportSnapshot', 'run'), _t('Weekly Export Snapshot', 'exportsnapshot')); break; case 'monthly': CronTab::add_monthly_cron('snapshot', array('ExportSnapshot', 'run'), _t('Monthly Export Snapshot', 'exportsnapshot')); break; } return false; }
public function action_plugin_activation($file) { if (Plugins::id_from_file($file) == Plugins::id_from_file(__FILE__)) { CronTab::add_daily_cron('spamcrondelete', 'cron_delete_spam', 'Deletes spam comments that are old.'); } }
private function upgrade_db_post_5107() { // delete the current un-namespaced CronJobs by these names CronTab::delete_cronjob('trim_log'); CronTab::delete_cronjob('update_check'); // we could have a bunch of the single update crons now, and there's no way to handle that using CronTab, so do it manually $crons = DB::get_results('SELECT * FROM {crontab} WHERE name = ?', array('update_check_single'), '\\Habari\\CronJob'); foreach ($crons as $cron) { $cron->delete(); } // Add the cronjob to trim the log so that it doesn't get too big CronTab::add_daily_cron('trim_log', Method::create('\\Habari\\EventLog', 'trim'), _t('Trim the log table')); // Add the cronjob to check for plugin updates CronTab::add_daily_cron('update_check', Method::create('\\Habari\\Update', 'cron'), _t('Perform a check for plugin updates.')); }
public function action_plugin_activation($file) { if (realpath($file) == __FILE__) { CronTab::add_daily_cron('autoclose_check_posts', array(__CLASS__, 'check_posts'), 'Check for posts to close comments on'); } }
private function upgrade_db_post_1310() { // Auto-truncate the log table if (!CronTab::get_cronjob('truncate_log')) { CronTab::add_daily_cron('truncate_log', array('Utils', 'truncate_log'), _t('Truncate the log table')); } return true; }
private function upgrade_db_post_4588() { // Add the cronjob to check for plugin updates CronTab::add_daily_cron( 'update_check', array( 'Update', 'cron' ), _t( 'Perform a check for plugin updates.' ) ); }