• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP OA_ServiceLocator类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了PHP中OA_ServiceLocator的典型用法代码示例。如果您正苦于以下问题:PHP OA_ServiceLocator类的具体用法?PHP OA_ServiceLocator怎么用?PHP OA_ServiceLocator使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



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

示例1: __construct

 function __construct()
 {
     // Check auto-maintenance settings
     $aConf = $GLOBALS['_MAX']['CONF'];
     $this->isAutoMaintenanceEnabled = !empty($aConf['maintenance']['autoMaintenance']);
     // Get time 1 hour ago
     $oServiceLocator =& OA_ServiceLocator::instance();
     $oNow = $oServiceLocator->get('now');
     if ($oNow) {
         $oOneHourAgo = new Date($oNow);
     } else {
         $oOneHourAgo = new Date();
     }
     $oOneHourAgo->subtractSpan(new Date_Span('0-1-0-0'));
     // Get last runs
     $oLastCronRun = OX_Maintenance::getLastScheduledRun();
     $oLastRun = OX_Maintenance::getLastRun();
     // Reset minutes and seconds
     if (isset($oLastCronRun)) {
         $oLastCronRun->setMinute(0);
         $oLastCronRun->setSecond(0);
     }
     if (isset($oLastRun)) {
         $oLastRun->setMinute(0);
         $oLastRun->setSecond(0);
     }
     // Check if any kind of maintenance was run
     if (isset($oLastCronRun) && !$oOneHourAgo->after($oLastCronRun)) {
         $this->isScheduledMaintenanceRunning = true;
     } elseif (isset($oLastRun) && !$oOneHourAgo->after($oLastRun)) {
         $this->isAutoMaintenanceRunning = true;
     }
 }
开发者ID:Spark-Eleven,项目名称:revive-adserver,代码行数:33,代码来源:Status.php


示例2: Date

 /**
  * A method to get the "now" date class, eventually subtracting
  * some time
  *
  * @param int $subtractSeconds
  * @return Date
  */
 function &getDate($subtractSeconds = 0)
 {
     $oServiceLocator =& OA_ServiceLocator::instance();
     $oNow = new Date($oServiceLocator->get('now'));
     if ($subtractSeconds) {
         $oNow->subtractSeconds($subtractSeconds);
     }
     return $oNow;
 }
开发者ID:hostinger,项目名称:revive-adserver,代码行数:16,代码来源:Status.mtc.test.php


示例3: _useDefaultDal

 function _useDefaultDal()
 {
     $oServiceLocator =& OA_ServiceLocator::instance();
     $dal =& $oServiceLocator->get('MAX_Dal_Inventory_Trackers');
     if (!$dal) {
         $dal = new MAX_Dal_Inventory_Trackers();
     }
     $this->_dal =& $dal;
 }
开发者ID:akirsch,项目名称:revive-adserver,代码行数:9,代码来源:TrackerAppend.php


示例4: _useDefaultDal

 function _useDefaultDal()
 {
     $oServiceLocator =& OA_ServiceLocator::instance();
     $dal =& $oServiceLocator->get('OA_Dal_PasswordRecovery');
     if (!$dal) {
         $dal = new OA_Dal_PasswordRecovery();
     }
     $this->_dal =& $dal;
 }
开发者ID:ballistiq,项目名称:revive-adserver,代码行数:9,代码来源:PasswordRecovery.php


示例5: _saveSummary

 /**
  * A private method for summarising data into the final tables when
  * at least one hour is complete.
  *
  * @access private
  * @param PEAR::Date $oStartDate The start date of the complete hour(s).
  * @param PEAR::Date $oEndDate The end date of the complete hour(s).
  */
 function _saveSummary($oStartDate, $oEndDate)
 {
     $message = '- Updating the data_summary_ad_hourly table for data after ' . $oStartDate->format('%Y-%m-%d %H:%M:%S') . ' ' . $oStartDate->tz->getShortName();
     $this->oController->report .= $message . ".\n";
     OA::debug($message, PEAR_LOG_DEBUG);
     $oServiceLocator =& OA_ServiceLocator::instance();
     $oDal =& $oServiceLocator->get('OX_Dal_Maintenance_Statistics');
     $aTypes = array('types' => array(0 => 'request', 1 => 'impression', 2 => 'click'), 'connections' => array(1 => MAX_CONNECTION_AD_IMPRESSION, 2 => MAX_CONNECTION_AD_CLICK));
     $oDal->saveSummary($oStartDate, $oEndDate, $aTypes, 'data_intermediate_ad', 'data_summary_ad_hourly');
 }
开发者ID:akirsch,项目名称:revive-adserver,代码行数:18,代码来源:SummariseFinal.php


示例6: testRunnerHasResources

 function testRunnerHasResources()
 {
     // Mock the OA_Dal_Maintenance_Priority class used in the constructor method
     $oDal = new MockOA_Dal_Maintenance_Priority($this);
     $oServiceLocator =& OA_ServiceLocator::instance();
     $oServiceLocator->register('OA_Dal_Maintenance_Priority', $oDal);
     $task = new OA_Maintenance_Priority_AdServer_Task();
     $this->assertTrue(is_object($task->oDal));
     $this->assertTrue(is_a($task->oDal, 'MockOA_Dal_Maintenance_Priority'));
 }
开发者ID:ballistiq,项目名称:revive-adserver,代码行数:10,代码来源:Task.mtp.test.php


示例7: strtolower

 /**
  * Method to create/register/return the Maintenance Priority table class.
  *
  * @access private
  * @return OA_DB_Table_Priority
  */
 function &_getMaxTablePriorityObj()
 {
     $dbType = strtolower($GLOBALS['_MAX']['CONF']['database']['type']);
     $oServiceLocator =& OA_ServiceLocator::instance();
     $oTable = $oServiceLocator->get('OA_DB_Table_Priority');
     if (!$oTable) {
         $oTable =& OA_DB_Table_Priority::singleton();
         $oServiceLocator->register('OA_DB_Table_Priority', $oTable);
     }
     return $oTable;
 }
开发者ID:villos,项目名称:tree_admin,代码行数:17,代码来源:Task.php


示例8: run

 /**
  * The implementation of the OA_Task::run() method that performs
  * the required task of activating/deactivating campaigns.
  */
 function run()
 {
     if ($this->oController->updateIntermediate) {
         $oServiceLocator =& OA_ServiceLocator::instance();
         $oDate =& $oServiceLocator->get('now');
         $oDal =& $oServiceLocator->get('OX_Dal_Maintenance_Statistics');
         $message = '- Managing (activating/deactivating) campaigns';
         $this->oController->report .= "{$message}.\n";
         OA::debug($message);
         $this->report .= $oDal->manageCampaigns($oDate);
     }
 }
开发者ID:ballistiq,项目名称:revive-adserver,代码行数:16,代码来源:ManageCampaigns.php


示例9: testRun

 /**
  * A method to test the run() method.
  */
 function testRun()
 {
     $oServiceLocator =& OA_ServiceLocator::instance();
     $aConf =& $GLOBALS['_MAX']['CONF'];
     $className = 'OX_Dal_Maintenance_Statistics_' . ucfirst(strtolower($aConf['database']['type']));
     $mockClassName = 'MockOX_Dal_Maintenance_Statistics_' . ucfirst(strtolower($aConf['database']['type']));
     $aConf['maintenance']['operationInterval'] = 60;
     // Test 1: Test with the bucket data not having been migrated,
     //         and ensure that the DAL calls to de-duplicate and
     //         reject conversions are not made
     // Set the controller class
     $oMaintenanceStatistics = new OX_Maintenance_Statistics();
     $oServiceLocator->register('Maintenance_Statistics_Controller', $oMaintenanceStatistics);
     // Mock the MSE DAL used to de-duplicate conversions,
     // and set the expectations of the calls to the DAL
     Mock::generate($className);
     $oDal = new $mockClassName($this);
     $oDal->expectNever('deduplicateConversions');
     $oDal->expectNever('rejectEmptyVarConversions');
     $oDal->OX_Dal_Maintenance_Statistics();
     $oServiceLocator->register('OX_Dal_Maintenance_Statistics', $oDal);
     // Set the controlling class' status and test
     $oDeDuplicateConversions = new OX_Maintenance_Statistics_Task_DeDuplicateConversions();
     $oDeDuplicateConversions->oController->updateIntermediate = false;
     $oDeDuplicateConversions->run();
     $oDal->tally();
     // Test 2: Test with the bucket data having been migrated, and
     //         ensure that the DALL calls to de-duplicate and reject
     //         conversions are made correctly
     // Set the controller class
     $oMaintenanceStatistics = new OX_Maintenance_Statistics();
     $oServiceLocator->register('Maintenance_Statistics_Controller', $oMaintenanceStatistics);
     // Mock the MSE DAL used to de-duplicate conversions,
     // and set the expectations of the calls to the DAL
     Mock::generate($className);
     $oDal = new $mockClassName($this);
     $oDate = new Date('2008-09-08 16:59:59');
     $oDate->addSeconds(1);
     $oDal->expectOnce('deduplicateConversions', array($oDate, new Date('2008-09-08 17:59:59')));
     $oDal->expectOnce('rejectEmptyVarConversions', array($oDate, new Date('2008-09-08 17:59:59')));
     $oDal->OX_Dal_Maintenance_Statistics();
     $oServiceLocator->register('OX_Dal_Maintenance_Statistics', $oDal);
     // Set the controlling class' status and test
     $oDeDuplicateConversions = new OX_Maintenance_Statistics_Task_DeDuplicateConversions();
     $oDeDuplicateConversions->oController->updateIntermediate = true;
     $oDeDuplicateConversions->oController->oLastDateIntermediate = new Date('2008-09-08 16:59:59');
     $oDeDuplicateConversions->oController->oUpdateIntermediateToDate = new Date('2008-09-08 17:59:59');
     $oDeDuplicateConversions->run();
     $oDal->tally();
     TestEnv::restoreConfig();
 }
开发者ID:ballistiq,项目名称:revive-adserver,代码行数:54,代码来源:DeduplicateConversions.mtsdb.test.php


示例10: run

 /**
  * The implementation of the OA_Task::run() method that performs
  * the required task of managing conversions.
  */
 function run()
 {
     if ($this->oController->updateIntermediate) {
         // Preapre the start date for the management of conversions
         $oStartDate = new Date();
         $oStartDate->copy($this->oController->oLastDateIntermediate);
         $oStartDate->addSeconds(1);
         // Get the MSE DAL to perform the conversion management
         $oServiceLocator =& OA_ServiceLocator::instance();
         $oDal =& $oServiceLocator->get('OX_Dal_Maintenance_Statistics');
         // Manage conversions
         $oDal->manageConversions($oStartDate, $this->oController->oUpdateIntermediateToDate);
     }
 }
开发者ID:hostinger,项目名称:revive-adserver,代码行数:18,代码来源:ManageConversions.php


示例11: run

 /**
  * The main method of the class, that is run by the controlling
  * task runner class.
  */
 function run()
 {
     OA::debug('Running Maintenance Priority Engine: Priority Compensation', PEAR_LOG_DEBUG);
     // Record the start of this Priority Compensation run
     $oStartDate = new Date();
     // Prepare an array for the priority results
     $aPriorities = array();
     // Get the details of the last time Priority Compensation started running
     $aDates = $this->oDal->getMaintenancePriorityLastRunInfo(DAL_PRIORITY_UPDATE_PRIORITY_COMPENSATION, array('start_run', 'end_run'));
     if (!is_null($aDates)) {
         // Set the details of the last time Priority Compensation started running
         $this->aLastRun['start_run'] = new Date($aDates['start_run']);
         // Set the details of the current date/time
         $oServiceLocator =& OA_ServiceLocator::instance();
         $this->aLastRun['now'] =& $oServiceLocator->get('now');
     }
     // Get all creative/zone information
     $aZones =& $this->_buildClasses();
     // For every zone with creatives linked to it...
     if (!empty($aZones)) {
         $this->globalMessage = '';
         OA::debug('- Calculating priority values for creative/zone pairs', PEAR_LOG_DEBUG);
         foreach ($aZones as $oZone) {
             // Is this Zone ID 0, the Direct Selection zone?
             if ($oZone->id == 0) {
                 // Calculate simplistic priorities based on the required impression
                 // values without any form of priority compensation based on past
                 // information about previous priorities, as this is the Direct
                 // Selection zone, and priority compensation adjustment is not required
                 OA::debug('  - Calculating priority values for creatives in Zone ID ' . $oZone->id . ': Basic', PEAR_LOG_DEBUG);
                 $aPriorities[$oZone->id] = $this->initialPriorities($oZone);
             } else {
                 // Calculate the priorities based on the required impression
                 // values and the past information about previous priorities
                 OA::debug('  - Calculating priority values for creatives in Zone ID ' . $oZone->id . ': Compensated', PEAR_LOG_DEBUG);
                 $aPriorities[$oZone->id] = $this->compensatedPriorities($oZone);
             }
         }
         // Store the calculated priorities
         $this->oDal->updatePriorities($aPriorities);
         // Record the completion of the task in the database; note that the $oUpdateTo
         // parameter is "null", as this value is not appropriate when recording Priority
         // Compensation task runs - all that matters are the start and end dates
         OA::debug('- Recording completion of the Priority Compensation task', PEAR_LOG_DEBUG);
         $oEndDate = new Date();
         $this->oDal->setMaintenancePriorityLastRunInfo($oStartDate, $oEndDate, null, DAL_PRIORITY_UPDATE_PRIORITY_COMPENSATION);
     }
 }
开发者ID:ballistiq,项目名称:revive-adserver,代码行数:52,代码来源:PriorityCompensation.php


示例12: run

 /**
  * The implementation of the OA_Task::run() method that performs
  * the required task of de-duplicating and rejecting conversions.
  */
 function run()
 {
     if ($this->oController->updateIntermediate) {
         // Preapre the start date for the de-duplication/rejection
         $oStartDate = new Date();
         $oStartDate->copy($this->oController->oLastDateIntermediate);
         $oStartDate->addSeconds(1);
         // Get the MSE DAL to perform the de-duplication
         $oServiceLocator =& OA_ServiceLocator::instance();
         $oDal =& $oServiceLocator->get('OX_Dal_Maintenance_Statistics');
         // De-duplicate conversions
         $oDal->deduplicateConversions($oStartDate, $this->oController->oUpdateIntermediateToDate);
         // Reject empty variable conversions
         $oDal->rejectEmptyVarConversions($oStartDate, $this->oController->oUpdateIntermediateToDate);
     }
 }
开发者ID:akirsch,项目名称:revive-adserver,代码行数:20,代码来源:DeduplicateConversions.php


示例13: run

 /**
  * A method to run distributed maintenance.
  */
 function run()
 {
     if (empty($GLOBALS['_MAX']['CONF']['lb']['enabled'])) {
         OA::debug('Distributed stats disabled, not running Maintenance Distributed Engine', PEAR_LOG_INFO);
         return;
     }
     if (!empty($GLOBALS['_MAX']['CONF']['rawDatabase'])) {
         $GLOBALS['_MAX']['CONF']['database'] = $GLOBALS['_MAX']['CONF']['rawDatabase'] + $GLOBALS['_MAX']['CONF']['database'];
         OA::debug('rawDatabase functionality is being used, switching settings', PEAR_LOG_INFO);
     }
     $oLock =& OA_DB_AdvisoryLock::factory();
     if (!$oLock->get(OA_DB_ADVISORYLOCK_DISTRIBUTED)) {
         OA::debug('Maintenance Distributed Engine Already Running', PEAR_LOG_INFO);
         return;
     }
     OA::debug('Running Maintenance Distributed Engine', PEAR_LOG_INFO);
     // Attempt to increase PHP memory
     OX_increaseMemoryLimit(OX_getMinimumRequiredMemory('maintenance'));
     // Ensure the current time is registered with the OA_ServiceLocator
     $oServiceLocator =& OA_ServiceLocator::instance();
     $oNow =& $oServiceLocator->get('now');
     if (!$oNow) {
         // Record the current time, and register with the OA_ServiceLocator
         $oNow = new Date();
         $oServiceLocator->register('now', $oNow);
     }
     OA::debug(' - Current time is ' . $oNow->format('%Y-%m-%d %H:%M:%S') . ' ' . $oNow->tz->getShortName(), PEAR_LOG_DEBUG);
     // Get the components of the deliveryLog extension
     $aBuckets = OX_Component::getComponents('deliveryLog');
     // Copy buckets' records with "interval_start" up to and including previous OI start,
     // and then prune the data processed
     $aPreviousOperationIntervalDates = OX_OperationInterval::convertDateToPreviousOperationIntervalStartAndEndDates($oNow);
     OA::debug(' - Will process data for all operation intervals before and up to start', PEAR_LOG_DEBUG);
     OA::debug('   time of ' . $aPreviousOperationIntervalDates['start']->format('%Y-%m-%d %H:%M:%S') . ' ' . $aPreviousOperationIntervalDates['start']->tz->getShortName(), PEAR_LOG_DEBUG);
     foreach ($aBuckets as $sBucketName => $oBucketClass) {
         if ($oBucketClass->testStatisticsMigration($oBucketClass->getStatisticsMigration())) {
             $oBucketClass->processBucket($aPreviousOperationIntervalDates['start']);
             $oBucketClass->pruneBucket($aPreviousOperationIntervalDates['start']);
         } else {
             OA::debug('  - Skipping ' . $sBucketName, PEAR_LOG_DEBUG);
         }
     }
     $oLock->release();
     OA::debug('Maintenance Distributed Engine Completed', PEAR_LOG_INFO);
 }
开发者ID:akirsch,项目名称:revive-adserver,代码行数:48,代码来源:Distributed.php


示例14: init

 /**
  * initialisation
  *
  * load the 'requestset' config file
  * do not load the dataset yet - allow child scenario to choose
  *
  * @param string $filename - name of scenario's dataset and config
  * @param string $dbname database name
  */
 function init($filename)
 {
     $GLOBALS['_MAX']['CONF']['table']['prefix'] = '';
     // assign the inputs
     $this->requestFile = SCENARIOS_REQUESTSETS . $filename . '.php';
     // load the request data
     $this->loadRequestset();
     // tweak some conf vals
     $GLOBALS['_MAX']['COOKIE']['newViewerId'] = '';
     $_COOKIE = $HTTP_COOKIE_VARS = array();
     // get service locator instance
     $this->oServiceLocator =& OA_ServiceLocator::instance();
     // start with a clean set of tables
     OA_DB_Table_Core::destroy();
     $this->oCoreTables =& OA_DB_Table_Core::singleton();
     // get the database handler
     $this->oDbh =& OA_DB::singleton();
     // fake the date/time
     $this->setDateTime();
 }
开发者ID:Jaree,项目名称:revive-adserver,代码行数:29,代码来源:SimulationScenario.php


示例15: insertDefaultData

 /**
  * A method to insert the default data into the database.
  *
  * The default data are:
  *
  *  - Test Advertiser 1
  *    - Placement 11
  *      - High Priority
  *      - Daily target of 120 impressions (5 per
  *        hour assuming even delivery each hour)
  *        - Advertisement 111
  *          - Banner Weight 1
  *    - Placement 12
  *      - High Priority
  *      - Runs from 2005-01-01 to 2005-12-31
  *      - Total target of 87,600 (10 per hour
  *        assuming even delivery each hour)
  *        - Advertisement 121
  *          - Banner Weight 2
  *        - Advertisement 122
  *          - Banner Weight 1
  *
  *  - Test Advertiser 2
  *    - Placement 21
  *    - Placement 22
  *
  *  - Test Publisher 1
  *    - Zone 11
  *    - Zone 12
  *
  *  - Test Publisher 2
  *    - Zone 21
  *    - Zone 22
  *
  * - Advertisement 111 is linked to Zone 11
  * - Advertisement 121 is linked to Zone 21
  * - Advertisement 122 is linked to Zone 21 AND Zone 22
  *
  * @static
  * @access public
  * @TODO Complete the specification of the default data and the implementation
  *       of the creation thereof.
  */
 function insertDefaultData()
 {
     $oDbh =& OA_DB::singleton();
     // Set now
     $oServiceLocator =& OA_ServiceLocator::instance();
     $oldNow = $oServiceLocator->get('now');
     $oServiceLocator->register('now', new Date('2005-03-01'));
     // Add a default agency
     $agencyID = Admin_DA::addAgency(array('name' => 'Test Agency', 'contact' => 'Contact Name', 'username' => 'agency', 'email' => '[email protected]', 'active' => 1));
     // Add two advertisers for the agency
     $advertiserOneID = Admin_DA::addAdvertiser(array('agencyid' => $agencyID, 'clientname' => 'Test Advertiser 1', 'contact' => 'Contact Name 1', 'clientusername' => 'advertiser1', 'email' => '[email protected]'));
     $advertiserTwoID = Admin_DA::addAdvertiser(array('agencyid' => $agencyID, 'clientname' => 'Test Advertiser 2', 'contact' => 'Contact Name 2', 'clientusername' => 'advertiser2', 'email' => '[email protected]'));
     // Add the advertiser's placements (campaigns) & advertisements
     $campaignOneOneID = Admin_DA::addPlacement(array('campaignname' => 'Campaign 11 - Manual Daily Target of 120', 'clientid' => $advertiserOneID, 'views' => -1, 'clicks' => -1, 'conversions' => -1, 'status' => OA_ENTITY_STATUS_RUNNING, 'priority' => 2, 'target_impression' => 120, 'target_click' => -1, 'target_conversion' => -1));
     $adOneOneOneID = Admin_DA::addAd(array('campaignid' => $campaignOneOneID, 'description' => 'Advertisement 111', 'active' => 't', 'weight' => 1, 'htmltemplate' => '', 'url' => '', 'bannertext' => '', 'compiledlimitation' => '', 'append' => ''));
     $campaignOneTwoID = Admin_DA::addPlacement(array('campaignname' => 'Campaign 22 - Auto Distribution of 87,600 Impressions', 'clientid' => $advertiserOneID, 'views' => 87600, 'clicks' => -1, 'conversions' => -1, 'status' => OA_ENTITY_STATUS_RUNNING, 'priority' => 2, 'target_impression' => -1, 'target_click' => -1, 'target_conversion' => -1, 'activate_time' => '2005-01-01 00:00:00', 'expire_time' => '2005-12-31 23:59:59'));
     $adOneTwoOneID = Admin_DA::addAd(array('campaignid' => $campaignOneTwoID, 'description' => 'Advertisement 121', 'active' => 't', 'weight' => 2, 'htmltemplate' => '', 'url' => '', 'bannertext' => '', 'compiledlimitation' => '', 'append' => ''));
     $adOneTwoTwoID = Admin_DA::addAd(array('campaignid' => $campaignOneTwoID, 'description' => 'Advertisement 122', 'active' => 't', 'weight' => 1, 'htmltemplate' => '', 'url' => '', 'bannertext' => '', 'compiledlimitation' => '', 'append' => ''));
     // Add two publishers for the agency
     $publisherOneID = Admin_DA::addPublisher(array('agencyid' => $agencyID, 'name' => 'Test Publisher 1', 'contact' => 'Contact Name 1', 'username' => 'publisher1', 'email' => '[email protected]'));
     $publisherTwoID = Admin_DA::addPublisher(array('agencyid' => $agencyID, 'name' => 'Test Publisher 1', 'contact' => 'Contact Name 1', 'username' => 'publisher1', 'email' => '[email protected]'));
     // Add the publisher's zones
     $zoneOneOneID = Admin_DA::addZone(array('affiliateid' => $publisherOneID, 'zonename' => 'Zone 11', 'type' => 0, 'category' => '', 'ad_selection' => '', 'chain' => '', 'prepend' => '', 'append' => '', 'what' => ''));
     $zoneOneTwoID = Admin_DA::addZone(array('affiliateid' => $publisherOneID, 'zonename' => 'Zone 12', 'type' => 0, 'category' => '', 'ad_selection' => '', 'chain' => '', 'prepend' => '', 'append' => '', 'what' => ''));
     $zoneTwoOneID = Admin_DA::addZone(array('affiliateid' => $publisherOneID, 'zonename' => 'Zone 21', 'type' => 0, 'category' => '', 'ad_selection' => '', 'chain' => '', 'prepend' => '', 'append' => '', 'what' => ''));
     $zoneTwoTwoID = Admin_DA::addZone(array('affiliateid' => $publisherOneID, 'zonename' => 'Zone 22', 'type' => 0, 'category' => '', 'ad_selection' => '', 'chain' => '', 'prepend' => '', 'append' => '', 'what' => ''));
     // Link the ads to the zones
     Admin_DA::addAdZone(array('ad_id' => $adOneOneOneID, 'zone_id' => $zoneOneOneID, 'link_type' => 1));
     Admin_DA::addAdZone(array('ad_id' => $adOneTwoOneID, 'zone_id' => $zoneTwoOneID, 'link_type' => 1));
     Admin_DA::addAdZone(array('ad_id' => $adOneTwoTwoID, 'zone_id' => $zoneTwoOneID, 'link_type' => 1));
     Admin_DA::addAdZone(array('ad_id' => $adOneTwoTwoID, 'zone_id' => $zoneTwoTwoID, 'link_type' => 1));
     // Restore "now"
     if ($oldNow) {
         $oServiceLocator->register('now', $oldNow);
     } else {
         $oServiceLocator->remove('now');
     }
 }
开发者ID:ballistiq,项目名称:revive-adserver,代码行数:81,代码来源:DefaultData.php


示例16: testPruneDataSummaryAdZoneAssocOldData

 /**
  * Pruning can be performed where zone_id = 0 (i.e. for direct selection) and where the entry is older than MAX_PREVIOUS_AD_DELIVERY_INFO_LIMIT minutes ago.
  *
  */
 function testPruneDataSummaryAdZoneAssocOldData()
 {
     $oDate = new Date();
     $oServiceLocator =& OA_ServiceLocator::instance();
     $oServiceLocator->register('now', $oDate);
     $oDal = new OA_Maintenance_Pruning();
     $doDSAZA = OA_Dal::factoryDO('data_summary_ad_zone_assoc');
     // Test 1: table is empty : nothing to delete
     $this->assertEqual($this->_countRowsInDSAZA(), 0);
     $this->assertFalse($oDal->_pruneDataSummaryAdZoneAssocOldData());
     // generate 4 records
     $aIds = DataGenerator::generate($doDSAZA, 4);
     $this->assertEqual($this->_countRowsInDSAZA(), 4);
     // Test 2: values are current, zone_id = 1 : nothing to delete
     $this->assertFalse($oDal->_pruneDataSummaryAdZoneAssocOldData());
     $this->assertEqual($this->_countRowsInDSAZA(), 4);
     // Test 3: values are old, zone_id = 1 : should not delete anything
     foreach ($aIds as $k => $id) {
         $oDate->subtractSeconds(MAX_PREVIOUS_AD_DELIVERY_INFO_LIMIT + 100);
         $doDSAZA->data_summary_ad_zone_assoc_id = $id;
         $doDSAZA->find(true);
         $doDSAZA->created = $oDate->getDate();
         $doDSAZA->zone_id = 1;
         $doDSAZA->update();
     }
     $this->assertFalse($oDal->_pruneDataSummaryAdZoneAssocOldData());
     $this->assertEqual($this->_countRowsInDSAZA(), 4);
     // Test 4: values are old, zone_id = 0 : should delete 4 records
     foreach ($aIds as $k => $id) {
         $doDSAZA->data_summary_ad_zone_assoc_id = $id;
         $doDSAZA->find(true);
         $doDSAZA->zone_id = 0;
         $doDSAZA->update();
     }
     $this->assertTrue($oDal->_pruneDataSummaryAdZoneAssocOldData());
     $this->assertEqual($this->_countRowsInDSAZA(), 0);
 }
开发者ID:Jaree,项目名称:revive-adserver,代码行数:41,代码来源:Pruning.mtpdb.test.php


示例17: run

 /**
  * The main method of the class, that is run by the controlling
  * task runner class.
  */
 function run()
 {
     OA::debug('Running Maintenance Priority Engine: Priority Compensation', PEAR_LOG_DEBUG);
     // Record the start of this Priority Compensation run
     $oStartDate = new Date();
     // Prepare an array for the priority results
     $aPriorities = array();
     // Get the details of the last time Priority Compensation started running
     $aDates = $this->oDal->getMaintenancePriorityLastRunInfo(DAL_PRIORITY_UPDATE_PRIORITY_COMPENSATION, array('start_run', 'end_run'));
     if (!is_null($aDates)) {
         // Set the details of the last time Priority Compensation started running
         $this->aLastRun['start_run'] = new Date($aDates['start_run']);
         // Set the details of the current date/time
         $oServiceLocator =& OA_ServiceLocator::instance();
         $this->aLastRun['now'] =& $oServiceLocator->get('now');
     }
     // Get all zone/ad information
     $aZones =& $this->_buildClasses();
     // For every zone with ads linked to it...
     if (!empty($aZones)) {
         $this->globalMessage = '';
         foreach ($aZones as $oZone) {
             // Calculate the priorities based on the required impression
             // values and the past information about previous priorities
             $aPriorities[$oZone->id] = $this->learnedPriorities($oZone);
         }
         // Store the calculated priorities
         $this->oDal->updatePriorities($aPriorities);
         // Record the completion of the task in the database
         // Note that the $oUpdateTo parameter is "null", as this value is not
         // appropriate when recording Priority Compensation task runs - all that
         // matters is the start/end dates.
         OA::debug('- Recording completion of the Priority Compensation task', PEAR_LOG_DEBUG);
         $oEndDate = new Date();
         $this->oDal->setMaintenancePriorityLastRunInfo($oStartDate, $oEndDate, null, DAL_PRIORITY_UPDATE_PRIORITY_COMPENSATION);
     }
 }
开发者ID:villos,项目名称:tree_admin,代码行数:41,代码来源:PriorityCompensation.php


示例18: testRun

 /**
  * A method to test the run() method.
  */
 function testRun()
 {
     $oServiceLocator =& OA_ServiceLocator::instance();
     // Register the current date/time
     $oDateNow = new Date();
     $oServiceLocator->register('now', $oDateNow);
     // Mock the DAL, and set expectations
     Mock::generate('OX_Dal_Maintenance_Statistics');
     $oDal = new MockOX_Dal_Maintenance_Statistics($this);
     $oDal->expectNever('manageCampaigns');
     $oServiceLocator->register('OX_Dal_Maintenance_Statistics', $oDal);
     // Set the controller class
     $oMaintenanceStatistics = new OX_Maintenance_Statistics();
     $oServiceLocator->register('Maintenance_Statistics_Controller', $oMaintenanceStatistics);
     // Test
     $oManageCampaigns = new OX_Maintenance_Statistics_Task_ManageCampaigns();
     $oManageCampaigns->oController->updateIntermediate = false;
     $oManageCampaigns->run();
     $oDal->tally();
     // Register the current date/time
     $oDateNow = new Date();
     $oServiceLocator->register('now', $oDateNow);
     // Mock the DAL, and set expectations
     Mock::generate('OX_Dal_Maintenance_Statistics');
     $oDal = new MockOX_Dal_Maintenance_Statistics($this);
     $oDal->expectOnce('manageCampaigns', array($oDateNow));
     $oServiceLocator->register('OX_Dal_Maintenance_Statistics', $oDal);
     // Set the controller class
     $oMaintenanceStatistics = new OX_Maintenance_Statistics();
     $oServiceLocator->register('Maintenance_Statistics_Controller', $oMaintenanceStatistics);
     // Test
     $oManageCampaigns = new OX_Maintenance_Statistics_Task_ManageCampaigns();
     $oManageCampaigns->oController->updateIntermediate = true;
     $oManageCampaigns->run();
     $oDal->tally();
 }
开发者ID:Spark-Eleven,项目名称:revive-adserver,代码行数:39,代码来源:ManageCampaigns.mtsdb.test.php


示例19: testPreloadZonesAvailableImpressionsForAgency

 /**
  * A method to test the preloadZonesAvailableImpressionsForAgency() method.
  *
  * Requirements
  * Test 1: Test that contracts are correctly calculated based on the forecasts and allocations
  */
 function testPreloadZonesAvailableImpressionsForAgency()
 {
     // Mock the OA_Dal_Maintenance_Priority class used in the constructor method
     $oDal = new $this->mockDal($this);
     $aZonesForecasts = array(1 => 10, 2 => 20, 3 => 50);
     $oDal->setReturnReference('getZonesForecasts', $aZonesForecasts);
     $aZonesAllocations = array(1 => 10, 2 => 30, 4 => 10);
     $oDal->setReturnReference('getZonesAllocationsForEcpmRemnantByAgency', $aZonesAllocations);
     $oServiceLocator =& OA_ServiceLocator::instance();
     $oServiceLocator->register('OA_Dal_Maintenance_Priority', $oDal);
     // Partially mock the OA_Maintenance_Priority_AdServer_Task_ECPMforRemnant class
     $oEcpm = new PartialMock_OA_Maintenance_Priority_AdServer_Task_ECPMforRemnant($this);
     $oEcpm->aOIDates['start'] = $oEcpm->aOIDates['end'] = new Date();
     $oEcpm->setReturnReference('_getDal', $oDal);
     $oEcpm->OA_Maintenance_Priority_AdServer_Task();
     // Test
     $aZonesExpectedContracts = array(1 => 0, 2 => 0, 3 => 50);
     $dataJustLoaded = $oEcpm->preloadZonesAvailableImpressionsForAgency(123);
     $this->assertEqual($aZonesExpectedContracts, $oEcpm->aZonesAvailableImpressions);
     $this->assertTrue($dataJustLoaded);
     $dataJustLoaded = $oEcpm->preloadZonesAvailableImpressionsForAgency(152);
     $this->assertEqual($aZonesExpectedContracts, $oEcpm->aZonesAvailableImpressions);
     $this->assertFalse($dataJustLoaded);
 }
开发者ID:ballistiq,项目名称:revive-adserver,代码行数:30,代码来源:ECPMforRemnant.mtp.test.php


示例20: testSetSummaryStatisticsToday

 /**
  * A method to test the setSummaryStatisticsToday() method.
  *
  * Requirements:
  * Test 1: Test with no delivery today in the database, and ensure that
  *         zero is set for all delivery values.
  * Test 2: Test with delivery today in the database, and ensure the values
  *         are correctly stored.
  */
 function testSetSummaryStatisticsToday()
 {
     $aCampaignStats = array('advertiser_id' => 1, 'campaign_id' => 1, 'name' => 'Campaign Name', 'active' => 't', 'num_children' => 1, 'sum_requests' => 100, 'sum_views' => 99, 'sum_clicks' => 5, 'sum_conversions' => 1);
     $oServiceLocator =& OA_ServiceLocator::instance();
     $oMaxDalMaintenancePriority =& $oServiceLocator->get('OA_Dal_Maintenance_Priority');
     $oMaxDalMaintenancePriority->setReturnValueAt(0, 'getCampaignStats', null);
     $oMaxDalMaintenancePriority->setReturnValueAt(1, 'getCampaignStats', $aCampaignStats);
     $oMaxDalMaintenancePriority->expectArgumentsAt(0, 'getCampaignStats', array(1, true, '2006-11-10'));
     $oMaxDalMaintenancePriority->expectArgumentsAt(1, 'getCampaignStats', array(1, true, '2006-11-10'));
     $oMaxDalMaintenancePriority->expectCallCount('getCampaignStats', 2);
     // Test 1
     $aParams = array('campaignid' => 1);
     $oCampaign = new OX_Maintenance_Priority_Campaign($aParams);
     $this->assertNull($oCampaign->deliveredRequests);
     $this->assertNull($oCampaign->deliveredImpressions);
     $this->assertNull($oCampaign->deliveredClicks);
     $this->assertNull($oCampaign->deliveredConversions);
     $oCampaign->setSummaryStatisticsToday('2006-11-10');
     $this->assertEqual($oCampaign->deliveredRequests, 0);
     $this->assertEqual($oCampaign->deliveredImpressions, 0);
     $this->assertEqual($oCampaign->deliveredClicks, 0);
     $this->assertEqual($oCampaign->deliveredConversions, 0);
     // Test 2
     $oCampaign->setSummaryStatisticsToday('2006-11-10');
     $this->assertEqual($oCampaign->deliveredRequests, 100);
     $this->assertEqual($oCampaign->deliveredImpressions, 99);
     $this->assertEqual($oCampaign->deliveredClicks, 5);
     $this->assertEqual($oCampaign->deliveredConversions, 1);
     $oMaxDalMaintenancePriority->tally();
 }
开发者ID:esclapes,项目名称:revive-adserver,代码行数:39,代码来源:Campaign.mtp.test.php



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP OAuth类代码示例发布时间:2022-05-23
下一篇:
PHP OA_Permission类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap