本文整理汇总了PHP中OA_Dal_Delivery_getMaintenanceInfo函数的典型用法代码示例。如果您正苦于以下问题:PHP OA_Dal_Delivery_getMaintenanceInfo函数的具体用法?PHP OA_Dal_Delivery_getMaintenanceInfo怎么用?PHP OA_Dal_Delivery_getMaintenanceInfo使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了OA_Dal_Delivery_getMaintenanceInfo函数的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: MAX_cacheCheckIfMaintenanceShouldRun
function MAX_cacheCheckIfMaintenanceShouldRun($cached = true)
{
$interval = $GLOBALS['_MAX']['CONF']['maintenance']['operationInterval'] * 60;
$delay = intval($GLOBALS['_MAX']['CONF']['maintenance']['operationInterval'] / 12 * 60);
$now = MAX_commonGetTimeNow();
$today = strtotime(date('Y-m-d'), $now);
$nextRunTime = $today + (floor(($now - $today) / $interval) + 1) * $interval + $delay;
if ($nextRunTime - $now > $interval) {
$nextRunTime -= $interval;
}
$cName = OA_Delivery_Cache_getName(__FUNCTION__);
if (!$cached || ($lastRunTime = OA_Delivery_Cache_fetch($cName)) === false) {
MAX_Dal_Delivery_Include();
$lastRunTime = OA_Dal_Delivery_getMaintenanceInfo();
if ($lastRunTime >= $nextRunTime - $delay) {
$nextRunTime += $interval;
}
OA_Delivery_Cache_store($cName, $lastRunTime, false, $nextRunTime);
}
return $lastRunTime < $nextRunTime - $interval;
}
示例2: MAX_cacheCheckIfMaintenanceShouldRun
/**
* Check if maintenance should run using cached information
*
* This function gets maintenance's last run info
*
* @param boolean $cached Should a cache lookup be performed?
* @return array The array of tracker properties
*/
function MAX_cacheCheckIfMaintenanceShouldRun($cached = true)
{
// Default delay is 5 minutes
$interval = $GLOBALS['_MAX']['CONF']['maintenance']['operationInterval'] * 60;
$delay = intval($GLOBALS['_MAX']['CONF']['maintenance']['operationInterval'] / 12 * 60);
$now = MAX_commonGetTimeNow();
$today = strtotime(date('Y-m-d'), $now);
$nextRunTime = $today + (floor(($now - $today) / $interval) + 1) * $interval + $delay;
// Adding the delay could shift the time to the next operation interval,
// make sure to fix it in case it happens
if ($nextRunTime - $now > $interval) {
$nextRunTime -= $interval;
}
$cName = OA_Delivery_Cache_getName(__FUNCTION__);
if (!$cached || ($lastRunTime = OA_Delivery_Cache_fetch($cName)) === false) {
MAX_Dal_Delivery_Include();
$lastRunTime = OA_Dal_Delivery_getMaintenanceInfo();
// Cache until the next operation interval if scheduled maintenance was run
// during the delay
if ($lastRunTime >= $nextRunTime - $delay) {
$nextRunTime += $interval;
}
OA_Delivery_Cache_store($cName, $lastRunTime, false, $nextRunTime);
}
return $lastRunTime < $nextRunTime - $interval;
}