Edit File by line

Deprecated: str_replace(): Passing null to parameter #2 ($replace) of type array|string is deprecated in /home/sportsfever/public_html/filemanger/function.php on line 93
/home/sportsfe.../httpdocs/wp-conte.../plugins/sitepres.../lib/twig/src/Cache
File: FilesystemCache.php
<?php
[0] Fix | Delete
[1] Fix | Delete
/*
[2] Fix | Delete
* This file is part of Twig.
[3] Fix | Delete
*
[4] Fix | Delete
* (c) Fabien Potencier
[5] Fix | Delete
*
[6] Fix | Delete
* For the full copyright and license information, please view the LICENSE
[7] Fix | Delete
* file that was distributed with this source code.
[8] Fix | Delete
*/
[9] Fix | Delete
namespace WPML\Core\Twig\Cache;
[10] Fix | Delete
[11] Fix | Delete
/**
[12] Fix | Delete
* Implements a cache on the filesystem.
[13] Fix | Delete
*
[14] Fix | Delete
* @author Andrew Tch <andrew@noop.lv>
[15] Fix | Delete
*/
[16] Fix | Delete
class FilesystemCache implements \WPML\Core\Twig\Cache\CacheInterface
[17] Fix | Delete
{
[18] Fix | Delete
const FORCE_BYTECODE_INVALIDATION = 1;
[19] Fix | Delete
private $directory;
[20] Fix | Delete
private $options;
[21] Fix | Delete
/**
[22] Fix | Delete
* @param string $directory The root cache directory
[23] Fix | Delete
* @param int $options A set of options
[24] Fix | Delete
*/
[25] Fix | Delete
public function __construct($directory, $options = 0)
[26] Fix | Delete
{
[27] Fix | Delete
$this->directory = \rtrim($directory, '\\/') . '/';
[28] Fix | Delete
$this->options = $options;
[29] Fix | Delete
}
[30] Fix | Delete
public function generateKey($name, $className)
[31] Fix | Delete
{
[32] Fix | Delete
$hash = \hash('sha256', $className);
[33] Fix | Delete
return $this->directory . $hash[0] . $hash[1] . '/' . $hash . '.php';
[34] Fix | Delete
}
[35] Fix | Delete
public function load($key)
[36] Fix | Delete
{
[37] Fix | Delete
if (\file_exists($key)) {
[38] Fix | Delete
@(include_once $key);
[39] Fix | Delete
}
[40] Fix | Delete
}
[41] Fix | Delete
public function write($key, $content)
[42] Fix | Delete
{
[43] Fix | Delete
$dir = \dirname($key);
[44] Fix | Delete
if (!\is_dir($dir)) {
[45] Fix | Delete
if (\false === @\mkdir($dir, 0777, \true)) {
[46] Fix | Delete
\clearstatcache(\true, $dir);
[47] Fix | Delete
if (!\is_dir($dir)) {
[48] Fix | Delete
throw new \RuntimeException(\sprintf('Unable to create the cache directory (%s).', $dir));
[49] Fix | Delete
}
[50] Fix | Delete
}
[51] Fix | Delete
} elseif (!\is_writable($dir)) {
[52] Fix | Delete
throw new \RuntimeException(\sprintf('Unable to write in the cache directory (%s).', $dir));
[53] Fix | Delete
}
[54] Fix | Delete
$tmpFile = \tempnam($dir, \basename($key));
[55] Fix | Delete
if (\false !== @\file_put_contents($tmpFile, $content) && @\rename($tmpFile, $key)) {
[56] Fix | Delete
@\chmod($key, 0666 & ~\umask());
[57] Fix | Delete
if (self::FORCE_BYTECODE_INVALIDATION == ($this->options & self::FORCE_BYTECODE_INVALIDATION)) {
[58] Fix | Delete
// Compile cached file into bytecode cache
[59] Fix | Delete
if (\function_exists('opcache_invalidate') && \filter_var(\ini_get('opcache.enable'), \FILTER_VALIDATE_BOOLEAN)) {
[60] Fix | Delete
@\opcache_invalidate($key, \true);
[61] Fix | Delete
} elseif (\function_exists('apc_compile_file')) {
[62] Fix | Delete
\apc_compile_file($key);
[63] Fix | Delete
}
[64] Fix | Delete
}
[65] Fix | Delete
return;
[66] Fix | Delete
}
[67] Fix | Delete
throw new \RuntimeException(\sprintf('Failed to write cache file "%s".', $key));
[68] Fix | Delete
}
[69] Fix | Delete
public function getTimestamp($key)
[70] Fix | Delete
{
[71] Fix | Delete
if (!\file_exists($key)) {
[72] Fix | Delete
return 0;
[73] Fix | Delete
}
[74] Fix | Delete
return (int) @\filemtime($key);
[75] Fix | Delete
}
[76] Fix | Delete
}
[77] Fix | Delete
\class_alias('WPML\\Core\\Twig\\Cache\\FilesystemCache', 'WPML\\Core\\Twig_Cache_Filesystem');
[78] Fix | Delete
[79] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function