本文整理汇总了PHP中Piwik\Option::clearCache方法的典型用法代码示例。如果您正苦于以下问题:PHP Option::clearCache方法的具体用法?PHP Option::clearCache怎么用?PHP Option::clearCache使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Piwik\Option
的用法示例。
在下文中一共展示了Option::clearCache方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testGetOption
/**
* @group Core
*/
public function testGetOption()
{
// empty table, expect false (i.e., not found)
$this->assertFalse(Option::get('anonymous_defaultReport'));
// populate table, expect '1' (i.e., found)
Db::query("INSERT INTO `" . Common::prefixTable('option') . "` VALUES ('anonymous_defaultReport', '1',true)");
$this->assertSame('1', Option::get('anonymous_defaultReport'));
// delete row (bypassing API), expect '1' (i.e., from cache)
Db::query("DELETE FROM `" . Common::prefixTable('option') . "` WHERE option_name = ?", array('anonymous_defaultReport'));
$this->assertSame('1', Option::get('anonymous_defaultReport'));
// force cache reload, expect false (i.e., not found)
Option::clearCache();
$this->assertFalse(Option::get('anonymous_defaultReport'));
}
示例2: realpath
<?php
/**
* 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
*
*/
use Piwik\DataTable\Manager;
use Piwik\Option;
use Piwik\Plugins\UserCountry\LocationProvider\GeoIp;
use Piwik\Site;
use Piwik\Tracker\Cache;
use Piwik\Tracker;
require realpath(dirname(__FILE__)) . "/includes.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();
try {
Piwik_TestingEnvironment::addHooks();
GeoIp::$geoIPDatabaseDir = 'tests/lib/geoip-files';
Tracker::setTestEnvironment();
Manager::getInstance()->deleteAll();
Option::clearCache();
Site::clearCache();
include PIWIK_INCLUDE_PATH . '/piwik.php';
} catch (Exception $ex) {
echo "Unexpected error during tracking: " . $ex->getMessage() . "\n" . $ex->getTraceAsString() . "\n";
}
ob_end_flush();
示例3: updateDatabase
public static function updateDatabase($force = false)
{
Cache::deleteTrackerCache();
Option::clearCache();
if ($force) {
// remove version options to force update
Option::deleteLike('version%');
Option::set('version_core', '0.0');
}
$updater = new Updater();
$componentsWithUpdateFile = CoreUpdater::getComponentUpdates($updater);
if (empty($componentsWithUpdateFile)) {
return false;
}
$result = CoreUpdater::updateComponents($updater, $componentsWithUpdateFile);
if (!empty($result['coreError']) || !empty($result['warnings']) || !empty($result['errors'])) {
throw new \Exception("Failed to update database (errors or warnings found): " . print_r($result, true));
}
return $result;
}
示例4: tearDown
public function tearDown()
{
parent::tearDown();
Manager::getInstance()->deleteAll();
Option::clearCache();
Site::clearCache();
Cache::deleteTrackerCache();
ArchiveTableCreator::clear();
$tempTableName = Common::prefixTable(LogDataPurger::TEMP_TABLE_NAME);
Db::query("DROP TABLE IF EXISTS " . $tempTableName);
}
示例5: resetDatabase
private function resetDatabase()
{
Option::clearCache();
Db::destroyDatabaseObject();
}
示例6: performTearDown
public function performTearDown()
{
// Note: avoid run SQL in the *tearDown() metohds because it randomly fails on Travis CI
// with error Error while sending QUERY packet. PID=XX
$this->tearDown();
self::unloadAllPlugins();
if ($this->dropDatabaseInTearDown) {
$this->dropDatabase();
}
DataTableManager::getInstance()->deleteAll();
Option::clearCache();
Site::clearCache();
Cache::deleteTrackerCache();
Config::getInstance()->clear();
ArchiveTableCreator::clear();
\Piwik\Plugins\ScheduledReports\API::$cache = array();
\Piwik\Registry::unsetInstance();
\Piwik\EventDispatcher::getInstance()->clearAllObservers();
$_GET = $_REQUEST = array();
Translate::unloadEnglishTranslation();
}