当前位置: 首页>>代码示例>>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;未经允许,请勿转载。