本文整理汇总了PHP中Piwik\Filesystem::deleteAllCacheOnUpdate方法的典型用法代码示例。如果您正苦于以下问题:PHP Filesystem::deleteAllCacheOnUpdate方法的具体用法?PHP Filesystem::deleteAllCacheOnUpdate怎么用?PHP Filesystem::deleteAllCacheOnUpdate使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Piwik\Filesystem
的用法示例。
在下文中一共展示了Filesystem::deleteAllCacheOnUpdate方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: dispatch
public function dispatch()
{
$module = Common::getRequestVar('module', '', 'string');
$action = Common::getRequestVar('action', '', 'string');
if ($module == 'CoreUpdater' || $module == 'Proxy' || $module == 'Installation' || $module == 'LanguagesManager' && $action == 'saveLanguage') {
return;
}
$updater = new PiwikCoreUpdater();
$updates = $updater->getComponentsWithNewVersion(array('core' => Version::VERSION));
if (!empty($updates)) {
Filesystem::deleteAllCacheOnUpdate();
}
if ($updater->getComponentUpdates() !== null) {
if (FrontController::shouldRethrowException()) {
throw new Exception("Piwik and/or some plugins have been upgraded to a new version. \n" . "--> Please run the update process first. See documentation: http://piwik.org/docs/update/ \n");
} elseif ($module === 'API') {
$outputFormat = strtolower(Common::getRequestVar('format', 'xml', 'string', $_GET + $_POST));
$response = new ResponseBuilder($outputFormat);
$e = new Exception('Database Upgrade Required. Your Piwik database is out-of-date, and must be upgraded before you can continue.');
echo $response->getResponseException($e);
Common::sendResponseCode(503);
exit;
} else {
Piwik::redirectToModule('CoreUpdater');
}
}
}
示例2: execute
protected function execute(InputInterface $input, OutputInterface $output)
{
$commandName = $input->getFirstArgument();
$enable = false !== strpos($commandName, 'enable');
$full = $input->getOption('full');
$config = Config::getInstance();
$development = $config->Development;
if ($enable) {
$development['enabled'] = 1;
if ($full) {
$development['disable_merged_assets'] = 1;
}
$message = 'Development mode enabled';
} else {
$development['enabled'] = 0;
if ($full) {
$development['disable_merged_assets'] = 0;
}
$message = 'Development mode disabled';
}
$config->Development = $development;
$config->forceSave();
Filesystem::deleteAllCacheOnUpdate();
$this->writeSuccessMessage($output, array($message));
}
示例3: welcome
/**
* Installation Step 1: Welcome
*
* Can also display an error message when there is a failure early (eg. DB connection failed)
*/
function welcome()
{
// Delete merged js/css files to force regenerations based on updated activated plugin list
Filesystem::deleteAllCacheOnUpdate();
$this->checkPiwikIsNotInstalled();
$view = new View('@Installation/welcome', $this->getInstallationSteps(), __FUNCTION__);
$view->showNextStep = true;
return $view->render();
}
示例4: welcome
/**
* Installation Step 1: Welcome
*
* Can also display an error message when there is a failure early (eg. DB connection failed)
*
* @param string Optional error message
*/
function welcome($message = false)
{
// Delete merged js/css files to force regenerations based on updated activated plugin list
Filesystem::deleteAllCacheOnUpdate();
if (empty($message)) {
$this->checkPiwikIsNotInstalled();
}
$view = new View('@Installation/welcome', $this->getInstallationSteps(), __FUNCTION__);
$view->newInstall = !SettingsPiwik::isPiwikInstalled();
$view->errorMessage = $message;
$view->showNextStep = $view->newInstall;
return $view->render();
}
示例5: dispatch
public function dispatch()
{
$module = Common::getRequestVar('module', '', 'string');
$action = Common::getRequestVar('action', '', 'string');
$updater = new PiwikCoreUpdater();
$updates = $updater->getComponentsWithNewVersion(array('core' => Version::VERSION));
if (!empty($updates)) {
Filesystem::deleteAllCacheOnUpdate();
}
if ($updater->getComponentUpdates() !== null && $module != 'CoreUpdater' && $module != 'Proxy' && $module != 'Installation' && !($module == 'LanguagesManager' && $action == 'saveLanguage')) {
if (FrontController::shouldRethrowException()) {
throw new Exception("Piwik and/or some plugins have been upgraded to a new version. \n" . "--> Please run the update process first. See documentation: http://piwik.org/docs/update/ \n");
} else {
Piwik::redirectToModule('CoreUpdater');
}
}
}
示例6: installOrUpdatePluginFromFile
public function installOrUpdatePluginFromFile($pathToZip)
{
$tmpPluginFolder = StaticContainer::get('path.tmp') . self::PATH_TO_DOWNLOAD . $this->pluginName;
try {
$this->makeSureFoldersAreWritable();
$this->extractPluginFiles($pathToZip, $tmpPluginFolder);
$this->makeSurePluginJsonExists($tmpPluginFolder);
$metadata = $this->getPluginMetadataIfValid($tmpPluginFolder);
$this->makeSureThereAreNoMissingRequirements($metadata);
$this->pluginName = $metadata->name;
$this->fixPluginFolderIfNeeded($tmpPluginFolder);
$this->copyPluginToDestination($tmpPluginFolder);
Filesystem::deleteAllCacheOnUpdate($this->pluginName);
} catch (\Exception $e) {
$this->removeFileIfExists($pathToZip);
$this->removeFolderIfExists($tmpPluginFolder);
throw $e;
}
$this->removeFileIfExists($pathToZip);
$this->removeFolderIfExists($tmpPluginFolder);
return $metadata;
}
示例7: clearCache
/**
* @param string $pluginName
*/
private function clearCache($pluginName)
{
$this->resetTransientCache();
Filesystem::deleteAllCacheOnUpdate($pluginName);
}
示例8: updateComponents
/**
* Updates multiple components, while capturing & returning errors and warnings.
*
* @param string[] $componentsWithUpdateFile Component names mapped with arrays of update files. Same structure
* as the result of `getComponentsWithUpdateFile()`.
* @return array Information about the update process, including:
*
* * **warnings**: The list of warnings that occurred during the update process.
* * **errors**: The list of updater exceptions thrown during individual component updates.
* * **coreError**: True if an exception was thrown while updating core.
* * **deactivatedPlugins**: The list of plugins that were deactivated due to an error in the
* update process.
*/
public function updateComponents($componentsWithUpdateFile)
{
$warnings = array();
$errors = array();
$deactivatedPlugins = array();
$coreError = false;
if (!empty($componentsWithUpdateFile)) {
$currentAccess = Access::getInstance();
$hasSuperUserAccess = $currentAccess->hasSuperUserAccess();
if (!$hasSuperUserAccess) {
$currentAccess->setSuperUserAccess(true);
}
// if error in any core update, show message + help message + EXIT
// if errors in any plugins updates, show them on screen, disable plugins that errored + CONTINUE
// if warning in any core update or in any plugins update, show message + CONTINUE
// if no error or warning, success message + CONTINUE
foreach ($componentsWithUpdateFile as $name => $filenames) {
try {
$warnings = array_merge($warnings, $this->update($name));
} catch (UpdaterErrorException $e) {
$errors[] = $e->getMessage();
if ($name == 'core') {
$coreError = true;
break;
} elseif (\Piwik\Plugin\Manager::getInstance()->isPluginActivated($name)) {
\Piwik\Plugin\Manager::getInstance()->deactivatePlugin($name);
$deactivatedPlugins[] = $name;
}
}
}
if (!$hasSuperUserAccess) {
$currentAccess->setSuperUserAccess(false);
}
}
Filesystem::deleteAllCacheOnUpdate();
$result = array('warnings' => $warnings, 'errors' => $errors, 'coreError' => $coreError, 'deactivatedPlugins' => $deactivatedPlugins);
/**
* Triggered after Piwik has been updated.
*/
Piwik::postEvent('CoreUpdater.update.end');
return $result;
}
示例9: execute
/**
* Execute command like: ./console core:clear-caches
*/
protected function execute(InputInterface $input, OutputInterface $output)
{
Filesystem::deleteAllCacheOnUpdate();
$this->writeSuccessMessage($output, array('Caches cleared'));
}
示例10: clearCache
/**
* @param string $pluginName
*/
private function clearCache($pluginName)
{
Filesystem::deleteAllCacheOnUpdate($pluginName);
}
示例11: welcome
/**
* Installation Step 1: Welcome
*/
function welcome($message = false)
{
// Delete merged js/css files to force regenerations based on updated activated plugin list
Filesystem::deleteAllCacheOnUpdate();
$view = new View('@Installation/welcome', $this->getInstallationSteps(), __FUNCTION__);
$isConfigFileFound = file_exists(Config::getLocalConfigPath());
$view->newInstall = !$isConfigFileFound;
$view->errorMessage = $message;
$this->skipThisStep(__FUNCTION__);
$view->showNextStep = $view->newInstall;
$this->session->currentStepDone = __FUNCTION__;
return $view->render();
}
示例12: addHooks
public static function addHooks()
{
$testingEnvironment = new Piwik_TestingEnvironment();
if ($testingEnvironment->queryParamOverride) {
foreach ($testingEnvironment->queryParamOverride as $key => $value) {
$_GET[$key] = $value;
}
}
if ($testingEnvironment->globalsOverride) {
foreach ($testingEnvironment->globalsOverride as $key => $value) {
$GLOBALS[$key] = $value;
}
}
Config::setSingletonInstance(new Config($testingEnvironment->configFileGlobal, $testingEnvironment->configFileLocal, $testingEnvironment->configFileCommon));
\Piwik\CacheFile::$invalidateOpCacheBeforeRead = true;
Piwik::addAction('Access.createAccessSingleton', function ($access) use($testingEnvironment) {
if (!$testingEnvironment->testUseRegularAuth) {
$access = new Piwik_MockAccess($access);
\Piwik\Access::setSingletonInstance($access);
}
});
if (!$testingEnvironment->dontUseTestConfig) {
Piwik::addAction('Config.createConfigSingleton', function (Config $config, &$cache, $local) use($testingEnvironment) {
$config->setTestEnvironment($testingEnvironment->configFileLocal, $testingEnvironment->configFileGlobal, $testingEnvironment->configFileCommon);
if ($testingEnvironment->configFileLocal) {
unset($cache['General']);
$config->General['session_save_handler'] = 'dbtable';
}
$manager = \Piwik\Plugin\Manager::getInstance();
$pluginsToLoad = $manager->getPluginsToLoadDuringTests();
$config->Plugins = array('Plugins' => $pluginsToLoad);
$trackerPluginsToLoad = array_filter($pluginsToLoad, function ($plugin) use($manager) {
return $manager->isTrackerPlugin($manager->loadPlugin($plugin));
});
$config->Plugins_Tracker = array('Plugins_Tracker' => $trackerPluginsToLoad);
$log = $config->log;
$log['log_writers'] = array('file');
$config->log = $log;
$manager->unloadPlugins();
// TODO: replace this and below w/ configOverride use
if ($testingEnvironment->tablesPrefix) {
$cache['database']['tables_prefix'] = $testingEnvironment->tablesPrefix;
}
if ($testingEnvironment->dbName) {
$cache['database']['dbname'] = $testingEnvironment->dbName;
}
if ($testingEnvironment->configOverride) {
$cache = $testingEnvironment->arrayMergeRecursiveDistinct($cache, $testingEnvironment->configOverride);
}
});
}
Piwik::addAction('Request.dispatch', function () {
\Piwik\Plugins\CoreVisualizations\Visualizations\Cloud::$debugDisableShuffle = true;
\Piwik\Visualization\Sparkline::$enableSparklineImages = false;
\Piwik\Plugins\ExampleUI\API::$disableRandomness = true;
});
Piwik::addAction('AssetManager.getStylesheetFiles', function (&$stylesheets) {
$stylesheets[] = 'tests/resources/screenshot-override/override.css';
});
Piwik::addAction('AssetManager.getJavaScriptFiles', function (&$jsFiles) {
$jsFiles[] = 'tests/resources/screenshot-override/override.js';
});
self::addSendMailHook();
Piwik::addAction('Updater.checkForUpdates', function () {
try {
@\Piwik\Filesystem::deleteAllCacheOnUpdate();
} catch (Exception $ex) {
// pass
}
});
$testingEnvironment->logVariables();
$testingEnvironment->executeSetupTestEnvHook();
}
示例13: test_trackingApiWithBulkRequests_viaCurl_withCorrectTokenAuth
public function test_trackingApiWithBulkRequests_viaCurl_withCorrectTokenAuth()
{
$token_auth = Fixture::getTokenAuth();
\Piwik\Filesystem::deleteAllCacheOnUpdate();
$this->issueBulkTrackingRequest($token_auth, $expectTrackingToSucceed = true);
}
示例14: FakeAccess
$access = new FakeAccess();
FakeAccess::$superUser = true;
FakeAccess::$superUserLogin = 'superUserLogin';
return $access;
} else {
return $previous;
}
}), 'observers.global' => DI\add(array(array('AssetManager.getStylesheetFiles', function (&$stylesheets) {
$useOverrideCss = \Piwik\Container\StaticContainer::get('test.vars.useOverrideCss');
if ($useOverrideCss) {
$stylesheets[] = 'tests/resources/screenshot-override/override.css';
}
}), array('AssetManager.getJavaScriptFiles', function (&$jsFiles) {
$useOverrideJs = \Piwik\Container\StaticContainer::get('test.vars.useOverrideJs');
if ($useOverrideJs) {
$jsFiles[] = 'tests/resources/screenshot-override/override.js';
}
}), array('Updater.checkForUpdates', function () {
try {
@\Piwik\Filesystem::deleteAllCacheOnUpdate();
} catch (Exception $ex) {
// pass
}
}), array('Test.Mail.send', function (\Zend_Mail $mail) {
$outputFile = PIWIK_INCLUDE_PATH . '/tmp/' . Common::getRequestVar('module', '') . '.' . Common::getRequestVar('action', '') . '.mail.json';
$outputContent = str_replace("=\n", "", $mail->getBodyText($textOnly = true));
$outputContent = str_replace("=0A", "\n", $outputContent);
$outputContent = str_replace("=3D", "=", $outputContent);
$outputContents = array('from' => $mail->getFrom(), 'to' => $mail->getRecipients(), 'subject' => $mail->getSubject(), 'contents' => $outputContent);
file_put_contents($outputFile, json_encode($outputContents));
}))));
示例15: doWelcomeUpdates
private function doWelcomeUpdates($view, $componentsWithUpdateFile)
{
$view->new_piwik_version = Version::VERSION;
$view->commandUpgradePiwik = "<br /><code>php " . Filesystem::getPathToPiwikRoot() . "/console core:update </code>";
$pluginNamesToUpdate = array();
$dimensionsToUpdate = array();
$coreToUpdate = false;
// handle case of existing database with no tables
if (!DbHelper::isInstalled()) {
$this->errorMessages[] = Piwik::translate('CoreUpdater_EmptyDatabaseError', Config::getInstance()->database['dbname']);
$this->coreError = true;
$currentVersion = 'N/A';
} else {
$this->errorMessages = array();
try {
$currentVersion = Option::get('version_core');
} catch (Exception $e) {
$currentVersion = '<= 0.2.9';
}
foreach ($componentsWithUpdateFile as $name => $filenames) {
if ($name == 'core') {
$coreToUpdate = true;
} elseif (0 === strpos($name, 'log_')) {
$dimensionsToUpdate[] = $name;
} else {
$pluginNamesToUpdate[] = $name;
}
}
}
// check file integrity
$integrityInfo = Filechecks::getFileIntegrityInformation();
if (isset($integrityInfo[1])) {
if ($integrityInfo[0] == false) {
$this->warningMessages[] = Piwik::translate('General_FileIntegrityWarningExplanation');
}
$this->warningMessages = array_merge($this->warningMessages, array_slice($integrityInfo, 1));
}
Filesystem::deleteAllCacheOnUpdate();
$view->coreError = $this->coreError;
$view->warningMessages = $this->warningMessages;
$view->errorMessages = $this->errorMessages;
$view->current_piwik_version = $currentVersion;
$view->pluginNamesToUpdate = $pluginNamesToUpdate;
$view->dimensionsToUpdate = $dimensionsToUpdate;
$view->coreToUpdate = $coreToUpdate;
}