當前位置: 首頁>>代碼示例>>PHP>>正文


PHP WYSIJA::check_scheduled_newsletters方法代碼示例

本文整理匯總了PHP中WYSIJA::check_scheduled_newsletters方法的典型用法代碼示例。如果您正苦於以下問題:PHP WYSIJA::check_scheduled_newsletters方法的具體用法?PHP WYSIJA::check_scheduled_newsletters怎麽用?PHP WYSIJA::check_scheduled_newsletters使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在WYSIJA的用法示例。


在下文中一共展示了WYSIJA::check_scheduled_newsletters方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: run_scheduled_task

 /**
  * run process if it's not detected as already running
  * @param type $process
  * @return type
  */
 function run_scheduled_task($process = 'queue')
 {
     //first let's make sure that the process asked to be run is not already running
     $scheduled_times = WYSIJA::get_cron_schedule($process);
     $processes = WYSIJA::get_cron_frequencies();
     $process_frequency = $processes[$process];
     // check if the scheduled task is already being processed,
     // we consider it timed out once the started running time plus the frequency has been passed
     if (!empty($scheduled_times['running']) && $scheduled_times['running'] + $process_frequency > time()) {
         if ($this->report) {
             echo 'already running : ' . $process . '<br/>';
         }
         return;
     }
     // set schedule as running
     WYSIJA::set_cron_schedule($process, 0, time());
     // execute schedule
     switch ($process) {
         case 'queue':
             // check if there are any scheduled newsletters ready for action
             WYSIJA::check_scheduled_newsletters();
             // if premium is activated we execute the premium cron process
             if (defined('WYSIJANLP')) {
                 $helper_premium = WYSIJA::get('premium', 'helper', false, WYSIJANLP);
                 $helper_premium->croned_queue_process();
             } else {
                 // run the standard queue process no scheduled tasks will be check since it has already been checked above
                 WYSIJA::croned_queue(false);
             }
             break;
         case 'bounce':
             $helper_premium = WYSIJA::get('premium', 'helper', false, WYSIJANLP);
             $model_config = WYSIJA::get('config', 'model');
             // if premium is activated we launch the premium function
             if (is_multisite()) {
                 $multisite_prefix = 'ms_';
             }
             // we don't process the bounce automatically unless the option is ticked
             if (defined('WYSIJANLP') && $model_config->getValue($multisite_prefix . 'bounce_process_auto')) {
                 $helper_premium->croned_bounce();
             } else {
                 $process .= ' (bounce handling not activated)';
             }
             break;
         case 'daily':
             WYSIJA::croned_daily();
             break;
         case 'weekly':
             if (defined('WYSIJANLP')) {
                 $helper_premium = WYSIJA::get('premium', 'helper', false, WYSIJANLP);
                 $helper_premium->croned_weekly();
             }
             WYSIJA::croned_weekly();
             break;
         case 'monthly':
             WYSIJA::croned_monthly();
             break;
     }
     // set next_schedule details
     WYSIJA::set_cron_schedule($process);
     if ($this->report) {
         echo 'processed : ' . $process . '<br/>';
     }
 }
開發者ID:namwoody,項目名稱:SAAZINDIAN.COM,代碼行數:69,代碼來源:cron.php

示例2: croned_queue

 /**
  * scheduled task for sending the emails in the queue, the frequency is set in the settings
  */
 public static function croned_queue($check_scheduled_newsletter = true)
 {
     // check the scheduled tasks only if it's a standard WP scheduled task free only
     if ($check_scheduled_newsletter) {
         WYSIJA::check_scheduled_newsletters();
     }
     $model_config = WYSIJA::get('config', 'model');
     // check that the 2000 limit is not passed and process the queue
     if ((int) $model_config->getValue('total_subscribers') < 2000) {
         $helper_queue = WYSIJA::get('queue', 'helper');
         $helper_queue->report = false;
         WYSIJA::log('croned_queue process', true, 'cron');
         $helper_queue->process();
     }
 }
開發者ID:duboisGeof,項目名稱:deliciousMeals,代碼行數:18,代碼來源:base.php


注:本文中的WYSIJA::check_scheduled_newsletters方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。