case 'mov': MAX_header('Content-type: video/quicktime; name=' . $filename); break; default: MAX_header('Content-type: image/' . $contenttype . '; name=' . $filename); break; } } echo $aCreative['contents']; } else { MAX_sendStatusCode(304); } } MAX_commonRegisterGlobalsArray(array('filename', 'contenttype')); if (!empty($filename)) { $aCreative = MAX_cacheGetCreative($filename); if (empty($aCreative) || !isset($aCreative['contents'])) { if ($conf['defaultBanner']['imageUrl'] != "") { MAX_redirect($conf['defaultBanner']['imageUrl']); } else { MAX_commonDisplay1x1(); } } else { MAX_imageServe($aCreative, $filename, $contenttype); } } else { if ($conf['defaultBanner']['imageUrl'] != "") { MAX_redirect($conf['defaultBanner']['imageUrl']); } else { MAX_commonDisplay1x1(); }
/** * Creates all possible delivert cache files * * @param array $aIds array of DB Ids returned by _createTestData * @see _createTestData */ function _createTestCacheFiles($aIds) { // Create cache files not related to DB Objects MAX_cacheGetAccountTZs(); MAX_cacheCheckIfMaintenanceShouldRun(); MAX_cacheGetGoogleJavaScript(); // Create cache files for banners and images foreach ($aIds['banners'] as $bannerId) { MAX_cacheGetAd($bannerId); } foreach ($aIds['images'] as $filename) { MAX_cacheGetCreative($filename); } // Create cache files for zones foreach ($aIds['zones'] as $zoneId) { MAX_cacheGetZoneLinkedAds($zoneId); MAX_cacheGetZoneInfo($zoneId); } // Create cache files for websites foreach ($aIds['affiliates'] as $affiliateid) { OA_cacheGetPublisherZones($affiliateid); } // Create cache files for trackers foreach ($aIds['trackers'] as $trackerid) { MAX_cacheGetTracker($trackerid); MAX_cacheGetTrackerVariables($trackerid); } // Create cache files for channels foreach ($aIds['channel'] as $channelid) { MAX_cacheGetChannelLimitations($channelid); } // cache files for direct-selection are not created // due to problems with invalidating MAX_cacheGetLinkedAds }
/** * Method tests invalidateImageCache method */ function test_invalidateImageCache() { $cachedData = MAX_cacheGetCreative($this->_aIds['images'][0]); // Change something in image $doImage = OA_Dal::factoryDO('images'); $doImage->get($this->_aIds['images'][0]); $doImage->contents = 'new contents'; $doImage->update(); // Expect no changes in cache $this->assertEqual(MAX_cacheGetCreative($this->_aIds['images'][0]), $cachedData); $this->oDeliveryCacheManager->invalidateImageCache($this->_aIds['images'][0]); // Now expect changes in cache $this->assertNotEqual(MAX_cacheGetCreative($this->_aIds['images'][0]), $cachedData); }
/** * Method tests invalidateGetCreativeCache method */ function test_invalidateGetCreativeCache() { $aIds = $this->_createTestData(); $this->_createTestCacheFiles($aIds); $cachedData = MAX_cacheGetCreative($aIds['images'][0]); // Change something in image $doImage = OA_Dal::factoryDO('images'); $doImage->get($aIds['images'][0]); $doImage->contents = 'new content'; $doImage->update(); // Expect no changes in cache $this->assertEqual(MAX_cacheGetCreative($aIds['images'][0]), $cachedData); $this->oDeliveryCacheCommon->invalidateGetCreativeCache($aIds['images'][0]); // Now expect changes in cache $this->assertNotEqual(MAX_cacheGetCreative($aIds['images'][0]), $cachedData); }