本文整理汇总了PHP中TYPO3\CMS\Core\Extension\ExtensionManager::removeCacheFiles方法的典型用法代码示例。如果您正苦于以下问题:PHP ExtensionManager::removeCacheFiles方法的具体用法?PHP ExtensionManager::removeCacheFiles怎么用?PHP ExtensionManager::removeCacheFiles使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TYPO3\CMS\Core\Extension\ExtensionManager
的用法示例。
在下文中一共展示了ExtensionManager::removeCacheFiles方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: writeExtensionTypoScriptStyleConfigurationToLocalconf
/**
* Writes the TSstyleconf values to "localconf.php"
* Removes the temp_CACHED* files before return.
*
* @param string $extensionKey Extension key
* @param array $newConfiguration Configuration array to write back
* @return void
*/
public function writeExtensionTypoScriptStyleConfigurationToLocalconf($extensionKey, $newConfiguration)
{
\TYPO3\CMS\Core\Configuration\ConfigurationManager::setLocalConfigurationValueByPath('EXT/extConf/' . $extensionKey, serialize($newConfiguration));
\TYPO3\CMS\Core\Extension\ExtensionManager::removeCacheFiles();
}
示例2: clear_cacheCmd
/**
* Clears the cache based on the command $cacheCmd.
*
* $cacheCmd='pages': Clears cache for all pages. Requires admin-flag to
* be set for BE_USER.
*
* $cacheCmd='all': Clears all cache_tables. This is necessary if
* templates are updated. Requires admin-flag to be set for BE_USER.
*
* $cacheCmd=[integer]: Clears cache for the page pointed to by $cacheCmd
* (an integer).
*
* $cacheCmd='cacheTag:[string]': Flush page and pagesection cache by given tag
*
* $cacheCmd='cacheId:[string]': Removes cache identifier from page and page section cache
*
* Can call a list of post processing functions as defined in
* $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_tcemain.php']['clearCachePostProc']
* (numeric array with values being the function references, called by
* t3lib_div::callUserFunction()).
*
* Note: The following cache_* are intentionally not cleared by
* $cacheCmd='all':
*
* - cache_md5params: RDCT redirects.
* - cache_imagesizes: Clearing this table would cause a lot of unneeded
* Imagemagick calls because the size informations have
* to be fetched again after clearing.
*
* @param string $cacheCmd The cache command, see above description
* @return void
*/
public function clear_cacheCmd($cacheCmd)
{
if (is_object($this->BE_USER)) {
$this->BE_USER->writelog(3, 1, 0, 0, 'User %s has cleared the cache (cacheCmd=%s)', array($this->BE_USER->user['username'], $cacheCmd));
}
// Clear cache for either ALL pages or ALL tables!
switch (strtolower($cacheCmd)) {
case 'pages':
if ($this->admin || $this->BE_USER->getTSConfigVal('options.clearCache.pages')) {
$this->internal_clearPageCache();
}
break;
case 'all':
if ($this->admin || $this->BE_USER->getTSConfigVal('options.clearCache.all')) {
// Clear all caching framework caches
$GLOBALS['typo3CacheManager']->flushCaches();
if (\TYPO3\CMS\Core\Extension\ExtensionManager::isLoaded('cms')) {
$GLOBALS['TYPO3_DB']->exec_TRUNCATEquery('cache_treelist');
}
// Clearing additional cache tables:
if (is_array($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_tcemain.php']['clearAllCache_additionalTables'])) {
foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_tcemain.php']['clearAllCache_additionalTables'] as $tableName) {
if (!preg_match('/[^[:alnum:]_]/', $tableName) && substr($tableName, -5) === 'cache') {
$GLOBALS['TYPO3_DB']->exec_TRUNCATEquery($tableName);
} else {
throw new \RuntimeException('TYPO3 Fatal Error: Trying to flush table "' . $tableName . '" with "Clear All Cache"', 1270853922);
}
}
}
}
\TYPO3\CMS\Core\Extension\ExtensionManager::removeCacheFiles();
break;
case 'temp_cached':
\TYPO3\CMS\Core\Extension\ExtensionManager::removeCacheFiles();
break;
}
$tagsToFlush = array();
// Clear cache for a page ID!
if (\TYPO3\CMS\Core\Utility\MathUtility::canBeInterpretedAsInteger($cacheCmd)) {
if (\TYPO3\CMS\Core\Extension\ExtensionManager::isLoaded('cms')) {
$list_cache = array($cacheCmd);
// Call pre-processing function for clearing of cache for page ids:
if (is_array($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_tcemain.php']['clearPageCacheEval'])) {
foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_tcemain.php']['clearPageCacheEval'] as $funcName) {
$_params = array('pageIdArray' => &$list_cache, 'cacheCmd' => $cacheCmd, 'functionID' => 'clear_cacheCmd()');
// Returns the array of ids to clear, FALSE if nothing should be cleared! Never an empty array!
\TYPO3\CMS\Core\Utility\GeneralUtility::callUserFunction($funcName, $_params, $this);
}
}
// Delete cache for selected pages:
if (is_array($list_cache)) {
foreach ($list_cache as $pageId) {
$tagsToFlush[] = 'pageId_' . (int) $pageId;
}
}
}
}
// flush cache by tag
if (\TYPO3\CMS\Core\Utility\GeneralUtility::isFirstPartOfStr(strtolower($cacheCmd), 'cachetag:')) {
$cacheTag = substr($cacheCmd, 9);
$tagsToFlush[] = $cacheTag;
}
// process caching framwork operations
if (count($tagsToFlush) > 0) {
/** @var $pageCache \TYPO3\CMS\Core\Cache\Frontend\AbstractFrontend */
$pageCache = $GLOBALS['typo3CacheManager']->getCache('cache_pages');
/** @var $pageSectionCache \TYPO3\CMS\Core\Cache\Frontend\AbstractFrontend */
$pageSectionCache = $GLOBALS['typo3CacheManager']->getCache('cache_pagesection');
//.........这里部分代码省略.........
示例3: updateWizard
/**
* Generates update wizard
*
* @return void
* @todo Define visibility
*/
public function updateWizard()
{
\TYPO3\CMS\Core\Extension\ExtensionManager::removeCacheFiles();
// Forces creation / update of caching framework tables that are needed by some update wizards
$cacheTablesConfiguration = implode(LF, $this->sqlHandler->getStatementArray(\TYPO3\CMS\Core\Cache\Cache::getDatabaseTableDefinitions(), 1, '^CREATE TABLE '));
$neededTableDefinition = $this->sqlHandler->getFieldDefinitions_fileContent($cacheTablesConfiguration);
$currentTableDefinition = $this->sqlHandler->getFieldDefinitions_database();
$updateTableDefenition = $this->sqlHandler->getDatabaseExtra($neededTableDefinition, $currentTableDefinition);
$updateStatements = $this->sqlHandler->getUpdateSuggestions($updateTableDefenition);
if (isset($updateStatements['create_table']) && count($updateStatements['create_table']) > 0) {
$this->sqlHandler->performUpdateQueries($updateStatements['create_table'], $updateStatements['create_table']);
}
if (isset($updateStatements['add']) && count($updateStatements['add']) > 0) {
$this->sqlHandler->performUpdateQueries($updateStatements['add'], $updateStatements['add']);
}
if (isset($updateStatements['change']) && count($updateStatements['change']) > 0) {
$this->sqlHandler->performUpdateQueries($updateStatements['change'], $updateStatements['change']);
}
// call wizard
$action = $this->INSTALL['database_type'] ? $this->INSTALL['database_type'] : 'checkForUpdate';
$this->updateWizard_parts($action);
$this->output($this->outputWrapper($this->printAll()));
}
示例4: removeCacheFilesFlushesCache
/**
* @test
*/
public function removeCacheFilesFlushesCache()
{
$mockCache = $this->getMock('TYPO3\\CMS\\Core\\Cache\\Frontend\\AbstractFrontend', array('getIdentifier', 'set', 'get', 'getByTag', 'has', 'remove', 'flush', 'flushByTag', 'requireOnce'), array(), '', FALSE);
$GLOBALS['typo3CacheManager'] = $this->getMock('TYPO3\\CMS\\Core\\Cache\\CacheManager', array('getCache'));
$GLOBALS['typo3CacheManager']->expects($this->any())->method('getCache')->will($this->returnValue($mockCache));
$mockCache->expects($this->once())->method('flush');
\TYPO3\CMS\Core\Extension\ExtensionManager::removeCacheFiles();
}