1
0
mirror of https://github.com/phpbb/phpbb.git synced 2025-07-31 22:10:45 +02:00

[ticket/11700] Move all recent code to namespaces

PHPBB3-11700
This commit is contained in:
Nils Adermann
2013-09-10 14:01:09 +02:00
parent 196e1813cd
commit b95fdacdd3
420 changed files with 2316 additions and 1840 deletions

View File

@@ -7,6 +7,8 @@
*
*/
namespace phpbb\cache\driver;
/**
* @ignore
*/
@@ -19,7 +21,7 @@ if (!defined('IN_PHPBB'))
* ACM for APC
* @package acm
*/
class phpbb_cache_driver_apc extends phpbb_cache_driver_memory
class apc extends \phpbb\cache\driver\memory
{
var $extension = 'apc';

View File

@@ -7,6 +7,8 @@
*
*/
namespace phpbb\cache\driver;
/**
* @ignore
*/
@@ -18,6 +20,6 @@ if (!defined('IN_PHPBB'))
/**
* @package acm
*/
abstract class phpbb_cache_driver_base implements phpbb_cache_driver_driver_interface
abstract class base implements \phpbb\cache\driver\driver_interface
{
}

View File

@@ -7,6 +7,8 @@
*
*/
namespace phpbb\cache\driver;
/**
* @ignore
*/
@@ -20,7 +22,7 @@ if (!defined('IN_PHPBB'))
*
* @package acm
*/
interface phpbb_cache_driver_driver_interface
interface driver_interface
{
/**
* Load global cache
@@ -85,10 +87,10 @@ interface phpbb_cache_driver_driver_interface
* result to persistent storage. In other words, there is no need
* to call save() afterwards.
*
* @param phpbb_db_driver $db Database connection
* @param \phpbb\db\driver\driver $db Database connection
* @param string $query SQL query, should be used for generating storage key
* @param mixed $query_result The result from dbal::sql_query, to be passed to
* dbal::sql_fetchrow to get all rows and store them
* @param mixed $query_result The result from \dbal::sql_query, to be passed to
* \dbal::sql_fetchrow to get all rows and store them
* in cache.
* @param int $ttl Time to live, after this timeout the query should
* expire from the cache.
@@ -96,7 +98,7 @@ interface phpbb_cache_driver_driver_interface
* representing the query should be returned. Otherwise
* the original $query_result should be returned.
*/
public function sql_save(phpbb_db_driver $db, $query, $query_result, $ttl);
public function sql_save(\phpbb\db\driver\driver $db, $query, $query_result, $ttl);
/**
* Check if result for a given SQL query exists in cache.

View File

@@ -7,6 +7,8 @@
*
*/
namespace phpbb\cache\driver;
/**
* @ignore
*/
@@ -20,7 +22,7 @@ if (!defined('IN_PHPBB'))
* @package acm
* @todo Missing locks from destroy() talk with David
*/
class phpbb_cache_driver_eaccelerator extends phpbb_cache_driver_memory
class eaccelerator extends \phpbb\cache\driver\memory
{
var $extension = 'eaccelerator';
var $function = 'eaccelerator_get';

View File

@@ -7,6 +7,8 @@
*
*/
namespace phpbb\cache\driver;
/**
* @ignore
*/
@@ -19,7 +21,7 @@ if (!defined('IN_PHPBB'))
* 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();
@@ -369,7 +371,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 $db, $query, $query_result, $ttl)
{
// Remove extra spaces and tabs
$query = preg_replace('/[\n\r\s\t]+/', ' ', $query);
@@ -651,7 +653,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'))

View File

@@ -7,6 +7,8 @@
*
*/
namespace phpbb\cache\driver;
/**
* @ignore
*/
@@ -40,7 +42,7 @@ if (!defined('PHPBB_ACM_MEMCACHE'))
* ACM for Memcached
* @package acm
*/
class phpbb_cache_driver_memcache extends phpbb_cache_driver_memory
class memcache extends \phpbb\cache\driver\memory
{
var $extension = 'memcache';
@@ -52,7 +54,7 @@ class phpbb_cache_driver_memcache extends phpbb_cache_driver_memory
// Call the parent constructor
parent::__construct();
$this->memcache = new Memcache;
$this->memcache = new \Memcache;
foreach(explode(',', PHPBB_ACM_MEMCACHE) as $u)
{
$parts = explode('/', $u);

View File

@@ -7,6 +7,8 @@
*
*/
namespace phpbb\cache\driver;
/**
* @ignore
*/
@@ -19,7 +21,7 @@ if (!defined('IN_PHPBB'))
* ACM Abstract Memory Class
* @package acm
*/
abstract class phpbb_cache_driver_memory extends phpbb_cache_driver_base
abstract class memory extends \phpbb\cache\driver\base
{
var $key_prefix;
@@ -285,7 +287,7 @@ abstract class phpbb_cache_driver_memory extends phpbb_cache_driver_base
/**
* {@inheritDoc}
*/
function sql_save(phpbb_db_driver $db, $query, $query_result, $ttl)
function sql_save(\phpbb\db\driver\driver $db, $query, $query_result, $ttl)
{
// Remove extra spaces and tabs
$query = preg_replace('/[\n\r\s\t]+/', ' ', $query);

View File

@@ -7,6 +7,8 @@
*
*/
namespace phpbb\cache\driver;
/**
* @ignore
*/
@@ -19,7 +21,7 @@ if (!defined('IN_PHPBB'))
* ACM Null Caching
* @package acm
*/
class phpbb_cache_driver_null extends phpbb_cache_driver_base
class null extends \phpbb\cache\driver\base
{
/**
* Set cache path
@@ -107,7 +109,7 @@ class phpbb_cache_driver_null extends phpbb_cache_driver_base
/**
* {@inheritDoc}
*/
function sql_save(phpbb_db_driver $db, $query, $query_result, $ttl)
function sql_save(\phpbb\db\driver\driver $db, $query, $query_result, $ttl)
{
return $query_result;
}

View File

@@ -7,6 +7,8 @@
*
*/
namespace phpbb\cache\driver;
/**
* @ignore
*/
@@ -33,7 +35,7 @@ if (!defined('PHPBB_ACM_REDIS_HOST'))
*
* @package acm
*/
class phpbb_cache_driver_redis extends phpbb_cache_driver_memory
class redis extends \phpbb\cache\driver\memory
{
var $extension = 'redis';
@@ -56,7 +58,7 @@ class phpbb_cache_driver_redis extends phpbb_cache_driver_memory
// Call the parent constructor
parent::__construct();
$this->redis = new Redis();
$this->redis = new \Redis();
$args = func_get_args();
if (!empty($args))
@@ -83,8 +85,8 @@ class phpbb_cache_driver_redis extends phpbb_cache_driver_memory
}
}
$this->redis->setOption(Redis::OPT_SERIALIZER, Redis::SERIALIZER_PHP);
$this->redis->setOption(Redis::OPT_PREFIX, $this->key_prefix);
$this->redis->setOption(\Redis::OPT_SERIALIZER, \Redis::SERIALIZER_PHP);
$this->redis->setOption(\Redis::OPT_PREFIX, $this->key_prefix);
if (defined('PHPBB_ACM_REDIS_DB'))
{

View File

@@ -7,6 +7,8 @@
*
*/
namespace phpbb\cache\driver;
/**
* @ignore
*/
@@ -19,7 +21,7 @@ if (!defined('IN_PHPBB'))
* ACM for WinCache
* @package acm
*/
class phpbb_cache_driver_wincache extends phpbb_cache_driver_memory
class wincache extends \phpbb\cache\driver\memory
{
var $extension = 'wincache';

View File

@@ -7,6 +7,8 @@
*
*/
namespace phpbb\cache\driver;
/**
* @ignore
*/
@@ -24,7 +26,7 @@ if (!defined('IN_PHPBB'))
* - xcache.admin.enable_auth = off (or xcache.admin.user and xcache.admin.password set)
*
*/
class phpbb_cache_driver_xcache extends phpbb_cache_driver_memory
class xcache extends \phpbb\cache\driver\memory
{
var $extension = 'XCache';

View File

@@ -7,6 +7,8 @@
*
*/
namespace phpbb\cache;
/**
* @ignore
*/
@@ -19,26 +21,26 @@ if (!defined('IN_PHPBB'))
* Class for grabbing/handling cached entries
* @package acm
*/
class phpbb_cache_service
class service
{
/**
* Cache driver.
*
* @var phpbb_cache_driver_driver_interface
* @var \phpbb\cache\driver\driver_interface
*/
protected $driver;
/**
* The config.
*
* @var phpbb_config
* @var \phpbb\config\config
*/
protected $config;
/**
* Database connection.
*
* @var phpbb_db_driver
* @var \phpbb\db\driver\driver
*/
protected $db;
@@ -59,13 +61,13 @@ class phpbb_cache_service
/**
* Creates a cache service around a cache driver
*
* @param phpbb_cache_driver_driver_interface $driver The cache driver
* @param phpbb_config $config The config
* @param phpbb_db_driver $db Database connection
* @param \phpbb\cache\driver\driver_interface $driver The cache driver
* @param \phpbb\config\config $config The config
* @param \phpbb\db\driver\driver $db Database connection
* @param string $phpbb_root_path Root path
* @param string $php_ext PHP extension
*/
public function __construct(phpbb_cache_driver_driver_interface $driver, phpbb_config $config, phpbb_db_driver $db, $phpbb_root_path, $php_ext)
public function __construct(\phpbb\cache\driver\driver_interface $driver, \phpbb\config\config $config, \phpbb\db\driver\driver $db, $phpbb_root_path, $php_ext)
{
$this->set_driver($driver);
$this->config = $config;
@@ -77,7 +79,7 @@ class phpbb_cache_service
/**
* Returns the cache driver used by this cache service.
*
* @return phpbb_cache_driver_driver_interface The cache driver
* @return \phpbb\cache\driver\driver_interface The cache driver
*/
public function get_driver()
{
@@ -87,9 +89,9 @@ class phpbb_cache_service
/**
* Replaces the cache driver used by this cache service.
*
* @param phpbb_cache_driver_driver_interface $driver The cache driver
* @param \phpbb\cache\driver\driver_interface $driver The cache driver
*/
public function set_driver(phpbb_cache_driver_driver_interface $driver)
public function set_driver(\phpbb\cache\driver\driver_interface $driver)
{
$this->driver = $driver;
}