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


PHP OA::switchLogIdent方法代码示例

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


在下文中一共展示了OA::switchLogIdent方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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
         $runSync = false;
         if ($this->isMidnightMaintenance($oLastRun)) {
             $this->_runMidnightTasks();
             $runSync = true;
         }
         // 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();
         // Run the Revive Adserver Sync process, to get details of any updates
         // to Revive Adserver, if the process is due to be run (because the
         // "midnight" tasks were triggered); this happens as the very last
         // thing to ensure that network issues or timeouts with the sync server
         // don't affect the normal running of the MSE & MPE, which are important
         // to have run properly!
         if ($runSync) {
             $this->_runReviveSync();
         }
     } else {
         OA::switchLogIdent('maintenance');
         OA::debug('Maintenance Engine not run: could not acquire lock', PEAR_LOG_INFO);
         OA::switchLogIdent();
     }
 }
开发者ID:ballistiq,项目名称:revive-adserver,代码行数:73,代码来源:Maintenance.php

示例2: run

 /**
  * The method to run the Maintenance Statistics Engine process.
  *
  * @static
  */
 function run()
 {
     OA::switchLogIdent('maintenance');
     // Get the configuration
     $aConf = $GLOBALS['_MAX']['CONF'];
     // Log the start of the process
     OA::debug('Running Maintenance Statistics Engine', PEAR_LOG_INFO);
     // Set longer time out, and ignore user abort
     if (!ini_get('safe_mode')) {
         @set_time_limit($aConf['maintenance']['timeLimitScripts']);
         @ignore_user_abort(true);
     }
     // Run the following code as the "Maintenance" user
     OA_Permission::switchToSystemProcessUser('Maintenance');
     // Ensure the the current time is registered with the OA_ServiceLocator
     $oServiceLocator =& OA_ServiceLocator::instance();
     $oDate =& $oServiceLocator->get('now');
     if (!$oDate) {
         // Record the current time, and register with the OA_ServiceLocator
         $oDate = new Date();
         $oServiceLocator->register('now', $oDate);
     }
     $this->aComponents = OX_Component::getListOfRegisteredComponentsForHook('addMaintenanceStatisticsTask');
     // addMaintenanceStatisticsTask hook
     if (!empty($this->aComponents) && is_array($this->aComponents)) {
         foreach ($this->aComponents as $componentId) {
             if ($obj = OX_Component::factoryByComponentIdentifier($componentId)) {
                 $obj->beforeMse();
             }
         }
     }
     // Initialise the task runner object, for storing/running the tasks
     $this->oTaskRunner = new OA_Task_Runner();
     // Register this object as the controlling class for the process,
     // so that tasks run by the task runner can locate this class to
     // update the report, etc.
     $oServiceLocator =& OA_ServiceLocator::instance();
     $oServiceLocator->register('Maintenance_Statistics_Controller', $this);
     // Create and register an instance of the OA_Dal_Maintenance_Statistics DAL
     // class for the following tasks to use
     if (!$oServiceLocator->get('OX_Dal_Maintenance_Statistics')) {
         $oFactory = new OX_Dal_Maintenance_Statistics_Factory();
         $oDal = $oFactory->factory();
         $oServiceLocator->register('OX_Dal_Maintenance_Statistics', $oDal);
     }
     // Add the task to set the update requirements
     $oSetUpdateRequirements = new OX_Maintenance_Statistics_Task_SetUpdateRequirements();
     $this->oTaskRunner->addTask($oSetUpdateRequirements);
     // Add the task to migrate the bucket data into the statistics tables
     $oSummariseIntermediate = new OX_Maintenance_Statistics_Task_MigrateBucketData();
     $this->oTaskRunner->addTask($oSummariseIntermediate);
     // Add the task to handle the de-duplication and rejection of empty conversions
     $oDeDuplicateConversions = new OX_Maintenance_Statistics_Task_DeDuplicateConversions();
     $this->oTaskRunner->addTask($oDeDuplicateConversions);
     // Add the task to handle the updating of "intermediate" statistics with
     // conversion information, as a legacy issue until all code obtains
     // conversion data from the standard conversion statistics tables
     $oManageConversions = new OX_Maintenance_Statistics_Task_ManageConversions();
     $this->oTaskRunner->addTask($oManageConversions);
     // Add the task to summarise the intermediate statistics into final form
     $oSummariseFinal = new OX_Maintenance_Statistics_Task_SummariseFinal();
     $this->oTaskRunner->addTask($oSummariseFinal);
     // Add the task to log the completion of the task
     $oLogCompletion = new OX_Maintenance_Statistics_Task_LogCompletion();
     $this->oTaskRunner->addTask($oLogCompletion);
     // Add the task to manage (enable/disable) campaigns
     $oManageCampaigns = new OX_Maintenance_Statistics_Task_ManageCampaigns();
     $this->oTaskRunner->addTask($oManageCampaigns);
     // addMaintenanceStatisticsTask hook
     if (!empty($this->aComponents) && is_array($this->aComponents)) {
         foreach ($this->aComponents as $componentId) {
             if ($obj = OX_Component::factoryByComponentIdentifier($componentId)) {
                 $this->oTaskRunner->addTask($obj->addMaintenanceStatisticsTask(), $obj->getExistingClassName(), $obj->getOrder());
             }
         }
     }
     // Run the MSE process tasks
     $this->oTaskRunner->runTasks();
     // addMaintenanceStatisticsTask hook
     if (!empty($this->aComponents) && is_array($this->aComponents)) {
         foreach ($this->aComponents as $componentId) {
             if ($obj = OX_Component::factoryByComponentIdentifier($componentId)) {
                 $obj->afterMse();
             }
         }
     }
     // Return to the "normal" user
     OA_Permission::switchToSystemProcessUser();
     // Log the end of the process
     OA::debug('Maintenance Statistics Engine Completed (Started at ' . $oDate->format('%Y-%m-%d %H:%M:%S') . ' ' . $oDate->tz->getShortName() . ')', PEAR_LOG_INFO);
     OA::switchLogIdent();
 }
开发者ID:akirsch,项目名称:revive-adserver,代码行数:97,代码来源:Statistics.php

示例3: run

 /**
  * The method to run the Maintenance Priority Engine process.
  *
  * @static
  * @param boolean $alwaysRun Default value is false. If true, the Maintenance
  *                           Priority Engine process will always run, even if
  *                           instant priority updates have been disabled in the
  *                           configuration. Used to ensure that the maintenance
  *                           script process can always update priorities.
  * @return boolean True on MPE running correctly, false otherwise.
  */
 function run($alwaysRun = false)
 {
     OA::switchLogIdent('maintenance');
     // Get the configuration
     $aConf = $GLOBALS['_MAX']['CONF'];
     // Should the MPE process run?
     if (!$alwaysRun) {
         // Is instant update for priority set?
         if (!$aConf['priority']['instantUpdate']) {
             OA::debug('Instant update of priorities disabled, not running MPE', PEAR_LOG_INFO);
             return false;
         }
         OA::debug();
     }
     // Log the start of the process
     OA::debug('Running Maintenance Priority Engine', PEAR_LOG_INFO);
     // Set longer time out, and ignore user abort
     if (!ini_get('safe_mode')) {
         @set_time_limit($aConf['maintenance']['timeLimitScripts']);
         @ignore_user_abort(true);
     }
     // Attempt to increase PHP memory
     OX_increaseMemoryLimit(OX_getMinimumRequiredMemory('maintenance'));
     // Run the following code as the "Maintenance" user
     OA_Permission::switchToSystemProcessUser('Maintenance');
     // Create a Maintenance DAL object
     $oDal = new OA_Dal_Maintenance_Priority();
     // Try to get the MPE database-level lock
     $lock = $oDal->obtainPriorityLock();
     if (!$lock) {
         OA::debug('Unable to obtain database-level lock, not running MPE', PEAR_LOG_ERR);
         return false;
     }
     // Ensure the the current time is registered with the OA_ServiceLocator
     $oServiceLocator =& OA_ServiceLocator::instance();
     $oDate =& $oServiceLocator->get('now');
     if (!$oDate) {
         // Record the current time, and register with the OA_ServiceLocator
         $oDate = new Date();
         $oServiceLocator->register('now', $oDate);
     }
     // Run the MPE process for the AdServer module
     require_once MAX_PATH . '/lib/OA/Maintenance/Priority/AdServer.php';
     $oMaintenancePriority = new OA_Maintenance_Priority_AdServer();
     // TODO: OA_Maintenance_Priority_AdServer::updatePriorities
     //       should be refactored to return a boolean we can check here.
     $oMaintenancePriority->updatePriorities();
     // Release the MPE database-level lock
     $result = $oDal->releasePriorityLock();
     if (PEAR::isError($result)) {
         // Unable to continue!
         OA::debug('Unable to release database-level lock', PEAR_LOG_ERR);
         return false;
     }
     // Return to the "normal" user
     OA_Permission::switchToSystemProcessUser();
     // Log the end of the process
     OA::debug('Maintenance Priority Engine Completed (Started at ' . $oDate->format('%Y-%m-%d %H:%M:%S') . ' ' . $oDate->tz->getShortName() . ')', PEAR_LOG_INFO);
     OA::switchLogIdent();
     return true;
 }
开发者ID:akirsch,项目名称:revive-adserver,代码行数:72,代码来源:Priority.php

示例4: _switchToDefaultLog

 function _switchToDefaultLog()
 {
     $this->pluginLogSwitchCounter--;
     if ($this->pluginLogSwitchCounter == 0) {
         OA::switchLogIdent();
     }
 }
开发者ID:ballistiq,项目名称:revive-adserver,代码行数:7,代码来源:PluginManager.php

示例5: define

    define('E_DEPRECATED', 0);
}
setupServerVariables();
setupDeliveryConfigVariables();
$conf = $GLOBALS['_MAX']['CONF'];
// Set this script's identifier (from the config file) in the global scope
$GLOBALS['_OA']['invocationType'] = array_search(basename($_SERVER['SCRIPT_FILENAME']), $conf['file']);
// Disable all notices and warnings,
// as some PAN code still generates PHP warnings in places
if (!empty($conf['debug']['production'])) {
    error_reporting(E_ALL ^ E_NOTICE ^ E_WARNING ^ E_DEPRECATED);
} else {
    // show all errors when developing
    error_reporting(E_ALL ^ E_DEPRECATED);
}
require_once MAX_PATH . '/lib/max/Delivery/common.php';
require_once MAX_PATH . '/lib/max/Delivery/cache.php';
###START_STRIP_DELIVERY
require_once MAX_PATH . '/lib/OA.php';
OA::switchLogIdent('delivery');
###END_STRIP_DELIVERY
// Set the viewer's remote information used in logging and delivery limitation evaluation
MAX_remotehostSetInfo();
// Set common delivery parameters in the global scope
MAX_commonInitVariables();
// Load cookie data from client/plugin
MAX_cookieLoad();
// Unpack the packed capping cookies
MAX_cookieUnpackCapping();
// Run any plugins which have registered themselves at postInit
OX_Delivery_Common_hook('postInit');
开发者ID:villos,项目名称:tree_admin,代码行数:31,代码来源:init-delivery.php


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