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


PHP OX_OperationInterval::checkOperationIntervalValue方法代码示例

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


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

示例1: run

 /**
  * A method to run maintenance.
  */
 function run()
 {
     // Print a blank line in the debug log file when maintenance starts
     OA::debug();
     // Do not run if distributed stats are enabled
     if (!empty($this->aConf['lb']['enabled'])) {
         OA::debug('Distributed stats enabled, not running maintenance tasks', PEAR_LOG_INFO);
         return;
     }
     // Acquire the maintenance lock
     $oLock =& OA_DB_AdvisoryLock::factory();
     if ($oLock->get(OA_DB_ADVISORYLOCK_MAINTENANCE)) {
         OA::switchLogIdent('maintenance');
         OA::debug();
         OA::debug('Running Maintenance Engine', PEAR_LOG_INFO);
         // Attempt to increase PHP memory
         OX_increaseMemoryLimit(OX_getMinimumRequiredMemory('maintenance'));
         // Set UTC timezone
         OA_setTimeZoneUTC();
         // Get last run
         $oLastRun = $this->getLastRun();
         // Update the timestamp for old maintenance code and auto-maintenance
         $this->updateLastRun();
         // Record the current time, and register with the OA_ServiceLocator
         $oDate = new Date();
         $oServiceLocator =& OA_ServiceLocator::instance();
         $oServiceLocator->register('now', $oDate);
         // Check the operation interval is valid
         $result = OX_OperationInterval::checkOperationIntervalValue($this->aConf['maintenance']['operationInterval']);
         if (PEAR::isError($result)) {
             // Unable to continue!
             $oLock->release();
             OA::debug('Aborting maintenance: Invalid Operation Interval length', PEAR_LOG_CRIT);
             exit;
         }
         // Run the Maintenance Statistics Engine (MSE) process
         $this->_runMSE();
         // Run the "midnight" tasks, if required
         if ($this->isMidnightMaintenance($oLastRun)) {
             $this->_runMidnightTasks();
         }
         // Release lock before starting MPE
         $oLock->release();
         // Run the Maintenance Priority Engine (MPE) process, ensuring that the
         // process always runs, even if instant update of priorities is disabled
         $this->_runMPE();
         // Log the completion of the entire ME process
         OA::switchLogIdent('maintenance');
         $oEndDate = new Date();
         $oDateSpan = new Date_Span();
         $oDateSpan->setFromDateDiff($oDate, $oEndDate);
         OA::debug('Maintenance Engine Completed (Started at ' . $oDate->format('%Y-%m-%d %H:%M:%S') . ' ' . $oDate->tz->getShortName() . ', taking ' . $oDateSpan->format('%H:%M:%S') . ')', PEAR_LOG_INFO);
         OA::switchLogIdent();
     } else {
         OA::switchLogIdent('maintenance');
         OA::debug('Maintenance Engine not run: could not acquire lock', PEAR_LOG_INFO);
         OA::switchLogIdent();
     }
 }
开发者ID:Apeplazas,项目名称:plazadelatecnologia,代码行数:62,代码来源:Maintenance.php

示例2: testCheckOperationIntervalValue

 /**
  * A method to test the checkOperationIntervalValue() method.
  *
  */
 function testCheckOperationIntervalValue()
 {
     OA::disableErrorHandling();
     for ($i = -1; $i <= 61; $i++) {
         $result = OX_OperationInterval::checkOperationIntervalValue($i);
         if ($i == 1 || $i == 2 || $i == 3 || $i == 4 || $i == 5 || $i == 6 || $i == 10 || $i == 12 || $i == 15 || $i == 20 || $i == 30 || $i == 60) {
             $this->assertTrue($result);
         } else {
             $this->assertTrue(PEAR::isError($result));
         }
         $result = OX_OperationInterval::checkOperationIntervalValue(120);
         $this->assertTrue(PEAR::isError($result));
     }
     OA::enableErrorHandling();
 }
开发者ID:Jaree,项目名称:revive-adserver,代码行数:19,代码来源:OperationInterval.mtc.test.php

示例3: Date

require_once OX_PATH . '/lib/pear/Date.php';
// Standard messages
$haltMessage = "\nThe {$scriptName} script will NOT be run.\n\n";
if ($argc !== 2) {
    echo "\nRequires the hostname to be passed in as a string, as per the standard maintenance CLI script.\n";
    echo $haltMessage;
    exit;
}
if (!defined('INTERVAL_START') || !defined('INTERVAL_END')) {
    echo "\nPlease ensure that you have read the comments in the {$scriptName} script.\n\nYou will also find out how to make this script work by reading the comments. :-)\n";
    echo $haltMessage;
    exit;
}
// Initialise the script
RV::disableErrorHandling();
$result = OX_OperationInterval::checkOperationIntervalValue(OX_OperationInterval::getOperationInterval());
RV::enableErrorHandling();
if (PEAR::isError($result)) {
    $message = "\nThe operation interval in your OpenX configuration file is not valid. Please see the OpenX\ndocumentation for more details on valid operation interval values.\n";
    echo $message;
    echo $haltMessage;
    exit;
}
$oStartDate = new Date(INTERVAL_START);
$result = OX_OperationInterval::checkDateIsStartDate($oStartDate);
if (!$result) {
    $message = "\nThe start date defined in the {$scriptName} script is not a valid operation interval start date.\nPlease edit the statisticsTestAndCorrect.php script before running.\n";
    echo $message;
    echo $haltMessage;
    exit;
}
开发者ID:akirsch,项目名称:revive-adserver,代码行数:31,代码来源:migrateBucketData.php


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