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


PHP PartKeepr::getRequiredCronjobs方法代碼示例

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


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

示例1: getInactiveCronjobs

 /**
  * Returns a list of all inactive cronjobs
  * 
  * @param none
  * @return array A string of cronjob names which aren't running
  */
 public function getInactiveCronjobs()
 {
     $dql = "SELECT c.cronjob FROM PartKeepr\\CronLogger\\CronLogger c WHERE c.cronjob = :cronjob";
     $dql .= " AND c.lastRunDate > :date";
     $query = PartKeepr::getEM()->createQuery($dql);
     $date = new \DateTime();
     $date->sub(new \DateInterval('P1D'));
     $query->setParameter("date", $date);
     $failedCronjobs = array();
     foreach (PartKeepr::getRequiredCronjobs() as $cronjob) {
         $query->setParameter("cronjob", $cronjob);
         try {
             $query->getSingleResult();
         } catch (\Exception $e) {
             $failedCronjobs[] = $cronjob;
         }
     }
     return $failedCronjobs;
 }
開發者ID:JohnEffland,項目名稱:PartKeepr,代碼行數:25,代碼來源:CronLoggerManager.php

示例2: markCronjobsAsRun

 /**
  * Marks the cronjobs as run, so that the user doesn't get an error during the first day.
  * 
  * This is necessary because if the user sets up the system and enters the cronjobs, there is a chance
  * that no cronjob has been ran when he logs in the first time and thus gets confused.
  */
 public function markCronjobsAsRun()
 {
     foreach (PartKeepr::getRequiredCronjobs() as $cronjob) {
         CronLoggerManager::getInstance()->markCronRun($cronjob);
     }
 }
開發者ID:JohnEffland,項目名稱:PartKeepr,代碼行數:12,代碼來源:MiscSettingsSetup.php


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