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


PHP Piwik_Site::clearCache方法代码示例

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


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

示例1: tearDown

 public function tearDown()
 {
     parent::tearDown();
     Piwik_DataTable_Manager::getInstance()->deleteAll();
     Piwik_Option::getInstance()->clearCache();
     Piwik_Common::deleteTrackerCache();
     Piwik_Site::clearCache();
     Piwik::truncateAllTables();
     Piwik_TablePartitioning::$tablesAlreadyInstalled = null;
 }
开发者ID:nnnnathann,项目名称:piwik,代码行数:10,代码来源:Database.test.php

示例2: tearDown

 public function tearDown()
 {
     parent::tearDown();
     Piwik_DataTable_Manager::getInstance()->deleteAll();
     Piwik_Option::getInstance()->clearCache();
     Piwik_Site::clearCache();
     Piwik_Common::deleteTrackerCache();
     Piwik_TablePartitioning::$tablesAlreadyInstalled = null;
     $tempTableName = Piwik_Common::prefixTable(Piwik_PrivacyManager_LogDataPurger::TEMP_TABLE_NAME);
     Piwik_Query("DROP TABLE IF EXISTS " . $tempTableName);
 }
开发者ID:nnnnathann,项目名称:piwik,代码行数:11,代码来源:PrivacyManagerTest.php

示例3: tearDown

 /**
  * Resets all caches and drops the database
  */
 public function tearDown()
 {
     parent::tearDown();
     try {
         $plugins = Piwik_PluginsManager::getInstance()->getLoadedPlugins();
         foreach ($plugins as $plugin) {
             $plugin->uninstall();
         }
         Piwik_PluginsManager::getInstance()->unloadPlugins();
     } catch (Exception $e) {
     }
     Piwik::dropDatabase();
     Piwik_DataTable_Manager::getInstance()->deleteAll();
     Piwik_Option::getInstance()->clearCache();
     Piwik_Site::clearCache();
     Piwik_Common::deleteTrackerCache();
     Piwik_Config::getInstance()->clear();
     Piwik_TablePartitioning::$tablesAlreadyInstalled = null;
     Zend_Registry::_unsetInstance();
 }
开发者ID:nnnnathann,项目名称:piwik,代码行数:23,代码来源:DatabaseTestCase.php

示例4: _createWebsite

 /**
  * Creates a new website
  * 
  * @param string $timezone
  * @return Piwik_Site
  */
 private function _createWebsite($timezone = 'UTC')
 {
     $idSite = Piwik_SitesManager_API::getInstance()->addSite("site1", array("http://piwik.net"), $ecommerce = 0, $siteSearch = 1, $searchKeywordParameters = null, $searchCategoryParameters = null, $excludedIps = "", $excludedQueryParameters = "", $timezone);
     Piwik_Site::clearCache();
     return new Piwik_Site($idSite);
 }
开发者ID:nomoto-ubicast,项目名称:piwik,代码行数:12,代码来源:ArchiveProcessingTest.php

示例5: postUpdateWebsite

	private function postUpdateWebsite($idSite)
	{
		Piwik_Site::clearCache();
		Piwik_Common::regenerateCacheWebsiteAttributes($idSite);
	}
开发者ID:BackupTheBerlios,项目名称:oos-svn,代码行数:5,代码来源:API.php

示例6: createWebsite

 /**
  * Creates a website, then sets its creation date to a day earlier than specified dateTime
  * Useful to create a website now, but force data to be archived back in the past.
  *
  * @param string  $dateTime eg '2010-01-01 12:34:56'
  * @param int     $ecommerce
  * @param string  $siteName
  *
  * @return int    idSite of website created
  */
 public static function createWebsite($dateTime, $ecommerce = 0, $siteName = 'Piwik test', $siteUrl = false, $siteSearch = 1, $searchKeywordParameters = null, $searchCategoryParameters = null)
 {
     $idSite = Piwik_SitesManager_API::getInstance()->addSite($siteName, $siteUrl === false ? "http://piwik.net/" : $siteUrl, $ecommerce, $siteSearch, $searchKeywordParameters, $searchCategoryParameters, $ips = null, $excludedQueryParameters = null, $timezone = null, $currency = null);
     // Manually set the website creation date to a day earlier than the earliest day we record stats for
     Zend_Registry::get('db')->update(Piwik_Common::prefixTable("site"), array('ts_created' => Piwik_Date::factory($dateTime)->subDay(1)->getDatetime()), "idsite = {$idSite}");
     // Clear the memory Website cache
     Piwik_Site::clearCache();
     return $idSite;
 }
开发者ID:nomoto-ubicast,项目名称:piwik,代码行数:19,代码来源:IntegrationTestCase.php

示例7: ob_start

/**
 *  Proxy to normal piwik.php, but in testing mode
 *  
 *  - Use the tests database to record Tracking data
 *  - Allows to overwrite the Visitor IP, and Server datetime 
 *  
 * @see Main.test.php
 * 
 */
// Wrapping the request inside ob_start() calls to ensure that the Test
// calling us waits for the full request to process before unblocking
ob_start();
define('PIWIK_INCLUDE_PATH', '../../..');
define('PIWIK_USER_PATH', PIWIK_INCLUDE_PATH);
require_once PIWIK_INCLUDE_PATH . '/libs/upgradephp/upgrade.php';
require_once PIWIK_INCLUDE_PATH . '/core/Loader.php';
// Config files forced to use the test database
// Note that this also provides security for Piwik installs containing tests files:
// this proxy will not record any data in the production database.
Piwik::createConfigObject();
Piwik_Config::getInstance()->setTestEnvironment();
Piwik_Config::getInstance()->PluginsInstalled['PluginsInstalled'] = array();
Piwik_UserCountry_LocationProvider_GeoIp::$geoIPDatabaseDir = 'tests/lib/geoip-files';
Piwik_Tracker::setTestEnvironment();
Piwik_DataTable_Manager::getInstance()->deleteAll();
Piwik_Option::getInstance()->clearCache();
Piwik_Site::clearCache();
Piwik_Common::deleteTrackerCache();
include PIWIK_INCLUDE_PATH . '/piwik.php';
ob_end_flush();
开发者ID:nomoto-ubicast,项目名称:piwik,代码行数:30,代码来源:piwik.php

示例8: invalidateArchivedReports


//.........这里部分代码省略.........
     }
     Piwik::checkUserHasAdminAccess($idSites);
     // Ensure the specified dates are valid
     $toInvalidate = $invalidDates = array();
     $dates = explode(',', $dates);
     $dates = array_unique($dates);
     foreach ($dates as $theDate) {
         try {
             $date = Piwik_Date::factory($theDate);
         } catch (Exception $e) {
             $invalidDates[] = $theDate;
             continue;
         }
         if ($date->toString() == $theDate) {
             $toInvalidate[] = $date;
         } else {
             $invalidDates[] = $theDate;
         }
     }
     // Lookup archive tables
     $tables = Piwik::getTablesInstalled();
     $archiveTables = Piwik::getTablesArchivesInstalled();
     // If using the feature "Delete logs older than N days"...
     $logsAreDeletedBeforeThisDate = Piwik_Config::getInstance()->Deletelogs['delete_logs_schedule_lowest_interval'];
     $logsDeleteEnabled = Piwik_Config::getInstance()->Deletelogs['delete_logs_enable'];
     $minimumDateWithLogs = false;
     if ($logsDeleteEnabled && $logsAreDeletedBeforeThisDate) {
         $minimumDateWithLogs = Piwik_Date::factory('today')->subDay($logsAreDeletedBeforeThisDate);
     }
     // Given the list of dates, process which tables they should be deleted from
     $minDate = false;
     $warningDates = $processedDates = array();
     /* @var $date Piwik_Date */
     foreach ($toInvalidate as $date) {
         // we should only delete reports for dates that are more recent than N days
         if ($minimumDateWithLogs && $date->isEarlier($minimumDateWithLogs)) {
             $warningDates[] = $date->toString();
         } else {
             $processedDates[] = $date->toString();
         }
         $month = $date->toString('Y_m');
         // For a given date, we must invalidate in the monthly archive table
         $datesByMonth[$month][] = $date->toString();
         // But also the year stored in January
         $year = $date->toString('Y_01');
         $datesByMonth[$year][] = $date->toString();
         // but also weeks overlapping several months stored in the month where the week is starting
         /* @var $week Piwik_Period_Week */
         $week = Piwik_Period::factory('week', $date);
         $week = $week->getDateStart()->toString('Y_m');
         $datesByMonth[$week][] = $date->toString();
         // Keep track of the minimum date for each website
         if ($minDate === false || $date->isEarlier($minDate)) {
             $minDate = $date;
         }
     }
     // In each table, invalidate day/week/month/year containing this date
     $sqlIdSites = implode(",", $idSites);
     foreach ($archiveTables as $table) {
         // Extract Y_m from table name
         $suffix = str_replace(array('archive_numeric_', 'archive_blob_'), '', Piwik_Common::unprefixTable($table));
         if (!isset($datesByMonth[$suffix])) {
             continue;
         }
         // Dates which are to be deleted from this table
         $datesToDeleteInTable = $datesByMonth[$suffix];
         // Build one statement to delete all dates from the given table
         $sql = $bind = array();
         $datesToDeleteInTable = array_unique($datesToDeleteInTable);
         foreach ($datesToDeleteInTable as $dateToDelete) {
             $sql[] = '(date1 <= ? AND ? <= date2)';
             $bind[] = $dateToDelete;
             $bind[] = $dateToDelete;
         }
         $sql = implode(" OR ", $sql);
         $query = "DELETE FROM {$table} " . " WHERE ( {$sql} ) " . " AND idsite IN (" . $sqlIdSites . ")";
         Piwik_Query($query, $bind);
         //			var_dump($query);var_dump($bind);
     }
     // Update piwik_site.ts_created
     $query = "UPDATE " . Piwik_Common::prefixTable("site") . " SET ts_created = ?" . " WHERE idsite IN ( {$sqlIdSites} )\n\t\t\t\t\tAND ts_created > ?";
     $minDateSql = $minDate->subDay(1)->getDatetime();
     $bind = array($minDateSql, $minDateSql);
     Piwik_Query($query, $bind);
     //		var_dump($query);var_dump($bind);
     // Force to re-process data for these websites in the next archive.php cron run
     $invalidatedIdSites = Piwik_CoreAdminHome_API::getWebsiteIdsToInvalidate();
     $invalidatedIdSites = array_merge($invalidatedIdSites, $idSites);
     $invalidatedIdSites = array_unique($invalidatedIdSites);
     $invalidatedIdSites = array_values($invalidatedIdSites);
     Piwik_SetOption(self::OPTION_INVALIDATED_IDSITES, serialize($invalidatedIdSites));
     Piwik_Site::clearCache();
     $output = array();
     // output logs
     if ($warningDates) {
         $output[] = 'Warning: the following Dates have not been invalidated, because they are earlier than your Log Deletion limit: ' . implode(", ", $warningDates) . "\n The last day with logs is " . $minimumDateWithLogs . ". " . "\n Please disable 'Delete old Logs' or set it to a higher deletion threshold (eg. 180 days or 365 years).'.";
     }
     $output[] = "Success. The following dates were invalidated successfully: " . implode(", ", $processedDates);
     return $output;
 }
开发者ID:nomoto-ubicast,项目名称:piwik,代码行数:101,代码来源:API.php

示例9: createWebsite

 /**
  * Creates a website, then sets its creation date to a day earlier than specified dateTime
  * Useful to create a website now, but force data to be archived back in the past.
  *
  * @param $dateTime eg '2010-01-01 12:34:56'
  * @return $idSite of website created
  */
 protected function createWebsite($dateTime, $ecommerce = 0, $siteName = 'Piwik test')
 {
     $idSite = Piwik_SitesManager_API::getInstance()->addSite($siteName, "http://piwik.net/", $ecommerce, $ips = null, $excludedQueryParameters = null, $timezone = null, $currency = null);
     // Manually set the website creation date to a day earlier than the earliest day we record stats for
     Zend_Registry::get('db')->update(Piwik_Common::prefixTable("site"), array('ts_created' => Piwik_Date::factory($dateTime)->subDay(1)->getDatetime()), "idsite = {$idSite}");
     // Clear the memory Website cache
     Piwik_Site::clearCache();
     // add access to all test users if doing controller tests
     if (self::$widgetTestingLevel != self::NO_WIDGET_TESTING) {
         $usersApi = Piwik_UsersManager_API::getInstance();
         $usersApi->setUserAccess('anonymous', 'view', array($idSite));
         $usersApi->setUserAccess('test_view', 'view', array($idSite));
         $usersApi->setUserAccess('test_admin', 'admin', array($idSite));
     }
     return $idSite;
 }
开发者ID:0h546f6f78696342756e4e59,项目名称:piwik,代码行数:23,代码来源:Integration.php


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