public function action_init()
 {
     spl_autoload_register(array(__CLASS__, '_autoload'));
     // @todo move this to activation hook
     if (!CronTab::get_cronjob(self::CHECK_LINKS_CRON)) {
         CronTab::add_weekly_cron(self::CHECK_LINKS_CRON, 'check_links_cron', _t('Check links in posts for errors', self::TEXT_DOMAIN));
     }
 }
예제 #2
0
 public function action_plugin_activation($file)
 {
     if (realpath($file) == __FILE__) {
         Session::notice(_t('Please set your Mollom API Keys in the configuration.', 'mollom'));
         Options::set('mollom__public_key', '');
         Options::set('mollom__private_key', '');
         Options::set('mollom__servers', array());
         CronTab::add_weekly_cron('mollom_server_list', 'mollom_update_server_list_cron', 'Cron job to update mollom server list every week');
         CronTab::add_hourly_cron('mollom_stats', 'mollom_update_stats_cron', 'Cron job to update mollom stats every hour');
     }
 }
 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;
 }