aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB/phpbb/cache/driver/file.php
diff options
context:
space:
mode:
Diffstat (limited to 'phpBB/phpbb/cache/driver/file.php')
-rw-r--r--phpBB/phpbb/cache/driver/file.php56
1 files changed, 27 insertions, 29 deletions
diff --git a/phpBB/phpbb/cache/driver/file.php b/phpBB/phpbb/cache/driver/file.php
index 944dfd6541..286ba328c3 100644
--- a/phpBB/phpbb/cache/driver/file.php
+++ b/phpBB/phpbb/cache/driver/file.php
@@ -7,19 +7,13 @@
*
*/
-/**
-* @ignore
-*/
-if (!defined('IN_PHPBB'))
-{
- exit;
-}
+namespace phpbb\cache\driver;
/**
* ACM File Based Caching
* @package acm
*/
-class phpbb_cache_driver_file extends phpbb_cache_driver_base
+class file extends \phpbb\cache\driver\base
{
var $vars = array();
var $var_expires = array();
@@ -39,7 +33,7 @@ class phpbb_cache_driver_file extends phpbb_cache_driver_base
}
/**
- * Load global cache
+ * {@inheritDoc}
*/
function load()
{
@@ -47,7 +41,7 @@ class phpbb_cache_driver_file extends phpbb_cache_driver_base
}
/**
- * Unload cache object
+ * {@inheritDoc}
*/
function unload()
{
@@ -64,7 +58,7 @@ class phpbb_cache_driver_file extends phpbb_cache_driver_base
}
/**
- * Save modified objects
+ * {@inheritDoc}
*/
function save()
{
@@ -99,7 +93,7 @@ class phpbb_cache_driver_file extends phpbb_cache_driver_base
}
/**
- * Tidy cache
+ * {@inheritDoc}
*/
function tidy()
{
@@ -161,7 +155,7 @@ class phpbb_cache_driver_file extends phpbb_cache_driver_base
}
/**
- * Get saved cache object
+ * {@inheritDoc}
*/
function get($var_name)
{
@@ -183,7 +177,7 @@ class phpbb_cache_driver_file extends phpbb_cache_driver_base
}
/**
- * Put data into cache
+ * {@inheritDoc}
*/
function put($var_name, $var, $ttl = 31536000)
{
@@ -200,14 +194,14 @@ class phpbb_cache_driver_file extends phpbb_cache_driver_base
}
/**
- * Purge cache data
+ * {@inheritDoc}
*/
function purge()
{
// Purge all phpbb cache files
- try
+ try
{
- $iterator = new DirectoryIterator($this->cache_dir);
+ $iterator = new \DirectoryIterator($this->cache_dir);
}
catch (Exception $e)
{
@@ -256,9 +250,9 @@ class phpbb_cache_driver_file extends phpbb_cache_driver_base
*/
protected function remove_dir($dir)
{
- try
+ try
{
- $iterator = new DirectoryIterator($dir);
+ $iterator = new \DirectoryIterator($dir);
}
catch (Exception $e)
{
@@ -286,7 +280,7 @@ class phpbb_cache_driver_file extends phpbb_cache_driver_base
}
/**
- * Destroy cache data
+ * {@inheritDoc}
*/
function destroy($var_name, $table = '')
{
@@ -365,7 +359,7 @@ class phpbb_cache_driver_file extends phpbb_cache_driver_base
}
/**
- * Check if a given cache entry exist
+ * {@inheritDoc}
*/
function _exists($var_name)
{
@@ -391,7 +385,7 @@ class phpbb_cache_driver_file extends phpbb_cache_driver_base
}
/**
- * Load cached sql query
+ * {@inheritDoc}
*/
function sql_load($query)
{
@@ -413,7 +407,7 @@ class phpbb_cache_driver_file extends phpbb_cache_driver_base
/**
* {@inheritDoc}
*/
- function sql_save(phpbb_db_driver $db, $query, $query_result, $ttl)
+ function sql_save(\phpbb\db\driver\driver_interface $db, $query, $query_result, $ttl)
{
// Remove extra spaces and tabs
$query = preg_replace('/[\n\r\s\t]+/', ' ', $query);
@@ -437,7 +431,7 @@ class phpbb_cache_driver_file extends phpbb_cache_driver_base
}
/**
- * Ceck if a given sql query exist in cache
+ * {@inheritDoc}
*/
function sql_exists($query_id)
{
@@ -445,7 +439,7 @@ class phpbb_cache_driver_file extends phpbb_cache_driver_base
}
/**
- * Fetch row from cache (database)
+ * {@inheritDoc}
*/
function sql_fetchrow($query_id)
{
@@ -458,7 +452,7 @@ class phpbb_cache_driver_file extends phpbb_cache_driver_base
}
/**
- * Fetch a field from the current row of a cached database result (database)
+ * {@inheritDoc}
*/
function sql_fetchfield($query_id, $field)
{
@@ -471,7 +465,7 @@ class phpbb_cache_driver_file extends phpbb_cache_driver_base
}
/**
- * Seek a specific row in an a cached database result (database)
+ * {@inheritDoc}
*/
function sql_rowseek($rownum, $query_id)
{
@@ -485,7 +479,7 @@ class phpbb_cache_driver_file extends phpbb_cache_driver_base
}
/**
- * Free memory used for a cached database result (database)
+ * {@inheritDoc}
*/
function sql_freeresult($query_id)
{
@@ -695,7 +689,7 @@ class phpbb_cache_driver_file extends phpbb_cache_driver_base
$file = "{$this->cache_dir}$filename.$phpEx";
- $lock = new phpbb_lock_flock($file);
+ $lock = new \phpbb\lock\flock($file);
$lock->acquire();
if ($handle = @fopen($file, 'wb'))
@@ -764,6 +758,10 @@ class phpbb_cache_driver_file extends phpbb_cache_driver_base
/**
* Removes/unlinks file
+ *
+ * @param string $filename Filename to remove
+ * @param bool $check Check file permissions
+ * @return bool True if the file was successfully removed, otherwise false
*/
function remove_file($filename, $check = false)
{