当前位置: 首页>>代码示例>>PHP>>正文


PHP CRM_Mailing_BAO_MailingJob::runJobs_post方法代码示例

本文整理汇总了PHP中CRM_Mailing_BAO_MailingJob::runJobs_post方法的典型用法代码示例。如果您正苦于以下问题:PHP CRM_Mailing_BAO_MailingJob::runJobs_post方法的具体用法?PHP CRM_Mailing_BAO_MailingJob::runJobs_post怎么用?PHP CRM_Mailing_BAO_MailingJob::runJobs_post使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在CRM_Mailing_BAO_MailingJob的用法示例。


在下文中一共展示了CRM_Mailing_BAO_MailingJob::runJobs_post方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: run

 /**
  * Run this page (figure out the action needed and perform it).
  */
 public function run()
 {
     $this->preProcess();
     $newArgs = func_get_args();
     // since we want only first function argument
     $newArgs = $newArgs[0];
     if (isset($_GET['runJobs']) || CRM_Utils_Array::value('2', $newArgs) == 'queue') {
         $mailerJobSize = Civi::settings()->get('mailerJobSize');
         CRM_Mailing_BAO_MailingJob::runJobs_pre($mailerJobSize);
         CRM_Mailing_BAO_MailingJob::runJobs();
         CRM_Mailing_BAO_MailingJob::runJobs_post();
     }
     $this->_sortByCharacter = CRM_Utils_Request::retrieve('sortByCharacter', 'String', $this);
     // CRM-11920 all should set sortByCharacter to null, not empty string
     if (strtolower($this->_sortByCharacter) == 'all' || !empty($_POST)) {
         $this->_sortByCharacter = NULL;
         $this->set('sortByCharacter', NULL);
     }
     if (CRM_Utils_Array::value(3, $newArgs) == 'unscheduled') {
         $this->_unscheduled = TRUE;
     }
     $this->set('unscheduled', $this->_unscheduled);
     if (CRM_Utils_Array::value(3, $newArgs) == 'archived') {
         $this->_archived = TRUE;
     }
     $this->set('archived', $this->_archived);
     if (CRM_Utils_Array::value(3, $newArgs) == 'scheduled') {
         $this->_scheduled = TRUE;
     }
     $this->set('scheduled', $this->_scheduled);
     $this->_createdId = CRM_Utils_Request::retrieve('cid', 'Positive', $this, FALSE, 0);
     if ($this->_createdId) {
         $this->set('createdId', $this->_createdId);
     }
     if ($this->_sms) {
         $this->set('sms', $this->_sms);
     }
     $session = CRM_Core_Session::singleton();
     $context = $session->readUserContext();
     if ($this->_action & CRM_Core_Action::DISABLE) {
         if (CRM_Utils_Request::retrieve('confirmed', 'Boolean', $this)) {
             CRM_Mailing_BAO_MailingJob::cancel($this->_mailingId);
             CRM_Utils_System::redirect($context);
         } else {
             $controller = new CRM_Core_Controller_Simple('CRM_Mailing_Form_Browse', ts('Cancel Mailing'), $this->_action);
             $controller->setEmbedded(TRUE);
             $controller->run();
         }
     } elseif ($this->_action & CRM_Core_Action::DELETE) {
         if (CRM_Utils_Request::retrieve('confirmed', 'Boolean', $this)) {
             // check for action permissions.
             if (!CRM_Core_Permission::checkActionPermission('CiviMail', $this->_action)) {
                 CRM_Core_Error::fatal(ts('You do not have permission to access this page.'));
             }
             CRM_Mailing_BAO_Mailing::del($this->_mailingId);
             CRM_Utils_System::redirect($context);
         } else {
             $controller = new CRM_Core_Controller_Simple('CRM_Mailing_Form_Browse', ts('Delete Mailing'), $this->_action);
             $controller->setEmbedded(TRUE);
             $controller->run();
         }
     } elseif ($this->_action & CRM_Core_Action::RENEW) {
         // archive this mailing, CRM-3752.
         if (CRM_Utils_Request::retrieve('confirmed', 'Boolean', $this)) {
             // set is_archived to 1
             CRM_Core_DAO::setFieldValue('CRM_Mailing_DAO_Mailing', $this->_mailingId, 'is_archived', TRUE);
             CRM_Utils_System::redirect($context);
         } else {
             $controller = new CRM_Core_Controller_Simple('CRM_Mailing_Form_Browse', ts('Archive Mailing'), $this->_action);
             $controller->setEmbedded(TRUE);
             $controller->run();
         }
     }
     $selector = new CRM_Mailing_Selector_Browse();
     $selector->setParent($this);
     $controller = new CRM_Core_Selector_Controller($selector, $this->get(CRM_Utils_Pager::PAGE_ID), $this->get(CRM_Utils_Sort::SORT_ID) . $this->get(CRM_Utils_Sort::SORT_DIRECTION), CRM_Core_Action::VIEW, $this, CRM_Core_Selector_Controller::TEMPLATE);
     $controller->setEmbedded(TRUE);
     $controller->run();
     // hack to display results as per search
     $rows = $controller->getRows($controller);
     $this->assign('rows', $rows);
     $urlParams = 'reset=1';
     $urlString = 'civicrm/mailing/browse';
     if ($this->get('sms')) {
         $urlParams .= '&sms=1';
     }
     if (CRM_Utils_Array::value(3, $newArgs) == 'unscheduled') {
         $urlString .= '/unscheduled';
         $urlParams .= '&scheduled=false';
         $this->assign('unscheduled', TRUE);
     } elseif (CRM_Utils_Array::value(3, $newArgs) == 'archived') {
         $urlString .= '/archived';
         $this->assign('archived', TRUE);
     } elseif (CRM_Utils_Array::value(3, $newArgs) == 'scheduled') {
         $urlString .= '/scheduled';
         $urlParams .= '&scheduled=true';
     }
//.........这里部分代码省略.........
开发者ID:rameshrr99,项目名称:civicrm-core,代码行数:101,代码来源:Browse.php

示例2: processQueue

 /**
  * @param null $mode
  *
  * @return bool
  * @throws Exception
  */
 public static function processQueue($mode = NULL)
 {
     $config = CRM_Core_Config::singleton();
     if ($mode == NULL && CRM_Core_BAO_MailSettings::defaultDomain() == "EXAMPLE.ORG") {
         throw new CRM_Core_Exception(ts('The <a href="%1">default mailbox</a> has not been configured. You will find <a href="%2">more info in the online user and administrator guide</a>', array(1 => CRM_Utils_System::url('civicrm/admin/mailSettings', 'reset=1'), 2 => "http://book.civicrm.org/user/advanced-configuration/email-system-configuration/")));
     }
     // check if we are enforcing number of parallel cron jobs
     // CRM-8460
     $gotCronLock = FALSE;
     if (property_exists($config, 'mailerJobsMax') && $config->mailerJobsMax && $config->mailerJobsMax > 0) {
         $lockArray = range(1, $config->mailerJobsMax);
         shuffle($lockArray);
         // check if we are using global locks
         foreach ($lockArray as $lockID) {
             $cronLock = Civi\Core\Container::singleton()->get('lockManager')->acquire("worker.mailing.send.{$lockID}");
             if ($cronLock->isAcquired()) {
                 $gotCronLock = TRUE;
                 break;
             }
         }
         // exit here since we have enuf cronjobs running
         if (!$gotCronLock) {
             CRM_Core_Error::debug_log_message('Returning early, since max number of cronjobs running');
             return TRUE;
         }
         if (getenv('CIVICRM_CRON_HOLD')) {
             // In testing, we may need to simulate some slow activities.
             sleep(getenv('CIVICRM_CRON_HOLD'));
         }
     }
     // load bootstrap to call hooks
     // Split up the parent jobs into multiple child jobs
     $mailerJobSize = property_exists($config, 'mailerJobSize') ? $config->mailerJobSize : NULL;
     CRM_Mailing_BAO_MailingJob::runJobs_pre($mailerJobSize, $mode);
     CRM_Mailing_BAO_MailingJob::runJobs(NULL, $mode);
     CRM_Mailing_BAO_MailingJob::runJobs_post($mode);
     // lets release the global cron lock if we do have one
     if ($gotCronLock) {
         $cronLock->release();
     }
     return TRUE;
 }
开发者ID:scardinius,项目名称:civicrm-core-api-mailing,代码行数:48,代码来源:Mailing.php

示例3: processQueue

 static function processQueue($mode = NULL)
 {
     $config =& CRM_Core_Config::singleton();
     //   CRM_Core_Error::debug_log_message("Beginning processQueue run: {$config->mailerJobsMax}, {$config->mailerJobSize}");
     if ($mode == NULL && CRM_Core_BAO_MailSettings::defaultDomain() == "EXAMPLE.ORG") {
         CRM_Core_Error::fatal(ts('The <a href="%1">default mailbox</a> has not been configured. You will find <a href="%2">more info in the online user and administrator guide</a>', array(1 => CRM_Utils_System::url('civicrm/admin/mailSettings', 'reset=1'), 2 => "http://book.civicrm.org/user/advanced-configuration/email-system-configuration/")));
     }
     // check if we are enforcing number of parallel cron jobs
     // CRM-8460
     $gotCronLock = FALSE;
     if (property_exists($config, 'mailerJobsMax') && $config->mailerJobsMax && $config->mailerJobsMax > 1) {
         $lockArray = range(1, $config->mailerJobsMax);
         shuffle($lockArray);
         // check if we are using global locks
         $serverWideLock = CRM_Core_BAO_Setting::getItem(CRM_Core_BAO_Setting::MAILING_PREFERENCES_NAME, 'civimail_server_wide_lock');
         foreach ($lockArray as $lockID) {
             $cronLock = new CRM_Core_Lock("civimail.cronjob.{$lockID}", NULL, $serverWideLock);
             if ($cronLock->isAcquired()) {
                 $gotCronLock = TRUE;
                 break;
             }
         }
         // exit here since we have enuf cronjobs running
         if (!$gotCronLock) {
             CRM_Core_Error::debug_log_message('Returning early, since max number of cronjobs running');
             return TRUE;
         }
     }
     // load bootstrap to call hooks
     // Split up the parent jobs into multiple child jobs
     $mailerJobSize = property_exists($config, 'mailerJobSize') ? $config->mailerJobSize : NULL;
     CRM_Mailing_BAO_MailingJob::runJobs_pre($mailerJobSize, $mode);
     CRM_Mailing_BAO_MailingJob::runJobs(NULL, $mode);
     CRM_Mailing_BAO_MailingJob::runJobs_post($mode);
     // lets release the global cron lock if we do have one
     if ($gotCronLock) {
         $cronLock->release();
     }
     //   CRM_Core_Error::debug_log_message('Ending processQueue run');
     return TRUE;
 }
开发者ID:TheCraftyCanvas,项目名称:aegir-platforms,代码行数:41,代码来源:Mailing.php


注:本文中的CRM_Mailing_BAO_MailingJob::runJobs_post方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。