diff options
Diffstat (limited to 'phpBB/phpbb/cache')
| -rw-r--r-- | phpBB/phpbb/cache/driver/base.php | 8 | ||||
| -rw-r--r-- | phpBB/phpbb/cache/driver/dummy.php (renamed from phpBB/phpbb/cache/driver/null.php) | 4 | ||||
| -rw-r--r-- | phpBB/phpbb/cache/driver/file.php | 25 | ||||
| -rw-r--r-- | phpBB/phpbb/cache/driver/memcache.php | 2 | ||||
| -rw-r--r-- | phpBB/phpbb/cache/service.php | 1 | 
5 files changed, 19 insertions, 21 deletions
| diff --git a/phpBB/phpbb/cache/driver/base.php b/phpBB/phpbb/cache/driver/base.php index c83b928a12..55cd4668de 100644 --- a/phpBB/phpbb/cache/driver/base.php +++ b/phpBB/phpbb/cache/driver/base.php @@ -177,13 +177,9 @@ abstract class base implements \phpbb\cache\driver\driver_interface  	*/  	function remove_file($filename, $check = false)  	{ -		if (!function_exists('phpbb_is_writable')) -		{ -			global $phpbb_root_path, $phpEx; -			include($phpbb_root_path . 'includes/functions.' . $phpEx); -		} +		global $phpbb_filesystem; -		if ($check && !phpbb_is_writable($this->cache_dir)) +		if ($check && !$phpbb_filesystem->is_writable($this->cache_dir))  		{  			// E_USER_ERROR - not using language entry - intended.  			trigger_error('Unable to remove files within ' . $this->cache_dir . '. Please check directory permissions.', E_USER_ERROR); diff --git a/phpBB/phpbb/cache/driver/null.php b/phpBB/phpbb/cache/driver/dummy.php index 298731ea54..1f74f6dd77 100644 --- a/phpBB/phpbb/cache/driver/null.php +++ b/phpBB/phpbb/cache/driver/dummy.php @@ -14,9 +14,9 @@  namespace phpbb\cache\driver;  /** -* ACM Null Caching +* ACM dummy Caching  */ -class null extends \phpbb\cache\driver\base +class dummy extends \phpbb\cache\driver\base  {  	/**  	* Set cache path diff --git a/phpBB/phpbb/cache/driver/file.php b/phpBB/phpbb/cache/driver/file.php index 32086458ee..bb055d3acf 100644 --- a/phpBB/phpbb/cache/driver/file.php +++ b/phpBB/phpbb/cache/driver/file.php @@ -21,6 +21,11 @@ class file extends \phpbb\cache\driver\base  	var $var_expires = array();  	/** +	 * @var	\phpbb\filesystem\filesystem_interface +	 */ +	protected $filesystem; + +	/**  	* Set cache path  	*  	* @param string $cache_dir Define the path to the cache directory (default: $phpbb_root_path . 'cache/') @@ -30,6 +35,7 @@ class file extends \phpbb\cache\driver\base  		global $phpbb_root_path, $phpbb_container;  		$this->cache_dir = !is_null($cache_dir) ? $cache_dir : $phpbb_root_path . 'cache/' . $phpbb_container->getParameter('core.environment') . '/'; +		$this->filesystem = new \phpbb\filesystem\filesystem();  		if (!is_dir($this->cache_dir))  		{ @@ -69,14 +75,8 @@ class file extends \phpbb\cache\driver\base  		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... -			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.'); @@ -574,13 +574,14 @@ class file extends \phpbb\cache\driver\base  			fclose($handle); -			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;  		} diff --git a/phpBB/phpbb/cache/driver/memcache.php b/phpBB/phpbb/cache/driver/memcache.php index 406ab11ddd..caa82fb0b1 100644 --- a/phpBB/phpbb/cache/driver/memcache.php +++ b/phpBB/phpbb/cache/driver/memcache.php @@ -50,7 +50,7 @@ class memcache extends \phpbb\cache\driver\memory  		parent::__construct();  		$this->memcache = new \Memcache; -		foreach(explode(',', PHPBB_ACM_MEMCACHE) as $u) +		foreach (explode(',', PHPBB_ACM_MEMCACHE) as $u)  		{  			$parts = explode('/', $u);  			$this->memcache->addServer(trim($parts[0]), trim($parts[1])); diff --git a/phpBB/phpbb/cache/service.php b/phpBB/phpbb/cache/service.php index 56727c2ad5..a022c00bc6 100644 --- a/phpBB/phpbb/cache/service.php +++ b/phpBB/phpbb/cache/service.php @@ -141,6 +141,7 @@ class service  				$icons[$row['icons_id']]['img'] = $row['icons_url'];  				$icons[$row['icons_id']]['width'] = (int) $row['icons_width'];  				$icons[$row['icons_id']]['height'] = (int) $row['icons_height']; +				$icons[$row['icons_id']]['alt'] = ($row['icons_alt']) ? $row['icons_alt'] : '';  				$icons[$row['icons_id']]['display'] = (bool) $row['display_on_posting'];  			}  			$this->db->sql_freeresult($result); | 
