function action_plugin_deactivation($file)
 {
     // Remove the periodical execution event
     CronTab::delete_cronjob('incoming_links');
     // Clear the cached links
     Cache::expire('incoming_links');
 }
Beispiel #2
0
 public function action_plugin_deactivation($file)
 {
     if (realpath($file) == __FILE__) {
         CronTab::delete_cronjob('pbem_check_accounts');
         ACL::destroy_token('PBEM');
     }
 }
 /**
  * When a post is published, add a cron entry to do pinging
  *
  * @param Post $post A post object whose status has been set to published
  */
 public function action_post_status_published($post)
 {
     if ($post->status == Post::status('published') && $post->pubdate <= HabariDateTime::date_create()) {
         CronTab::add_single_cron('ping update sites', array('Autopinger', 'ping_sites'), HabariDateTime::date_create()->int, 'Ping update sites.');
         EventLog::log('Crontab added', 'info', 'default', null, null);
     }
 }
 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));
     }
 }
 public function action_plugin_deactivation($file = '')
 {
     if (Plugins::id_from_file($file) == Plugins::id_from_file(__FILE__)) {
         CronTab::delete_cronjob('optimize database tables initial');
         CronTab::delete_cronjob('optimize database tables');
         Options::delete('database_optimizer__frequency');
     }
 }
Beispiel #6
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');
     }
 }
 function action_plugin_deactivation($file)
 {
     if (Plugins::id_from_file($file) == Plugins::id_from_file(__FILE__)) {
         // remove the module from the dash if it is active
         Modules::remove_by_name('Incoming Links');
         // Remove the periodical execution event
         CronTab::delete_cronjob('incoming_links');
         // Clear the cached links
         Cache::expire('incoming_links');
     }
 }
Beispiel #8
0
 public function test_delete_on_fail()
 {
     $job = CronTab::add_single_cron('test_delete_fail', 'this_cron_hook_doesnt_exist', DateTime::create(), 'Test Cron');
     for ($z = 0; $z < 10; $z++) {
         $job = CronTab::get_cronjob('test_delete_fail');
         Options::set('next_cron', 0);
         Options::delete('cron_running');
         $job->execute();
     }
     $this->assert_false($job->active, 'The cron is still active after failing more than the allowed number of times.');
     CronTab::delete_cronjob('test_delete_fail');
 }
Beispiel #9
0
 public function run()
 {
     try {
         $cron = new CronTab($this->config['data']);
         $cron->registerExecutor(trim($this->php . ' ' . (!empty($this->config['executor']) ? $this->config['executor'] : $this->_) . ' --job='));
         if (isset($this->args['--master'])) {
             $cron->start();
         } elseif (!empty($this->args['--job'])) {
             if (is_array($this->args['--job'])) {
                 foreach ($this->args['--job'] as $command) {
                     $cron->dispatch($command);
                 }
             } else {
                 $cron->execute($this->args['--job']);
             }
         } else {
             $this->usage();
         }
     } catch (\Exception $e) {
     }
 }
Beispiel #10
0
 /**
  * Add a new cron job to the DB.
  *
  * @see CronJob
  * @param array $paramarray A paramarray of cron job feilds.
  * @return \Habari\CronJob
  */
 static function add_cron($paramarray)
 {
     // Delete any existing job with this same name
     if ($job = CronTab::get_cronjob($paramarray['name'])) {
         $job->delete();
     }
     $cron = new CronJob($paramarray);
     $result = $cron->insert();
     //If the new cron should run earlier than the others, rest next_cron to its strat time.
     $next_cron = DB::get_value('SELECT next_run FROM {crontab} ORDER BY next_run ASC LIMIT 1', array());
     if (intval(Options::get('next_cron')) > intval($next_cron)) {
         Options::set('next_cron', $next_cron);
     }
     return $result ? $cron : false;
 }
Beispiel #11
0
}
// Send the Content-Type HTTP header.
// @todo Find a better place to put this.
header('Content-Type: text/html;charset=utf-8');
// Load and upgrade all the active plugins.
spl_autoload_register(array('Plugins', '_autoload'));
Plugins::load_active();
Plugins::upgrade();
// All plugins loaded, tell the plugins.
Plugins::act('plugins_loaded');
// Start the session.
Session::init();
// Replace the $_COOKIE superglobal with an object representation
SuperGlobal::process_c();
// Initiating request handling, tell the plugins.
Plugins::act('init');
// Load Stack Items
Stack::load_stackitems();
if (defined('SUPPRESS_REQUEST')) {
    return;
}
// Parse and handle the request.
Controller::parse_request();
// Run the cron jobs asyncronously.
CronTab::run_cron(Config::get('cron_async', true));
// Dispatch the request (action) to the matched handler.
Controller::dispatch_request();
// Flush (send) the output buffer.
$buffer = ob_get_clean();
$buffer = Plugins::filter('final_output', $buffer);
echo $buffer;
Beispiel #12
0
<?php

error_reporting(E_ALL);
ini_set('display_errors', 2);
if (!defined('APP_PATH')) {
    define('APP_PATH', dirname(__FILE__));
}
require_once APP_PATH . '/classes/SEOKit.php';
spl_autoload_register(array('SEOKit', 'autoload'));
set_error_handler(array('SEOKit', 'errorHandler'));
date_default_timezone_set(Options::get('timezone'));
CronTab::run(true);
Controller::dispatchRequest();
 public function action_plugin_deactivation($file)
 {
     if (realpath($file) == __FILE__) {
         CronTab::delete_cronjob('autoclose_check_posts');
     }
 }
 function action_plugin_activation($file)
 {
     Modules::add('123LinkIt');
     CronTab::add_hourly_cron('linkit_fetch', 'linkit_fetch', _t('Fetches the statistical data from the 123LinkIt site.', 'linkit'));
 }
 public function action_plugin_deactivation($file)
 {
     if (Plugins::id_from_file($file) == Plugins::id_from_file(__FILE__)) {
         CronTab::delete_cronjob('spamcrondelete');
     }
 }
Beispiel #16
0
 * Include all the active plugins.
 * By loading them here they'll have global scope.
 *
 * We loop through them twice so we can cache all plugin classes on the first load() call.
 * This gives about 60% improvement.
 */
foreach (Plugins::list_active() as $file) {
    include_once $file;
}
// Call the plugin's load procedure.
foreach (Plugins::list_active() as $file) {
    Plugins::load($file);
}
// All plugins loaded, tell the plugins.
Plugins::act('plugins_loaded');
// Start the session.
Session::init();
// Replace the $_COOKIE superglobal with an object representation
SuperGlobal::process_c();
// Initiating request handling, tell the plugins.
Plugins::act('init');
// Parse and handle the request.
Controller::parse_request();
// Run the cron jobs asyncronously.
CronTab::run_cron(true);
// Dispatch the request (action) to the matched handler.
Controller::dispatch_request();
// Flush (send) the output buffer.
$buffer = ob_get_clean();
$buffer = Plugins::filter('final_output', $buffer);
echo $buffer;
 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_post_status_published($post)
 {
     if ($post->status == Post::status('published')) {
         CronTab::add_single_cron('ping update sites', 'ping_sites', time(), 'Ping update sites.');
     }
 }
 public function formui_submit(FormUI $form)
 {
     if (isset($form->cron_id)) {
         $cron = CronTab::get_cronjob((int) $form->cron_id->value);
     } else {
         $required = array('cron_name', 'callback', 'description');
         foreach ($required as $req) {
             if (!$form->{$req}->value) {
                 Session::error(_t('%s is a required feild.', array(ucwords($req)), 'crontabmanager'));
                 return;
             }
         }
         $cron = new CronJob();
         //$cron->insert();
     }
     $cron->name = $form->cron_name->value;
     $cron->callback = strpos($form->callback->value, 'a:') === 0 || strpos($form->callback->value, 'O:') === 0 ? unserialize($form->callback->value) : $form->callback->value;
     $cron->increment = $form->increment->value ? $form->increment->value : 86400;
     $cron->next_run = HabariDateTime::date_create(isset($form->next_run) && $form->next_run->value ? $form->next_run->value : HabariDateTime::date_create());
     $cron->start_time = HabariDateTime::date_create($form->start_time->value ? $form->start_time->value : HabariDateTime::date_create());
     $cron->end_time = $form->end_time->value ? HabariDateTime::date_create($form->end_time->value) : null;
     $cron->description = $form->description->value;
     $cron->cron_class = $form->cron_class->value;
     if (intval(Options::get('next_cron')) > $cron->next_run->int) {
         Options::set('next_cron', $cron->next_run->int);
     }
     if ($cron->update()) {
         Session::notice(_t('Cron Job saved.', 'crontabmanager'));
     } else {
         Session::error(_t('Could not save Cron Job.', 'crontabmanager'));
     }
 }
 /**
  * Perform actions when the admin plugin form is successfully submitted. 
  * 
  * @param FormUI $ui The form that successfully completed
  * @return boolean True if the normal processing should occur to save plugin options from the form to the database
  */
 public function updated_config($ui)
 {
     $ui->save();
     // Delete the cached feed data
     DB::query('TRUNCATE {feedlist}');
     // Reset the cronjob so that it runs immediately with the change
     CronTab::delete_cronjob('feedlist');
     CronTab::add_hourly_cron('feedlist', 'load_feeds', 'Load feeds for feedlist plugin.');
     return false;
 }
Beispiel #21
0
 private function upgrade_db_post_5116()
 {
     // make sure the update cronjob has not failed too many times during our server move
     $cron = CronTab::get_cronjob('update_check');
     $cron->active = true;
     $cron->failures = 0;
     $cron->update();
 }
Beispiel #22
0
function video_parser_update_settings($args)
{
    $cronTab = new CronTab();
    $exec_per_day = esc_attr($args['exec_per_day']);
    $add_posts_count = esc_attr($args['add_posts_count']);
    $enable_parser = esc_attr($args['enable_parser']);
    if ($enable_parser) {
        if ($exec_per_day && $add_posts_count) {
            $cronTab->setJob($exec_per_day, $add_posts_count)->confirm();
        } else {
            $cronTab->removeJob()->confirm();
        }
    } else {
        $cronTab->removeJob()->confirm();
    }
    return $args;
}
 public function on_success($form)
 {
     $form->save();
     $params = array('name' => 'fireeagle:refresh', 'callback' => 'fireeagle_refresh', 'increment' => Options::get('fireeagle__refresh_interval'), 'description' => 'Refreshing Fire Eagle Location');
     CronTab::delete_cronjob($params['name']);
     CronTab::add_cron($params);
     return false;
 }
Beispiel #24
0
 /**
  * Compare the current set of plugins with those we last checked for updates.
  * This is run by AdminHandler on every page load to make sure we always have fresh data on the dashboard.
  */
 public static function check_plugins()
 {
     // register the beacons
     self::register_beacons();
     // get the list we checked last time
     $checked_list = Options::get('updates_beacons');
     // if the lists are different
     if ($checked_list != self::instance()->beacons) {
         // remove any stored updates, just to avoid showing stale data
         Options::delete('updates_available');
         // schedule an update check the next time cron runs
         CronTab::add_single_cron('update_check_single', Method::create('\\Habari\\Update', 'cron'), DateTime::create()->int, _t('Perform a single check for plugin updates, the plugin set has changed.'));
     }
 }
Beispiel #25
0
	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.' ) );
		
	}
 /**
  * Run deactivation routines.
  */
 public function action_plugin_deactivation($file)
 {
     CronTab::delete_cronjob('blogroll:update');
     Options::delete('blogroll__api_version');
 }
Beispiel #27
0
 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;
 }
 public function action_plugin_activation($file)
 {
     if (Plugins::id_from_file($file) == Plugins::id_from_file(__FILE__)) {
         CronTab::add_hourly_cron('update_rrs_blocks', 'rssblocks_update');
     }
 }
Beispiel #29
0
 /**
  * function update_scheduled_posts_cronjob
  *
  * Creates or recreates the cronjob to publish
  * scheduled posts. It is called whenever a post
  * is updated or created
  *
  */
 public static function update_scheduled_posts_cronjob()
 {
     $min_time = DB::get_value('SELECT MIN(pubdate) FROM {posts} WHERE status = ?', array(Post::status('scheduled')));
     CronTab::delete_cronjob('publish_scheduled_posts');
     if ($min_time) {
         CronTab::add_single_cron('publish_scheduled_posts', array('Posts', 'publish_scheduled_posts'), $min_time, 'Next run: ' . HabariDateTime::date_create($min_time)->get('c'));
     }
 }
 function action_plugin_deactivation($file)
 {
     CronTab::delete_cronjob('lastrecent');
     Cache::expire(array('lastrecent'));
 }