/** * Returns the name_trunk for a file path * @param string $filePath * @param string $scope * @return string */ static protected function nameTrunk( $filePath, $scope ) { switch ( $scope ) { case 'viewcache': { $nameTrunk = substr( $filePath, 0, strrpos( $filePath, '-' ) + 1 ); } break; case 'template-block': { $templateBlockCacheDir = eZTemplateCacheBlock::templateBlockCacheDir(); $templateBlockPath = str_replace( $templateBlockCacheDir, '', $filePath ); if ( strstr( $templateBlockPath, 'subtree/' ) !== false ) { // 6 = strlen( 'cache/' ); $len = strlen( $templateBlockCacheDir ) + strpos( $templateBlockPath, 'cache/' ) + 6; $nameTrunk = substr( $filePath, 0, $len ); } else { $nameTrunk = $filePath; } } break; default: { $nameTrunk = $filePath; } } return $nameTrunk; }
static function cachePath($keyString, $nodeID = false) { $filename = eZSys::ezcrc32($keyString) . ".cache"; $phpDir = eZTemplateCacheBlock::templateBlockCacheDir(); if (is_numeric($nodeID)) { $phpDir .= eZTemplateCacheBlock::calculateSubtreeCacheDir($nodeID, $filename); } else { $phpDir .= $filename[0] . '/' . $filename[1] . '/' . $filename[2]; } $phpPath = $phpDir . '/' . $filename; return $phpPath; }
static function cleanupAll() { $subtreeCacheDir = eZTemplateCacheBlock::templateBlockCacheDir() . eZTemplateCacheBlock::subtreeCacheBaseSubDir(); eZSubtreeCache::cleanupCacheDir($subtreeCacheDir); }
static function templateBlockCacheDir() { return eZTemplateCacheBlock::templateBlockCacheDir(); }