function testGetName()
 {
     $oPlugin =& OX_Component::factory('deliveryLimitations', 'Geo', 'City');
     $oPlugin->init(array());
     // Assume it is called in the production after talking to Andrew
     $this->assertEqual('Geo - Country / City', $oPlugin->displayName);
 }
 /**
  * Method that is called on settings form submission
  * Error messages are appended to the 0 index of the array
  *
  * @return boolean
  */
 function validate(&$aErrorMessage)
 {
     // Store current values from config
     // overwrite it by tested ones
     $storeSettings = array();
     if (isset($GLOBALS['oxMemcached_memcachedServers'])) {
         $storeSettings['memcachedServers'] = $GLOBALS['_MAX']['CONF']['oxMemcached']['memcachedServers'];
         $GLOBALS['_MAX']['CONF']['oxMemcached']['memcachedServers'] = $GLOBALS['oxMemcached_memcachedServers'];
     }
     if (isset($GLOBALS['oxMemcached_memcachedExpireTime'])) {
         $storeSettings['memcachedExpireTime'] = $GLOBALS['_MAX']['CONF']['oxMemcached']['memcachedExpireTime'];
         $GLOBALS['_MAX']['CONF']['oxMemcached']['memcachedExpireTime'] = $GLOBALS['oxMemcached_memcachedExpireTime'];
     }
     // Use memcached plugin getStatus function to validate
     $oPlgOxMemcached =& OX_Component::factory('deliveryCacheStore', 'oxMemcached', 'oxMemcached');
     $result = $oPlgOxMemcached->getStatus();
     if ($result !== true) {
         $aErrorMessage[0] = $result;
         $result = false;
     }
     // Restore config values
     foreach ($storeSettings as $key => $value) {
         $GLOBALS['_MAX']['CONF']['oxMemcached'][$key] = $value;
     }
     return $result;
 }
 function test_compile()
 {
     $oPlugin =& OX_Component::factory('deliveryLimitations', 'Geo', 'Continent');
     $oPlugin->init(array('data' => 'EU', 'comparison' => '!~'));
     $this->_assertResourceData();
     $result = $oPlugin->compile();
     $this->assertEqual("MAX_checkGeo_Continent('eu,yu,gb,uk,ua,ch,se,sj,es,si,sk,sm,ru,ro,pt,pl,no,nl,mc,md,mt,mk,lu,lt,li,lv,it,ie,is,hu,va,gr,gi,de,ge,fx,fr,fi,fo,ee,dk,cz,cy,hr,bg,ba,be,by,at,am,ad,al', '!~')", $result);
 }
 function test_compile()
 {
     $oPlugin =& OX_Component::factory('deliveryLimitations', 'Geo', 'Continent');
     $oPlugin->init(array('data' => 'EU', 'comparison' => '!~'));
     $this->_assertResourceData();
     $result = $oPlugin->compile();
     $this->assertEqual("MAX_checkGeo_Continent('eu,ad,al,at,ba,be,bg,by,ch,cz,de,dk,ee,es,fi,fo,fr,gb,gi,gr,hr,hu,ie,is,it,li,lt,lu,lv,mc,md,mk,mt,nl,no,pl,pt,ro,ru,se,si,sj,sk,sm,tr,ua,va,rs,me,ax,gg,im,je', '!~')", $result);
 }
 function test_oxMemcached_class()
 {
     if (extension_loaded('memcache')) {
         $oComponent =& OX_Component::factory('deliveryCacheStore', 'oxMemcached', 'oxMemcached');
         $this->_assertClass($oComponent, 'deliveryCacheStore', 'oxMemcached', 'oxMemcached');
     } else {
         $this->skip("memcache extension not available");
     }
 }
 function testCompile()
 {
     $oPlugin =& OX_Component::factory('deliveryLimitations', 'Geo', 'Region');
     $rawData = 'GB|T5,T7';
     $oPlugin->init(array('data' => $rawData, 'comparison' => '=='));
     $this->assertEqual('MAX_checkGeo_Region(\'gb|t5,t7\', \'==\')', $oPlugin->compile());
     $this->assertEqual($rawData, $oPlugin->getData());
     $oPlugin->init(array('data' => array('GB', 'T5', 'T7'), 'comparison' => '=='));
     $this->assertEqual('MAX_checkGeo_Region(\'gb|t5,t7\', \'==\')', $oPlugin->compile());
 }
 function testCompile()
 {
     $oPlugin =& OX_Component::factory('deliveryLimitations', 'Site', 'Channel');
     $oPlugin->init(array('data' => '21', 'comparison' => '=='));
     $this->assertEqual("(MAX_checkSite_Channel('21', '=='))", $oPlugin->compile());
     $oPlugin->init(array('data' => '21,43', 'comparison' => '=='));
     $this->assertEqual("(MAX_checkSite_Channel('21', '==') && MAX_checkSite_Channel('43', '=='))", $oPlugin->compile());
     $oPlugin->init(array('data' => '21,43', 'comparison' => '=~'));
     $this->assertEqual("(MAX_checkSite_Channel('21', '=~') || MAX_checkSite_Channel('43', '=~'))", $oPlugin->compile());
     $oPlugin->init(array('data' => '21,43', 'comparison' => '!~'));
     $this->assertEqual("!(MAX_checkSite_Channel('21', '!~') || MAX_checkSite_Channel('43', '!~'))", $oPlugin->compile());
 }
 function test_genericHtml_class()
 {
     // test the class implementation
     $oComponent =& OX_Component::factory('bannerTypeHtml', 'demoBannerTypeHtml', 'demoHtml');
     // common extension methods
     $this->_assertClass($oComponent, 'bannerTypeHtml', 'demoBannerTypeHtml', 'demoHtml');
     // plugin-specific methods
     $this->assertTrue(method_exists($oComponent, '_buildHtmlTemplate'), $sender . ' missing method _buildHtmlTemplate');
     $this->assertTrue(method_exists($oComponent, 'exportData'), $sender . ' missing method exportData');
     // generate test data
     $doBanners = OA_Dal::factoryDO('banners');
     $oDG = new DataGenerator();
     $oDG->setData('banners', array('ext_bannertype' => array($oComponent->getComponentIdentifier())));
     $aIds = $oDG->generate($doBanners, 5, false);
     $aFields = $aVariables = array();
     // test the processForm method
     // this method joins the banners and banners_demo tables
     // by creating a banners_demo record where
     // banners_demo.banners_demo_id = banners.bannerid
     foreach ($aIds as $i => $bannerId) {
         $aFields['description'] = 'description_' . $bannerId;
         $this->assertTrue($oComponent->processForm(true, $bannerId, $aFields, $aVariables));
         $doBannersDemo = OA_Dal::factoryDO('banners_demo');
         $doBannersDemo->banners_demo_id = $bannerId;
         $this->assertTrue($doBannersDemo->find(true));
         $this->assertEqual($doBannersDemo->banners_demo_desc, $aFields['description']);
     }
     // test the exportData method
     $aTables = $oComponent->exportData();
     $this->assertIsA($aTables, 'array');
     $this->assertEqual(count($aTables), 2);
     $prefix = $GLOBALS['_MAX']['CONF']['table']['prefix'];
     $pattern = '/' . $prefix . 'z_' . $oComponent->component . '[\\d]{8}_[\\d]{6}' . $prefix . 'banners/';
     $this->assertPattern($pattern, $aTables[0]);
     $pattern = '/' . $prefix . 'z_' . $oComponent->component . '[\\d]{8}_[\\d]{6}' . $prefix . 'banners_demo/';
     $this->assertPattern($pattern, $aTables[1]);
     $oDbh = OA_DB::singleton();
     $query = "SELECT * FROM " . $oDbh->quoteIdentifier($aTables[0]);
     $aResult = $oDbh->queryAll($query, null, MDB2_FETCHMODE_ASSOC);
     foreach ($aResult as $i => $aFrom) {
         $this->assertEqual($aFrom['bannerid'], $aIds[$i]);
     }
     $query = "SELECT * FROM " . $oDbh->quoteIdentifier($aTables[1]);
     $aResult = $oDbh->queryAll($query, null, MDB2_FETCHMODE_ASSOC);
     foreach ($aResult as $i => $aFrom) {
         $this->assertEqual($aFrom['banners_demo_id'], $aIds[$i]);
     }
 }
 /**
  * A private method to locate and instantiate all components that
  * use the deliveryLog extension, and are in installed plugins, storing
  * them in an array, grouped by the component's destination statistics
  * table -- this will provide all of the plugin components that use
  * the deliveryLog extension (i.e. have bucket-based delivery data that
  * needs to be migrated to statistics tables), grouped by the detsination
  * statistics tables (so that all components that have data migrated to
  * the same table can be migrated in the one call).
  *
  * @access private
  * @return array An array of plugins components, as described above.
  */
 private function locateComponents()
 {
     $aSummariseComponents = array();
     foreach ($this->aPackages as $aPluginInfo) {
         foreach ($aPluginInfo['contents'] as $aContents) {
             if ($aContents['extends'] == 'deliveryLog') {
                 foreach ($aContents['components'] as $aComponent) {
                     $oComponent =& OX_Component::factory('deliveryLog', $aContents['name'], $aComponent['name']);
                     if ($oComponent->enabled) {
                         $destinationTable = $oComponent->getStatisticsTableName();
                         $aSummariseComponents[$destinationTable][get_class($oComponent)] = $oComponent;
                     }
                 }
             }
         }
     }
     return $aSummariseComponents;
 }
 /**
  * Method that is called on settings form submission
  * Error messages are appended to the 0 index of the array
  *
  * @return boolean
  */
 function validate(&$aErrorMessage)
 {
     // Store current values from config
     // overwrite it by tested ones
     $storeSettings = array();
     if (isset($GLOBALS['oxCacheFile_cachePath'])) {
         $storeSettings['cachePath'] = $GLOBALS['_MAX']['CONF']['oxCacheFile']['cachePath'];
         $GLOBALS['_MAX']['CONF']['oxCacheFile']['cachePath'] = $GLOBALS['oxCacheFile_cachePath'];
     }
     // Use file plugin getStatus function to validate
     $oPlgoxCacheFile =& OX_Component::factory('deliveryCacheStore', 'oxCacheFile', 'oxCacheFile');
     $result = $oPlgoxCacheFile->getStatus();
     if ($result !== true) {
         $aErrorMessage[0] = $result;
         $result = false;
     }
     // Restore config values
     foreach ($storeSettings as $key => $value) {
         $GLOBALS['_MAX']['CONF']['oxCacheFile'][$key] = $value;
     }
     return $result;
 }
 public function check($oSection)
 {
     phpAds_registerGlobal('clientid', 'campaignid');
     global $clientid, $campaignid;
     $sectionId = $oSection->getId();
     static $cache = array();
     $oMarkedTextAdvertiserComponent = OX_Component::factory('admin', 'oxMarkedTextAdvertiser');
     $oEntityHelper = $oMarkedTextAdvertiserComponent->getEntityHelper();
     $enabled = true;
     switch ($sectionId) {
         case 'advertiser-edit':
         case 'advertiser-trackers':
         case 'advertiser-access':
         case 'campaign-edit_new':
         case 'campaign-edit':
         case 'campaign-trackers':
         case 'campaign-banners':
             if (isset($cache[$clientid])) {
                 return $cache[$clientid];
             }
             break;
         case 'banner-edit':
             if (isset($cache[$clientid])) {
                 return $cache[$clientid];
             }
             break;
         case 'banner-acl':
         case 'banner-zone':
         case 'banner-advanced':
         case 'campaign-zone':
     }
     $sessionClientId = $this->getSessionClientId();
     if (isset($sessionClientId)) {
         $this->clearMarketEntitiesInSession();
     }
     return $enabled;
 }
    $aBanner['imageurl'] = "http://";
    $aBanner['width'] = '';
    $aBanner['height'] = '';
    $aBanner['htmltemplate'] = '';
    $aBanner['description'] = '';
    $aBanner['comments'] = '';
    $aBanner['contenttype'] = '';
    $aBanner['adserver'] = '';
    $aBanner['keyword'] = '';
    $aBanner["weight"] = $pref['default_banner_weight'];
    $aBanner['hardcoded_links'] = array();
    $aBanner['hardcoded_targets'] = array();
}
if ($ext_bannertype) {
    list($extension, $group, $plugin) = explode(':', $ext_bannertype);
    $oComponent =& OX_Component::factory($extension, $group, $plugin);
    if (!$oComponent) {
        $oComponent = OX_Component::getFallbackHandler($extension);
    }
    $formDisabled = !$oComponent || !$oComponent->enabled;
}
if (!$ext_bannertype && $type && !in_array($type, array('sql', 'web', 'url', 'html', 'txt'))) {
    list($extension, $group, $plugin) = explode('.', $type);
    $oComponent =& OX_Component::factoryByComponentIdentifier($extension, $group, $plugin);
    $formDisabled = !$oComponent || !$oComponent->enabled;
    if ($oComponent) {
        $ext_bannertype = $type;
        $type = $oComponent->getStorageType();
    } else {
        $ext_bannertype = '';
        $type = '';
Esempio n. 13
0
 function test_getComponentIdentifier()
 {
     $GLOBALS['_MAX']['CONF']['pluginPaths']['plugins'] = '/lib/OX/Plugin/tests/data/testExtensions/';
     $GLOBALS['_MAX']['CONF']['pluginGroupComponents'] = array('testGroup1' => 1, 'testGroup2' => 0);
     $oComponent = OX_Component::factory('testExtension1', 'testGroup1', 'testComponent1');
     $this->assertEqual($oComponent->getComponentIdentifier('testExtension1', 'testGroup1', 'testComponent1'), 'testExtension1:testGroup1:testComponent1');
 }
 function test_adsense_class()
 {
     $oComponent =& OX_Component::factory('bannerTypeHtml', 'openXHtmlAdsense', 'adsense');
     $this->_assertClass($oComponent, 'bannerTypeHtml', 'openXHtmlAdsense', 'adsense');
     $this->assertTrue(method_exists($oComponent, 'buildHtmlTemplate'), $sender . ' missing method buildHtmlTemplate');
 }
<?php

require_once '../../../../init.php';
require_once '../../config.php';
require_once MAX_PATH . '/lib/OA/Dal.php';
require_once MAX_PATH . '/lib/OA/Dll.php';
require_once MAX_PATH . '/lib/max/other/html.php';
require_once MAX_PATH . '/lib/OA/Admin/Template.php';
require_once MAX_PATH . '/lib/OA/Admin/TemplatePlugin.php';
require_once MAX_PATH . '/lib/OA/Admin/UI/component/Form.php';
require_once MAX_PATH . '/lib/OX/Admin/Redirect.php';
require_once 'oxMarkedTextAdvertiser.class.php';
phpAds_registerGlobal('hideinactive', 'listorder', 'orderdirection');
OA_Permission::enforceAccount(OA_ACCOUNT_MANAGER, OA_ACCOUNT_ADVERTISER);
$oMarkedTextComponent = OX_Component::factory('admin', 'oxMarkedTextAdvertiser');
if (!empty($clientid) && !OA_Permission::hasAccessToObject('clients', $clientid)) {
    $page = basename($_SERVER['SCRIPT_NAME']);
    OX_Admin_Redirect::redirect($page);
}
if (!empty($campaignid) && !OA_Permission::hasAccessToObject('campaigns', $campaignid)) {
    $page = basename($_SERVER['SCRIPT_NAME']);
    OX_Admin_Redirect::redirect("{$page}?clientid={$clientid}");
}
$aAdvertisers = getAdvertiserMap();
if (empty($clientid)) {
    $campaignid = null;
    if ($session['prefs']['inventory_entities'][OA_Permission::getEntityId()]['clientid']) {
        $sessionClientId = $session['prefs']['inventory_entities'][OA_Permission::getEntityId()]['clientid'];
        if (isset($aAdvertisers[$sessionClientId])) {
            $clientid = $sessionClientId;
        }
 function setUp()
 {
     //$this->oPlugin = &MAX_Plugin::factory('reports', 'oxStandard', 'conversionTrackingReport');
     $GLOBALS['_MAX']['CONF']['pluginPaths']['plugins'] = str_replace('reports/oxReportsStandard/tests/unit', '', dirname(str_replace(MAX_PATH, '', __FILE__)));
     $this->oPlugin =& OX_Component::factory('reports', 'oxReportsStandard', 'conversionTrackingReport');
 }
Esempio n. 17
0
        }
    }
} else {
    //set some default
    $affiliate['website'] = 'http://';
}
/*-------------------------------------------------------*/
/* MAIN REQUEST PROCESSING                               */
/*-------------------------------------------------------*/
//  check if Thorium plugin is enabled
$oComponent = null;
if (isset($GLOBALS['_MAX']['CONF']['plugins']['openXThorium']) && $GLOBALS['_MAX']['CONF']['plugins']['openXThorium']) {
    $oComponent =& OX_Component::factory('admin', 'oxThorium', 'oxThorium');
}
if (isset($GLOBALS['_MAX']['CONF']['plugins']['openXMarket']) && $GLOBALS['_MAX']['CONF']['plugins']['openXMarket']) {
    $oComponent =& OX_Component::factory('admin', 'oxMarket', 'oxMarket');
}
//build form
$websiteForm = buildWebsiteForm($affiliate);
if ($websiteForm->validate()) {
    //process submitted values
    $oPublisherDll = processForm($affiliateid, $websiteForm, $oComponent);
    if ($oPublisherDll->_errorMessage || $oPublisherDll->_noticeMessage) {
        displayPage($affiliateid, $websiteForm, $oPublisherDll);
    }
} else {
    //either validation failed or form was not submitted, display the form
    displayPage($affiliateid, $websiteForm);
}
/*-------------------------------------------------------*/
/* Build form                                            */
Esempio n. 18
0
 /**
  * Set properties campaign to oac
  *   call XMLRPC method
  *
  */
 function setCampaignsProperties()
 {
     $doCampaigns = OA_Dal::factoryDO('campaigns');
     $doCampaigns->find();
     $aCampaigns = array();
     while ($doCampaigns->fetch()) {
         if ($doCampaigns->as_campaign_id) {
             // Get Invocation Code
             $invocationCode = '';
             $doBanner = OA_Dal::factoryDO('banners');
             $doBanner->campaignid = $doCampaigns->campaignid;
             $doBanner->find();
             if ($doBanner->fetch()) {
                 $doAdZone = OA_Dal::factoryDO('ad_zone_assoc');
                 $doAdZone->ad_id = $doBanner->bannerid;
                 $doAdZone->find();
                 if ($doAdZone->fetch()) {
                     $doZone = OA_Dal::factoryDO('zones');
                     $doZone->zoneid = $doAdZone->zone_id;
                     $doZone->find();
                     $invocationCode = '';
                     if ($doZone->fetch()) {
                         $affiliateid = $doZone->affiliateid;
                         $zoneid = $doZone->zoneid;
                         $codetype = 'adview';
                         $invocationTag = OX_Component::factory('invocationTags', $codetype);
                         $maxInvocation = new MAX_Admin_Invocation();
                         $invocationCode = $maxInvocation->generateInvocationCode($invocationTag);
                     }
                 }
             }
             $aCampaigns[(int) $doCampaigns->as_campaign_id] = array('id' => (int) $doCampaigns->campaignid, 'invocationCode' => (string) $invocationCode, 'deliveredCount' => (int) $doCampaigns->capping, 'status' => (string) $this->transformationStatusToOac($doCampaigns->status));
         }
     }
     $aCampaigns = count($aCampaigns) ? $aCampaigns : array(null => null);
     // Call XMLRPC method
     $result = $this->oMapper->setCampaignsProperties($aCampaigns);
 }
 function test_genericHtml_class()
 {
     $oComponent =& OX_Component::factory('bannerTypeHtml', 'oxHtml', 'genericHtml');
     $this->_assertClass($oComponent, 'bannerTypeHtml', 'oxHtml', 'genericHtml');
     $this->assertTrue(method_exists($oComponent, 'buildHtmlTemplate'), $sender . ' missing method buildHtmlTemplate');
 }
 /**
  * A method to test the main run() method.
  */
 function testRun()
 {
     $aConf =& $GLOBALS['_MAX']['CONF'];
     $aConf['maintenance']['operationInterval'] = 60;
     $oServiceLocator =& OA_ServiceLocator::instance();
     $oFactory = new OX_Dal_Maintenance_Statistics_Factory();
     $oDalMaintenanceStatsticsClassName = $oFactory->deriveClassName();
     // Test 1: Run, with the migration required but with no plugins installed
     $oNowDate = new Date('2008-08-28 09:01:00');
     $oServiceLocator->register('now', $oNowDate);
     $oMaintenanceStatistics = new OX_Maintenance_Statistics();
     $oMaintenanceStatistics->updateIntermediate = true;
     $oMaintenanceStatistics->oLastDateIntermediate = new Date('2008-08-28 07:59:59');
     $oMaintenanceStatistics->oUpdateIntermediateToDate = new Date('2008-08-28 08:59:59');
     Mock::generatePartial($oDalMaintenanceStatsticsClassName, 'MockOX_Dal_Maintenance_Statistics_Test_1', array('summariseBucketsRaw', 'summariseBucketsRawSupplementary', 'summariseBucketsAggregate', 'migrateRawRequests', 'migrateRawImpressions', 'migrateRawClicks'));
     $oDal = new MockOX_Dal_Maintenance_Statistics_Test_1($this);
     $oDal->expectNever('summariseBucketsRaw');
     $oDal->expectNever('summariseBucketsRawSupplementary');
     $oDal->expectNever('summariseBucketsAggregate');
     $oDal->expectNever('migrateRawRequests');
     $oDal->expectNever('migrateRawImpressions');
     $oDal->expectNever('migrateRawClicks');
     $oDal->OX_Dal_Maintenance_Statistics();
     $oServiceLocator->register('OX_Dal_Maintenance_Statistics', $oDal);
     $oSummariseIntermediate = new OX_Maintenance_Statistics_Task_MigrateBucketData();
     $oSummariseIntermediate->run();
     $oDal =& $oServiceLocator->get('OX_Dal_Maintenance_Statistics');
     $oDal->tally();
     // Create the "application_variable" table required for installing the plugin
     $oTables =& OA_DB_Table_Core::singleton();
     $oTables->createTable('application_variable');
     // Setup the default OpenX delivery logging plugin for the next test
     TestEnv::installPluginPackage('openXDeliveryLog', false);
     // Test 2: Run, with plugins installed, but with the migration not required
     $oNowDate = new Date('2008-08-28 09:01:00');
     $oServiceLocator->register('now', $oNowDate);
     $oMaintenanceStatistics = new OX_Maintenance_Statistics();
     $oMaintenanceStatistics->updateIntermediate = false;
     $oServiceLocator->register('Maintenance_Statistics_Controller', $oMaintenanceStatistics);
     Mock::generatePartial($oDalMaintenanceStatsticsClassName, 'MockOX_Dal_Maintenance_Statistics_Test_2', array('summariseBucketsRaw', 'summariseBucketsRawSupplementary', 'summariseBucketsAggregate', 'migrateRawRequests', 'migrateRawImpressions', 'migrateRawClicks'));
     $oDal = new MockOX_Dal_Maintenance_Statistics_Test_2($this);
     $oDal->expectNever('summariseBucketsRaw');
     $oDal->expectNever('summariseBucketsRawSupplementary');
     $oDal->expectNever('summariseBucketsAggregate');
     $oDal->expectNever('migrateRawRequests');
     $oDal->expectNever('migrateRawImpressions');
     $oDal->expectNever('migrateRawClicks');
     $oDal->OX_Dal_Maintenance_Statistics();
     $oServiceLocator->register('OX_Dal_Maintenance_Statistics', $oDal);
     $oSummariseIntermediate = new OX_Maintenance_Statistics_Task_MigrateBucketData();
     $oSummariseIntermediate->run();
     $oDal =& $oServiceLocator->get('OX_Dal_Maintenance_Statistics');
     $oDal->tally();
     // Test 3: Run, with plugins installed and with the migration required for a single
     //         operation interval
     $oNowDate = new Date('2008-08-28 09:01:00');
     $oServiceLocator->register('now', $oNowDate);
     $oMaintenanceStatistics = new OX_Maintenance_Statistics();
     $oMaintenanceStatistics->updateIntermediate = true;
     $oMaintenanceStatistics->oLastDateIntermediate = new Date('2008-08-28 07:59:59');
     $oMaintenanceStatistics->oUpdateIntermediateToDate = new Date('2008-08-28 08:59:59');
     $oServiceLocator->register('Maintenance_Statistics_Controller', $oMaintenanceStatistics);
     Mock::generatePartial($oDalMaintenanceStatsticsClassName, 'MockOX_Dal_Maintenance_Statistics_Test_3', array('summariseBucketsRaw', 'summariseBucketsRawSupplementary', 'summariseBucketsAggregate', 'migrateRawRequests', 'migrateRawImpressions', 'migrateRawClicks'));
     $oDal = new MockOX_Dal_Maintenance_Statistics_Test_3($this);
     $oComponent =& OX_Component::factory('deliveryLog', 'oxLogConversion', 'logConversion');
     $oStartDate = new Date('2008-08-28 07:59:59');
     $oStartDate->addSeconds(1);
     $oEndDate = new Date('2008-08-28 09:00:00');
     $oEndDate->subtractSeconds(1);
     $oDal->expectOnce('summariseBucketsRaw', array($aConf['table']['prefix'] . 'data_intermediate_ad_connection', $oComponent->getStatisticsMigration(), array('start' => $oStartDate, 'end' => $oEndDate)));
     $oComponent =& OX_Component::factory('deliveryLog', 'oxLogConversion', 'logConversionVariable');
     $oStartDate = new Date('2008-08-28 07:59:59');
     $oStartDate->addSeconds(1);
     $oEndDate = new Date('2008-08-28 09:00:00');
     $oEndDate->subtractSeconds(1);
     $oDal->expectOnce('summariseBucketsRawSupplementary', array($aConf['table']['prefix'] . 'data_intermediate_ad_variable_value', $oComponent->getStatisticsMigration(), array('start' => $oStartDate, 'end' => $oEndDate)));
     $aMap = array();
     $oComponent =& OX_Component::factory('deliveryLog', 'oxLogClick', 'logClick');
     $aMap[get_class($oComponent)] = $oComponent->getStatisticsMigration();
     $oComponent =& OX_Component::factory('deliveryLog', 'oxLogImpression', 'logImpression');
     $aMap[get_class($oComponent)] = $oComponent->getStatisticsMigration();
     $oComponent =& OX_Component::factory('deliveryLog', 'oxLogRequest', 'logRequest');
     $aMap[get_class($oComponent)] = $oComponent->getStatisticsMigration();
     $oStartDate = new Date('2008-08-28 07:59:59');
     $oStartDate->addSeconds(1);
     $oEndDate = new Date('2008-08-28 09:00:00');
     $oEndDate->subtractSeconds(1);
     $oDal->expectOnce('summariseBucketsAggregate', array($aConf['table']['prefix'] . 'data_intermediate_ad', $aMap, array('start' => $oStartDate, 'end' => $oEndDate), array('operation_interval' => '60', 'operation_interval_id' => OX_OperationInterval::convertDateToOperationIntervalID($oStartDate), 'interval_start' => "'2008-08-28 08:00:00'", 'interval_end' => "'2008-08-28 08:59:59'", 'creative_id' => 0, 'updated' => "'2008-08-28 09:01:00'")));
     $oDal->expectNever('migrateRawRequests');
     $oDal->expectNever('migrateRawImpressions');
     $oDal->expectNever('migrateRawClicks');
     $oDal->OX_Dal_Maintenance_Statistics();
     $oServiceLocator->register('OX_Dal_Maintenance_Statistics', $oDal);
     $oSummariseIntermediate = new OX_Maintenance_Statistics_Task_MigrateBucketData();
     $oSummariseIntermediate->run();
     $oDal =& $oServiceLocator->get('OX_Dal_Maintenance_Statistics');
     $oDal->tally();
     // Test 4: Run, with plugins installed and with the migration required for a single
     //         operation interval + migration of raw data set to occur
     $doApplication_variable = OA_Dal::factoryDO('application_variable');
     $doApplication_variable->name = 'mse_process_raw';
     $doApplication_variable->value = '1';
     $doApplication_variable->insert();
     $oNowDate = new Date('2008-08-28 09:01:00');
     $oServiceLocator->register('now', $oNowDate);
     $oMaintenanceStatistics = new OX_Maintenance_Statistics();
     $oMaintenanceStatistics->updateIntermediate = true;
     $oMaintenanceStatistics->oLastDateIntermediate = new Date('2008-08-28 07:59:59');
     $oMaintenanceStatistics->oUpdateIntermediateToDate = new Date('2008-08-28 08:59:59');
     $oServiceLocator->register('Maintenance_Statistics_Controller', $oMaintenanceStatistics);
     Mock::generatePartial($oDalMaintenanceStatsticsClassName, 'MockOX_Dal_Maintenance_Statistics_Test_4', array('summariseBucketsRaw', 'summariseBucketsRawSupplementary', 'summariseBucketsAggregate', 'migrateRawRequests', 'migrateRawImpressions', 'migrateRawClicks'));
     $oDal = new MockOX_Dal_Maintenance_Statistics_Test_4($this);
     $oComponent =& OX_Component::factory('deliveryLog', 'oxLogConversion', 'logConversion');
     $oStartDate = new Date('2008-08-28 07:59:59');
     $oStartDate->addSeconds(1);
     $oEndDate = new Date('2008-08-28 09:00:00');
     $oEndDate->subtractSeconds(1);
     $oDal->expectOnce('summariseBucketsRaw', array($aConf['table']['prefix'] . 'data_intermediate_ad_connection', $oComponent->getStatisticsMigration(), array('start' => $oStartDate, 'end' => $oEndDate)));
     $oComponent =& OX_Component::factory('deliveryLog', 'oxLogConversion', 'logConversionVariable');
     $oStartDate = new Date('2008-08-28 07:59:59');
     $oStartDate->addSeconds(1);
     $oEndDate = new Date('2008-08-28 09:00:00');
     $oEndDate->subtractSeconds(1);
     $oDal->expectOnce('summariseBucketsRawSupplementary', array($aConf['table']['prefix'] . 'data_intermediate_ad_variable_value', $oComponent->getStatisticsMigration(), array('start' => $oStartDate, 'end' => $oEndDate)));
     $aMap = array();
     $oComponent =& OX_Component::factory('deliveryLog', 'oxLogClick', 'logClick');
     $aMap[get_class($oComponent)] = $oComponent->getStatisticsMigration();
     $oComponent =& OX_Component::factory('deliveryLog', 'oxLogImpression', 'logImpression');
     $aMap[get_class($oComponent)] = $oComponent->getStatisticsMigration();
     $oComponent =& OX_Component::factory('deliveryLog', 'oxLogRequest', 'logRequest');
     $aMap[get_class($oComponent)] = $oComponent->getStatisticsMigration();
     $oStartDate = new Date('2008-08-28 07:59:59');
     $oStartDate->addSeconds(1);
     $oEndDate = new Date('2008-08-28 09:00:00');
     $oEndDate->subtractSeconds(1);
     $oDal->expectOnce('summariseBucketsAggregate', array($aConf['table']['prefix'] . 'data_intermediate_ad', $aMap, array('start' => $oStartDate, 'end' => $oEndDate), array('operation_interval' => '60', 'operation_interval_id' => OX_OperationInterval::convertDateToOperationIntervalID($oStartDate), 'interval_start' => "'2008-08-28 08:00:00'", 'interval_end' => "'2008-08-28 08:59:59'", 'creative_id' => 0, 'updated' => "'2008-08-28 09:01:00'")));
     $oDal->expectOnce('migrateRawRequests', array($oStartDate, $oEndDate));
     $oDal->expectOnce('migrateRawImpressions', array($oStartDate, $oEndDate));
     $oDal->expectOnce('migrateRawClicks', array($oStartDate, $oEndDate));
     $oDal->OX_Dal_Maintenance_Statistics();
     $oServiceLocator->register('OX_Dal_Maintenance_Statistics', $oDal);
     $oSummariseIntermediate = new OX_Maintenance_Statistics_Task_MigrateBucketData();
     $oSummariseIntermediate->run();
     $oDal =& $oServiceLocator->get('OX_Dal_Maintenance_Statistics');
     $oDal->tally();
     $doApplication_variable = OA_Dal::factoryDO('application_variable');
     $doApplication_variable->name = 'mse_process_raw';
     $doApplication_variable->value = '1';
     $doApplication_variable->find();
     $rows = $doApplication_variable->getRowCount();
     $this->assertEqual($rows, 0);
     // Test 5: Run, with plugins installed and with the migration required for multiple
     //         operation intervals
     $oNowDate = new Date('2008-08-28 11:01:00');
     $oServiceLocator->register('now', $oNowDate);
     $oMaintenanceStatistics = new OX_Maintenance_Statistics();
     $oMaintenanceStatistics->updateIntermediate = true;
     $oMaintenanceStatistics->oLastDateIntermediate = new Date('2008-08-28 07:59:59');
     $oMaintenanceStatistics->oUpdateIntermediateToDate = new Date('2008-08-28 10:59:59');
     $oServiceLocator->register('Maintenance_Statistics_Controller', $oMaintenanceStatistics);
     Mock::generatePartial($oDalMaintenanceStatsticsClassName, 'MockOX_Dal_Maintenance_Statistics_Test_5', array('summariseBucketsRaw', 'summariseBucketsRawSupplementary', 'summariseBucketsAggregate', 'migrateRawRequests', 'migrateRawImpressions', 'migrateRawClicks'));
     $oDal = new MockOX_Dal_Maintenance_Statistics_Test_5($this);
     $oDal->expectCallCount('summariseBucketsRaw', 3);
     $oDal->expectCallCount('summariseBucketsRawSupplementary', 3);
     $oDal->expectCallCount('summariseBucketsAggregate', 3);
     $oComponent =& OX_Component::factory('deliveryLog', 'oxLogConversion', 'logConversion');
     $oStartDate = new Date('2008-08-28 07:59:59');
     $oStartDate->addSeconds(1);
     $oEndDate = new Date('2008-08-28 09:00:00');
     $oEndDate->subtractSeconds(1);
     $oDal->expectAt(0, 'summariseBucketsRaw', array($aConf['table']['prefix'] . 'data_intermediate_ad_connection', $oComponent->getStatisticsMigration(), array('start' => $oStartDate, 'end' => $oEndDate)));
     $oStartDate = new Date('2008-08-28 08:59:59');
     $oStartDate->addSeconds(1);
     $oEndDate = new Date('2008-08-28 10:00:00');
     $oEndDate->subtractSeconds(1);
     $oDal->expectAt(1, 'summariseBucketsRaw', array($aConf['table']['prefix'] . 'data_intermediate_ad_connection', $oComponent->getStatisticsMigration(), array('start' => $oStartDate, 'end' => $oEndDate)));
     $oStartDate = new Date('2008-08-28 09:59:59');
     $oStartDate->addSeconds(1);
     $oEndDate = new Date('2008-08-28 11:00:00');
     $oEndDate->subtractSeconds(1);
     $oDal->expectAt(2, 'summariseBucketsRaw', array($aConf['table']['prefix'] . 'data_intermediate_ad_connection', $oComponent->getStatisticsMigration(), array('start' => $oStartDate, 'end' => $oEndDate)));
     $oComponent =& OX_Component::factory('deliveryLog', 'oxLogConversion', 'logConversionVariable');
     $oStartDate = new Date('2008-08-28 07:59:59');
     $oStartDate->addSeconds(1);
     $oEndDate = new Date('2008-08-28 09:00:00');
     $oEndDate->subtractSeconds(1);
     $oDal->expectAt(0, 'summariseBucketsRawSupplementary', array($aConf['table']['prefix'] . 'data_intermediate_ad_variable_value', $oComponent->getStatisticsMigration(), array('start' => $oStartDate, 'end' => $oEndDate)));
     $oStartDate = new Date('2008-08-28 08:59:59');
     $oStartDate->addSeconds(1);
     $oEndDate = new Date('2008-08-28 10:00:00');
     $oEndDate->subtractSeconds(1);
     $oDal->expectAt(1, 'summariseBucketsRawSupplementary', array($aConf['table']['prefix'] . 'data_intermediate_ad_variable_value', $oComponent->getStatisticsMigration(), array('start' => $oStartDate, 'end' => $oEndDate)));
     $oStartDate = new Date('2008-08-28 09:59:59');
     $oStartDate->addSeconds(1);
     $oEndDate = new Date('2008-08-28 11:00:00');
     $oEndDate->subtractSeconds(1);
     $oDal->expectAt(2, 'summariseBucketsRawSupplementary', array($aConf['table']['prefix'] . 'data_intermediate_ad_variable_value', $oComponent->getStatisticsMigration(), array('start' => $oStartDate, 'end' => $oEndDate)));
     $aMap = array();
     $oComponent =& OX_Component::factory('deliveryLog', 'oxLogClick', 'logClick');
     $aMap[get_class($oComponent)] = $oComponent->getStatisticsMigration();
     $oComponent =& OX_Component::factory('deliveryLog', 'oxLogImpression', 'logImpression');
     $aMap[get_class($oComponent)] = $oComponent->getStatisticsMigration();
     $oComponent =& OX_Component::factory('deliveryLog', 'oxLogRequest', 'logRequest');
     $aMap[get_class($oComponent)] = $oComponent->getStatisticsMigration();
     $oStartDate = new Date('2008-08-28 07:59:59');
     $oStartDate->addSeconds(1);
     $oEndDate = new Date('2008-08-28 09:00:00');
     $oEndDate->subtractSeconds(1);
     $oDal->expectAt(0, 'summariseBucketsAggregate', array($aConf['table']['prefix'] . 'data_intermediate_ad', $aMap, array('start' => $oStartDate, 'end' => $oEndDate), array('operation_interval' => '60', 'operation_interval_id' => OX_OperationInterval::convertDateToOperationIntervalID($oStartDate), 'interval_start' => "'2008-08-28 08:00:00'", 'interval_end' => "'2008-08-28 08:59:59'", 'creative_id' => 0, 'updated' => "'2008-08-28 11:01:00'")));
     $oStartDate = new Date('2008-08-28 08:59:59');
     $oStartDate->addSeconds(1);
     $oEndDate = new Date('2008-08-28 10:00:00');
     $oEndDate->subtractSeconds(1);
     $oDal->expectAt(1, 'summariseBucketsAggregate', array($aConf['table']['prefix'] . 'data_intermediate_ad', $aMap, array('start' => $oStartDate, 'end' => $oEndDate), array('operation_interval' => '60', 'operation_interval_id' => OX_OperationInterval::convertDateToOperationIntervalID($oStartDate), 'interval_start' => "'2008-08-28 09:00:00'", 'interval_end' => "'2008-08-28 09:59:59'", 'creative_id' => 0, 'updated' => "'2008-08-28 11:01:00'")));
     $oStartDate = new Date('2008-08-28 09:59:59');
     $oStartDate->addSeconds(1);
     $oEndDate = new Date('2008-08-28 11:00:00');
     $oEndDate->subtractSeconds(1);
     $oDal->expectAt(2, 'summariseBucketsAggregate', array($aConf['table']['prefix'] . 'data_intermediate_ad', $aMap, array('start' => $oStartDate, 'end' => $oEndDate), array('operation_interval' => '60', 'operation_interval_id' => OX_OperationInterval::convertDateToOperationIntervalID($oStartDate), 'interval_start' => "'2008-08-28 10:00:00'", 'interval_end' => "'2008-08-28 10:59:59'", 'creative_id' => 0, 'updated' => "'2008-08-28 11:01:00'")));
     $oDal->expectNever('migrateRawRequests');
     $oDal->expectNever('migrateRawImpressions');
     $oDal->expectNever('migrateRawClicks');
     $oDal->OX_Dal_Maintenance_Statistics();
     $oServiceLocator->register('OX_Dal_Maintenance_Statistics', $oDal);
     $oSummariseIntermediate = new OX_Maintenance_Statistics_Task_MigrateBucketData();
     $oSummariseIntermediate->run();
     $oDal =& $oServiceLocator->get('OX_Dal_Maintenance_Statistics');
     $oDal->tally();
     // Test 6: Run, with plugins installed and with the migration required for multiple
     //         operation intervals + migration of raw data set to occur
     $doApplication_variable = OA_Dal::factoryDO('application_variable');
     $doApplication_variable->name = 'mse_process_raw';
     $doApplication_variable->value = '1';
     $doApplication_variable->insert();
     $oNowDate = new Date('2008-08-28 11:01:00');
     $oServiceLocator->register('now', $oNowDate);
     $oMaintenanceStatistics = new OX_Maintenance_Statistics();
     $oMaintenanceStatistics->updateIntermediate = true;
     $oMaintenanceStatistics->oLastDateIntermediate = new Date('2008-08-28 07:59:59');
     $oMaintenanceStatistics->oUpdateIntermediateToDate = new Date('2008-08-28 10:59:59');
     $oServiceLocator->register('Maintenance_Statistics_Controller', $oMaintenanceStatistics);
     Mock::generatePartial($oDalMaintenanceStatsticsClassName, 'MockOX_Dal_Maintenance_Statistics_Test_6', array('summariseBucketsRaw', 'summariseBucketsRawSupplementary', 'summariseBucketsAggregate', 'migrateRawRequests', 'migrateRawImpressions', 'migrateRawClicks'));
     $oDal = new MockOX_Dal_Maintenance_Statistics_Test_6($this);
     $oDal->expectCallCount('summariseBucketsRaw', 3);
     $oDal->expectCallCount('summariseBucketsRawSupplementary', 3);
     $oDal->expectCallCount('summariseBucketsAggregate', 3);
     $oComponent =& OX_Component::factory('deliveryLog', 'oxLogConversion', 'logConversion');
     $oStartDate = new Date('2008-08-28 07:59:59');
     $oStartDate->addSeconds(1);
     $oEndDate = new Date('2008-08-28 09:00:00');
     $oEndDate->subtractSeconds(1);
     $oDal->expectAt(0, 'summariseBucketsRaw', array($aConf['table']['prefix'] . 'data_intermediate_ad_connection', $oComponent->getStatisticsMigration(), array('start' => $oStartDate, 'end' => $oEndDate)));
     $oStartDate = new Date('2008-08-28 08:59:59');
     $oStartDate->addSeconds(1);
     $oEndDate = new Date('2008-08-28 10:00:00');
     $oEndDate->subtractSeconds(1);
     $oDal->expectAt(1, 'summariseBucketsRaw', array($aConf['table']['prefix'] . 'data_intermediate_ad_connection', $oComponent->getStatisticsMigration(), array('start' => $oStartDate, 'end' => $oEndDate)));
     $oStartDate = new Date('2008-08-28 09:59:59');
     $oStartDate->addSeconds(1);
     $oEndDate = new Date('2008-08-28 11:00:00');
     $oEndDate->subtractSeconds(1);
     $oDal->expectAt(2, 'summariseBucketsRaw', array($aConf['table']['prefix'] . 'data_intermediate_ad_connection', $oComponent->getStatisticsMigration(), array('start' => $oStartDate, 'end' => $oEndDate)));
     $oComponent =& OX_Component::factory('deliveryLog', 'oxLogConversion', 'logConversionVariable');
     $oStartDate = new Date('2008-08-28 07:59:59');
     $oStartDate->addSeconds(1);
     $oEndDate = new Date('2008-08-28 09:00:00');
     $oEndDate->subtractSeconds(1);
     $oDal->expectAt(0, 'summariseBucketsRawSupplementary', array($aConf['table']['prefix'] . 'data_intermediate_ad_variable_value', $oComponent->getStatisticsMigration(), array('start' => $oStartDate, 'end' => $oEndDate)));
     $oStartDate = new Date('2008-08-28 08:59:59');
     $oStartDate->addSeconds(1);
     $oEndDate = new Date('2008-08-28 10:00:00');
     $oEndDate->subtractSeconds(1);
     $oDal->expectAt(1, 'summariseBucketsRawSupplementary', array($aConf['table']['prefix'] . 'data_intermediate_ad_variable_value', $oComponent->getStatisticsMigration(), array('start' => $oStartDate, 'end' => $oEndDate)));
     $oStartDate = new Date('2008-08-28 09:59:59');
     $oStartDate->addSeconds(1);
     $oEndDate = new Date('2008-08-28 11:00:00');
     $oEndDate->subtractSeconds(1);
     $oDal->expectAt(2, 'summariseBucketsRawSupplementary', array($aConf['table']['prefix'] . 'data_intermediate_ad_variable_value', $oComponent->getStatisticsMigration(), array('start' => $oStartDate, 'end' => $oEndDate)));
     $aMap = array();
     $oComponent =& OX_Component::factory('deliveryLog', 'oxLogClick', 'logClick');
     $aMap[get_class($oComponent)] = $oComponent->getStatisticsMigration();
     $oComponent =& OX_Component::factory('deliveryLog', 'oxLogImpression', 'logImpression');
     $aMap[get_class($oComponent)] = $oComponent->getStatisticsMigration();
     $oComponent =& OX_Component::factory('deliveryLog', 'oxLogRequest', 'logRequest');
     $aMap[get_class($oComponent)] = $oComponent->getStatisticsMigration();
     $oStartDate = new Date('2008-08-28 07:59:59');
     $oStartDate->addSeconds(1);
     $oEndDate = new Date('2008-08-28 09:00:00');
     $oEndDate->subtractSeconds(1);
     $oDal->expectAt(0, 'summariseBucketsAggregate', array($aConf['table']['prefix'] . 'data_intermediate_ad', $aMap, array('start' => $oStartDate, 'end' => $oEndDate), array('operation_interval' => '60', 'operation_interval_id' => OX_OperationInterval::convertDateToOperationIntervalID($oStartDate), 'interval_start' => "'2008-08-28 08:00:00'", 'interval_end' => "'2008-08-28 08:59:59'", 'creative_id' => 0, 'updated' => "'2008-08-28 11:01:00'")));
     $oStartDate = new Date('2008-08-28 08:59:59');
     $oStartDate->addSeconds(1);
     $oEndDate = new Date('2008-08-28 10:00:00');
     $oEndDate->subtractSeconds(1);
     $oDal->expectAt(1, 'summariseBucketsAggregate', array($aConf['table']['prefix'] . 'data_intermediate_ad', $aMap, array('start' => $oStartDate, 'end' => $oEndDate), array('operation_interval' => '60', 'operation_interval_id' => OX_OperationInterval::convertDateToOperationIntervalID($oStartDate), 'interval_start' => "'2008-08-28 09:00:00'", 'interval_end' => "'2008-08-28 09:59:59'", 'creative_id' => 0, 'updated' => "'2008-08-28 11:01:00'")));
     $oStartDate = new Date('2008-08-28 09:59:59');
     $oStartDate->addSeconds(1);
     $oEndDate = new Date('2008-08-28 11:00:00');
     $oEndDate->subtractSeconds(1);
     $oDal->expectAt(2, 'summariseBucketsAggregate', array($aConf['table']['prefix'] . 'data_intermediate_ad', $aMap, array('start' => $oStartDate, 'end' => $oEndDate), array('operation_interval' => '60', 'operation_interval_id' => OX_OperationInterval::convertDateToOperationIntervalID($oStartDate), 'interval_start' => "'2008-08-28 10:00:00'", 'interval_end' => "'2008-08-28 10:59:59'", 'creative_id' => 0, 'updated' => "'2008-08-28 11:01:00'")));
     $oStartDate = new Date('2008-08-28 07:59:59');
     $oStartDate->addSeconds(1);
     $oEndDate = new Date('2008-08-28 09:00:00');
     $oEndDate->subtractSeconds(1);
     $oDal->expectAt(0, 'migrateRawRequests', array($oStartDate, $oEndDate));
     $oDal->expectAt(0, 'migrateRawImpressions', array($oStartDate, $oEndDate));
     $oDal->expectAt(0, 'migrateRawClicks', array($oStartDate, $oEndDate));
     $oStartDate = new Date('2008-08-28 08:59:59');
     $oStartDate->addSeconds(1);
     $oEndDate = new Date('2008-08-28 10:00:00');
     $oEndDate->subtractSeconds(1);
     $oDal->expectAt(1, 'migrateRawRequests', array($oStartDate, $oEndDate));
     $oDal->expectAt(1, 'migrateRawImpressions', array($oStartDate, $oEndDate));
     $oDal->expectAt(1, 'migrateRawClicks', array($oStartDate, $oEndDate));
     $oStartDate = new Date('2008-08-28 09:59:59');
     $oStartDate->addSeconds(1);
     $oEndDate = new Date('2008-08-28 11:00:00');
     $oEndDate->subtractSeconds(1);
     $oDal->expectAt(2, 'migrateRawRequests', array($oStartDate, $oEndDate));
     $oDal->expectAt(2, 'migrateRawImpressions', array($oStartDate, $oEndDate));
     $oDal->expectAt(2, 'migrateRawClicks', array($oStartDate, $oEndDate));
     $oDal->OX_Dal_Maintenance_Statistics();
     $oServiceLocator->register('OX_Dal_Maintenance_Statistics', $oDal);
     $oSummariseIntermediate = new OX_Maintenance_Statistics_Task_MigrateBucketData();
     $oSummariseIntermediate->run();
     $oDal =& $oServiceLocator->get('OX_Dal_Maintenance_Statistics');
     $oDal->tally();
     $doApplication_variable = OA_Dal::factoryDO('application_variable');
     $doApplication_variable->name = 'mse_process_raw';
     $doApplication_variable->value = '1';
     $doApplication_variable->find();
     $rows = $doApplication_variable->getRowCount();
     $this->assertEqual($rows, 0);
     // Uninstall the installed plugins
     TestEnv::uninstallPluginPackage('openXDeliveryLog', false);
     // Reset the testing environment
     TestEnv::restoreEnv();
 }
Esempio n. 21
0
        $doAffiliates = OA_Dal::factoryDO('affiliates');
        if ($doAffiliates->get($affiliateid)) {
            $affiliate = $doAffiliates->toArray();
        }
    }
} else {
    //set some default
    $affiliate['website'] = 'http://';
}
/*-------------------------------------------------------*/
/* MAIN REQUEST PROCESSING                               */
/*-------------------------------------------------------*/
//  check if Thorium plugin is enabled
$oComponent = null;
if (isset($GLOBALS['_MAX']['CONF']['plugins']['openXThorium']) && $GLOBALS['_MAX']['CONF']['plugins']['openXThorium']) {
    $oComponent =& OX_Component::factory('admin', 'oxThorium', 'oxThorium');
}
//build form
$websiteForm = buildWebsiteForm($affiliate);
if ($websiteForm->validate()) {
    //process submitted values
    $oPublisherDll = processForm($affiliateid, $websiteForm, $oComponent);
    if ($oPublisherDll->_errorMessage || $oPublisherDll->_noticeMessage) {
        displayPage($affiliateid, $websiteForm, $oPublisherDll);
    }
} else {
    //either validation failed or form was not submitted, display the form
    displayPage($affiliateid, $websiteForm);
}
/*-------------------------------------------------------*/
/* Build form                                            */
Esempio n. 22
0
/**
 * Extracts the package and name of the plugin from its type, creates a plugin
 * object and returns the reference to it.
 *
 * @param string $type
 * @return Plugins_DeliveryLimitations
 */
function &OA_aclGetComponentFromType($type)
{
    $aComponentIdentifier = OX_Component::parseComponentIdentifier($type);
    if (count($aComponentIdentifier) == 2) {
        array_unshift($aComponentIdentifier, 'deliveryLimitations');
    }
    list($extension, $group, $name) = $aComponentIdentifier;
    return OX_Component::factory($extension, $group, $name);
}