Index: C:/Documents and Settings/Dmitry/workspace-typo3/TYPO3-HEAD/t3lib/class.t3lib_tcemain.php =================================================================== --- C:/Documents and Settings/Dmitry/workspace-typo3/TYPO3-HEAD/t3lib/class.t3lib_tcemain.php (revision 2190) +++ C:/Documents and Settings/Dmitry/workspace-typo3/TYPO3-HEAD/t3lib/class.t3lib_tcemain.php (working copy) @@ -6002,15 +6013,13 @@ switch($cacheCmd) { case 'pages': if ($this->admin || $this->BE_USER->getTSConfigVal('options.clearCache.pages')) { - if (t3lib_extMgm::isLoaded('cms')) { - $GLOBALS['TYPO3_DB']->exec_DELETEquery('cache_pages',''); - } + $this->internal_clearPageCache(); } break; case 'all': if ($this->admin || $this->BE_USER->getTSConfigVal('options.clearCache.all')) { if (t3lib_extMgm::isLoaded('cms')) { - $GLOBALS['TYPO3_DB']->exec_DELETEquery('cache_pages',''); + $this->internal_clearPageCache(); $GLOBALS['TYPO3_DB']->exec_DELETEquery('cache_pagesection',''); } $GLOBALS['TYPO3_DB']->exec_DELETEquery('cache_hash',''); @@ -6178,6 +6187,42 @@ exit; } } + + /***************************** + * + * Internal (do not use outside Core!) + * + *****************************/ + + /** + * Clears page cache. Takes into account file cache. + * + * @return void + */ + function internal_clearPageCache() { + if (t3lib_extMgm::isLoaded('cms')) { + $GLOBALS['TYPO3_DB']->exec_DELETEquery('cache_pages',''); + if ($GLOBALS['TYPO3_CONF_VARS']['FE']['pageCacheToExternalFiles']) { + $cacheDir = PATH_site.'typo3temp/cache_pages'; + if (@is_dir($cacheDir) && false !== ($topDir = @opendir($cacheDir))) { + while (false !== ($dir = @readdir($topDir))) { + $curDirName = $cacheDir . '/' . $dir; + if (@is_dir($curDirName) && false !== ($curDir = @opendir($curDirName))) { + while (false != ($fname = @readdir($curDir))) { + $curFName = $curDirName . '/' . $fname; + if (@is_file($curFName)) { + @unlink($curFName); + } + } + } + closedir($curDir); + @rmdir($curDirName); + } + closedir($cacheDir); + } + } + } + } }