Файловый менеджер - Редактировать - /home/avadvi5/calendar.aeronextgen.com/Cache.zip
Ðазад
PK ��\ވ?0 0 ReadOnlyFilesystemCache.phpnu �[��� <?php /* * This file is part of Twig. * * (c) Fabien Potencier * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Twig\Cache; /** * Implements a cache on the filesystem that can only be read, not written to. * * @author Quentin Devos <quentin@devos.pm> */ class ReadOnlyFilesystemCache extends FilesystemCache { public function write(string $key, string $content): void { // Do nothing with the content, it's a read-only filesystem. } } PK ��\*�� � CacheInterface.phpnu �[��� <?php /* * This file is part of Twig. * * (c) Fabien Potencier * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Twig\Cache; /** * Interface implemented by cache classes. * * It is highly recommended to always store templates on the filesystem to * benefit from the PHP opcode cache. This interface is mostly useful if you * need to implement a custom strategy for storing templates on the filesystem. * * @author Andrew Tch <andrew@noop.lv> */ interface CacheInterface { /** * Generates a cache key for the given template class name. */ public function generateKey(string $name, string $className): string; /** * Writes the compiled template to cache. * * @param string $content The template representation as a PHP class */ public function write(string $key, string $content): void; /** * Loads a template from the cache. */ public function load(string $key): void; /** * Returns the modification timestamp of a key. */ public function getTimestamp(string $key): int; } PK ��\,�h h ChainCache.phpnu �[��� <?php /* * This file is part of Twig. * * (c) Fabien Potencier * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Twig\Cache; /** * Chains several caches together. * * Cached items are fetched from the first cache having them in its data store. * They are saved and deleted in all adapters at once. * * @author Quentin Devos <quentin@devos.pm> */ final class ChainCache implements CacheInterface, RemovableCacheInterface { /** * @param iterable<CacheInterface> $caches The ordered list of caches used to store and fetch cached items */ public function __construct( private iterable $caches, ) { } public function generateKey(string $name, string $className): string { return $className.'#'.$name; } public function write(string $key, string $content): void { $splitKey = $this->splitKey($key); foreach ($this->caches as $cache) { $cache->write($cache->generateKey(...$splitKey), $content); } } public function load(string $key): void { [$name, $className] = $this->splitKey($key); foreach ($this->caches as $cache) { $cache->load($cache->generateKey($name, $className)); if (class_exists($className, false)) { break; } } } public function getTimestamp(string $key): int { $splitKey = $this->splitKey($key); foreach ($this->caches as $cache) { if (0 < $timestamp = $cache->getTimestamp($cache->generateKey(...$splitKey))) { return $timestamp; } } return 0; } public function remove(string $name, string $cls): void { foreach ($this->caches as $cache) { if ($cache instanceof RemovableCacheInterface) { $cache->remove($name, $cls); } } } /** * @return string[] */ private function splitKey(string $key): array { return array_reverse(explode('#', $key, 2)); } } PK ��\��� NullCache.phpnu �[��� <?php /* * This file is part of Twig. * * (c) Fabien Potencier * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Twig\Cache; /** * Implements a no-cache strategy. * * @author Fabien Potencier <fabien@symfony.com> */ final class NullCache implements CacheInterface, RemovableCacheInterface { public function generateKey(string $name, string $className): string { return ''; } public function write(string $key, string $content): void { } public function load(string $key): void { } public function getTimestamp(string $key): int { return 0; } public function remove(string $name, string $cls): void { } } PK ��\�y�~ FilesystemCache.phpnu �[��� <?php /* * This file is part of Twig. * * (c) Fabien Potencier * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Twig\Cache; /** * Implements a cache on the filesystem. * * @author Andrew Tch <andrew@noop.lv> */ class FilesystemCache implements CacheInterface, RemovableCacheInterface { public const FORCE_BYTECODE_INVALIDATION = 1; private $directory; private $options; public function __construct(string $directory, int $options = 0) { $this->directory = rtrim($directory, '\/').'/'; $this->options = $options; } public function generateKey(string $name, string $className): string { $hash = hash(\PHP_VERSION_ID < 80100 ? 'sha256' : 'xxh128', $className); return $this->directory.$hash[0].$hash[1].'/'.$hash.'.php'; } public function load(string $key): void { if (is_file($key)) { @include_once $key; } } public function write(string $key, string $content): void { $dir = \dirname($key); if (!is_dir($dir)) { if (false === @mkdir($dir, 0777, true)) { clearstatcache(true, $dir); if (!is_dir($dir)) { throw new \RuntimeException(\sprintf('Unable to create the cache directory (%s).', $dir)); } } } elseif (!is_writable($dir)) { throw new \RuntimeException(\sprintf('Unable to write in the cache directory (%s).', $dir)); } $tmpFile = tempnam($dir, basename($key)); if (false !== @file_put_contents($tmpFile, $content) && @rename($tmpFile, $key)) { @chmod($key, 0666 & ~umask()); if (self::FORCE_BYTECODE_INVALIDATION == ($this->options & self::FORCE_BYTECODE_INVALIDATION)) { // Compile cached file into bytecode cache if (\function_exists('opcache_invalidate') && filter_var(\ini_get('opcache.enable'), \FILTER_VALIDATE_BOOLEAN)) { @opcache_invalidate($key, true); } elseif (\function_exists('apc_compile_file')) { apc_compile_file($key); } } return; } throw new \RuntimeException(\sprintf('Failed to write cache file "%s".', $key)); } public function remove(string $name, string $cls): void { $key = $this->generateKey($name, $cls); if (!@unlink($key) && file_exists($key)) { throw new \RuntimeException(\sprintf('Failed to delete cache file "%s".', $key)); } } public function getTimestamp(string $key): int { if (!is_file($key)) { return 0; } return (int) @filemtime($key); } } PK ��\�A�} } RemovableCacheInterface.phpnu �[��� <?php /* * This file is part of Twig. * * (c) Fabien Potencier * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Twig\Cache; /** * @author Fabien Potencier <fabien@symfony.com> */ interface RemovableCacheInterface { public function remove(string $name, string $cls): void; } PK ��\ވ?0 0 ReadOnlyFilesystemCache.phpnu �[��� PK ��\*�� � { CacheInterface.phpnu �[��� PK ��\,�h h J ChainCache.phpnu �[��� PK ��\��� � NullCache.phpnu �[��� PK ��\�y�~ A FilesystemCache.phpnu �[��� PK ��\�A�} } � RemovableCacheInterface.phpnu �[��� PK � a
| ver. 1.1 | |
.
| PHP 8.3.30 | Ð“ÐµÐ½ÐµÑ€Ð°Ñ†Ð¸Ñ Ñтраницы: 0 |
proxy
|
phpinfo
|
ÐаÑтройка