phpBB

Code Changes

File: phpbb/cache/driver/file.php

  Unmodified   Added   Modified   Removed
Line 19Line 19
class file extends \phpbb\cache\driver\base
{
var $var_expires = array();

class file extends \phpbb\cache\driver\base
{
var $var_expires = array();

 

/**
* @var \phpbb\filesystem\filesystem_interface
*/
protected $filesystem;


/**
* Set cache path


/**
* Set cache path

Line 27Line 32
	*/
function __construct($cache_dir = null)
{

	*/
function __construct($cache_dir = null)
{

		global $phpbb_root_path;
$this->cache_dir = !is_null($cache_dir) ? $cache_dir : $phpbb_root_path . 'cache/';








		global $phpbb_container;

$this->cache_dir = !is_null($cache_dir) ? $cache_dir : $phpbb_container->getParameter('core.cache_dir');
$this->filesystem = new \phpbb\filesystem\filesystem();

if (!is_dir($this->cache_dir))
{
@mkdir($this->cache_dir, 0777, true);
}

	}

/**

	}

/**

Line 63Line 75

if (!$this->_write('data_global'))
{


if (!$this->_write('data_global'))
{

			if (!function_exists('phpbb_is_writable'))
{
global $phpbb_root_path;
include($phpbb_root_path . 'includes/functions.' . $phpEx);
}


 
			// Now, this occurred how often? ... phew, just tell the user then...

			// Now, this occurred how often? ... phew, just tell the user then...

			if (!phpbb_is_writable($this->cache_dir))

			if (!$this->filesystem->is_writable($this->cache_dir))

			{
// We need to use die() here, because else we may encounter an infinite loop (the message handler calls $cache->unload())
die('Fatal: ' . $this->cache_dir . ' is NOT writable.');

			{
// We need to use die() here, because else we may encounter an infinite loop (the message handler calls $cache->unload())
die('Fatal: ' . $this->cache_dir . ' is NOT writable.');

Line 89Line 95
	*/
function tidy()
{

	*/
function tidy()
{

		global $phpEx;

		global $config, $phpEx;


$dir = @opendir($this->cache_dir);



$dir = @opendir($this->cache_dir);


Line 143Line 149
			}
}


			}
}


		set_config('cache_last_gc', time(), true);

		$config->set('cache_last_gc', time(), false);

	}

/**

	}

/**

Line 306Line 312
		// Remove extra spaces and tabs
$query = preg_replace('/[\n\r\s\t]+/', ' ', $query);


		// Remove extra spaces and tabs
$query = preg_replace('/[\n\r\s\t]+/', ' ', $query);


		$query_id = sizeof($this->sql_rowset);

		$query_id = md5($query);

		$this->sql_rowset[$query_id] = array();
$this->sql_row_pointer[$query_id] = 0;


		$this->sql_rowset[$query_id] = array();
$this->sql_row_pointer[$query_id] = 0;


Line 316Line 322
		}
$db->sql_freeresult($query_result);


		}
$db->sql_freeresult($query_result);


		if ($this->_write('sql_' . md5($query), $this->sql_rowset[$query_id], $ttl + time(), $query))

		if ($this->_write('sql_' . $query_id, $this->sql_rowset[$query_id], $ttl + time(), $query))

		{
return $query_id;
}

		{
return $query_id;
}

Line 570Line 576

if (function_exists('opcache_invalidate'))
{


if (function_exists('opcache_invalidate'))
{

				@opcache_invalidate($file);

				@opcache_invalidate($this->cache_file);

			}


			}


			if (!function_exists('phpbb_chmod'))

			try

			{

			{

				global $phpbb_root_path;
include($phpbb_root_path . 'includes/functions.' . $phpEx);




				$this->filesystem->phpbb_chmod($file, CHMOD_READ | CHMOD_WRITE);
}
catch (\phpbb\filesystem\exception\filesystem_exception $e)
{
// Do nothing

			}

			}


phpbb_chmod($file, CHMOD_READ | CHMOD_WRITE);

 

$return_value = true;
}


$return_value = true;
}