diff options
Diffstat (limited to 'phpBB')
-rw-r--r-- | phpBB/common.php | 6 | ||||
-rw-r--r-- | phpBB/download/file.php | 6 | ||||
-rw-r--r-- | phpBB/includes/cache/factory.php | 21 | ||||
-rw-r--r-- | phpBB/includes/class_loader.php | 22 | ||||
-rw-r--r-- | phpBB/install/database_update.php | 6 | ||||
-rw-r--r-- | phpBB/install/index.php | 7 | ||||
-rw-r--r-- | phpBB/style.php | 6 |
7 files changed, 32 insertions, 42 deletions
diff --git a/phpBB/common.php b/phpBB/common.php index fc6009eb21..7b6a407c94 100644 --- a/phpBB/common.php +++ b/phpBB/common.php @@ -206,9 +206,9 @@ $class_loader = new phpbb_class_loader($phpbb_root_path, '.' . $phpEx); $class_loader->register(); // set up caching -$acm = phpbb_cache_factory::create($acm_type)->get_acm(); -$class_loader->set_acm($acm); -$cache = new phpbb_cache_service($acm); +$cache_factory = new phpbb_cache_factory($acm_type); +$class_loader->set_cache($cache_factory->get_driver()); +$cache = $cache_factory->get_service(); // Instantiate some basic classes $request = new phpbb_request(); diff --git a/phpBB/download/file.php b/phpBB/download/file.php index 74925fb447..a7e8b9f06c 100644 --- a/phpBB/download/file.php +++ b/phpBB/download/file.php @@ -54,9 +54,9 @@ if (isset($_GET['avatar'])) $class_loader->register(); // set up caching - $acm = phpbb_cache_factory::create($acm_type)->get_acm(); - $class_loader->set_acm($acm); - $cache = new phpbb_cache_service($acm); + $cache_factory = new phpbb_cache_factory($acm_type); + $class_loader->set_cache($cache_factory->get_driver()); + $cache = $cache_factory->get_service(); $db = new $sql_db(); diff --git a/phpBB/includes/cache/factory.php b/phpBB/includes/cache/factory.php index cc88780bf2..f38e19cbe6 100644 --- a/phpBB/includes/cache/factory.php +++ b/phpBB/includes/cache/factory.php @@ -22,31 +22,22 @@ if (!defined('IN_PHPBB')) class phpbb_cache_factory { private $acm_type; - + public function __construct($acm_type) { $this->acm_type = $acm_type; } - - public function get_acm() + + public function get_driver() { $class_name = 'phpbb_cache_driver_' . $this->acm_type; return new $class_name(); } - + public function get_service() { - $acm = $this->get_acm(); - $service = new phpbb_cache_service($acm); + $driver = $this->get_driver(); + $service = new phpbb_cache_service($driver); return $service; } - - /** - * for convenience to allow: - * $cache = phpbb_cache_factory::create('file')->get_service(); - */ - public static function create($acm_type) - { - return new self($acm_type); - } } diff --git a/phpBB/includes/class_loader.php b/phpBB/includes/class_loader.php index fa121341aa..a28d745983 100644 --- a/phpBB/includes/class_loader.php +++ b/phpBB/includes/class_loader.php @@ -33,7 +33,7 @@ class phpbb_class_loader { private $phpbb_root_path; private $php_ext; - private $acm; + private $cache; private $cached_paths = array(); /** @@ -42,14 +42,14 @@ class phpbb_class_loader * * @param string $phpbb_root_path phpBB's root directory containing includes/ * @param string $php_ext The file extension for PHP files - * @param phpbb_acm_interface $acm An implementation of the phpBB cache interface. + * @param phpbb_cache_driver_interface $cache An implementation of the phpBB cache interface. */ - public function __construct($phpbb_root_path, $php_ext = '.php', phpbb_cache_driver_interface $acm = null) + public function __construct($phpbb_root_path, $php_ext = '.php', phpbb_cache_driver_interface $cache = null) { $this->phpbb_root_path = $phpbb_root_path; $this->php_ext = $php_ext; - $this->set_acm($acm); + $this->set_cache($cache); } /** @@ -57,13 +57,13 @@ class phpbb_class_loader * the class loader will resolve paths by checking for the existance of every * directory in the class name every time. * - * @param phpbb_acm_interface $acm An implementation of the phpBB cache interface. + * @param phpbb_cache_driver_interface $cache An implementation of the phpBB cache interface. */ - public function set_acm(phpbb_cache_driver_interface $acm = null) + public function set_cache(phpbb_cache_driver_interface $cache = null) { - if ($acm) + if ($cache) { - $this->cached_paths = $acm->get('class_loader'); + $this->cached_paths = $cache->get('class_loader'); if ($this->cached_paths === false) { @@ -71,7 +71,7 @@ class phpbb_class_loader } } - $this->acm = $acm; + $this->cache = $cache; } /** @@ -134,10 +134,10 @@ class phpbb_class_loader return false; } - if ($this->acm) + if ($this->cache) { $this->cached_paths[$class] = $relative_path; - $this->acm->put('class_loader', $this->cached_paths); + $this->cache->put('class_loader', $this->cached_paths); } return $path_prefix . $relative_path . $this->php_ext; diff --git a/phpBB/install/database_update.php b/phpBB/install/database_update.php index 961edd589f..f73f7472f0 100644 --- a/phpBB/install/database_update.php +++ b/phpBB/install/database_update.php @@ -95,9 +95,9 @@ $class_loader = new phpbb_class_loader($phpbb_root_path, '.' . $phpEx); $class_loader->register(); // set up caching -$acm = phpbb_cache_factory::create($acm_type)->get_acm(); -$class_loader->set_acm($acm); -$cache = new phpbb_cache_service($acm); +$cache_factory = new phpbb_cache_factory($acm_type); +$class_loader->set_cache($cache_factory->get_driver()); +$cache = $cache_factory->get_service(); $request = new phpbb_request(); $user = new user(); diff --git a/phpBB/install/index.php b/phpBB/install/index.php index 6486eb09d8..653268ba68 100644 --- a/phpBB/install/index.php +++ b/phpBB/install/index.php @@ -171,9 +171,9 @@ $class_loader = new phpbb_class_loader($phpbb_root_path, '.' . $phpEx); $class_loader->register(); // set up caching -$acm = phpbb_cache_factory::create($acm_type)->get_acm(); -$class_loader->set_acm($acm); -$cache = new phpbb_cache_service($acm); +$cache_factory = new phpbb_cache_factory('file'); +$class_loader->set_cache($cache_factory->get_driver()); +$cache = $cache_factory->get_service(); $request = new phpbb_request(); @@ -262,7 +262,6 @@ set_error_handler(defined('PHPBB_MSG_HANDLER') ? PHPBB_MSG_HANDLER : 'msg_handle $user = new user(); $auth = new auth(); -$cache = new cache(); $template = new template(); // Add own hook handler, if present. :o diff --git a/phpBB/style.php b/phpBB/style.php index 418bbb9bab..cff91a2312 100644 --- a/phpBB/style.php +++ b/phpBB/style.php @@ -65,9 +65,9 @@ if ($id) $class_loader->register(); // set up caching - $acm = phpbb_cache_factory::create($acm_type)->get_acm(); - $class_loader->set_acm($acm); - $cache = new phpbb_cache_service($acm); + $cache_factory = new phpbb_cache_factory($acm_type); + $class_loader->set_cache($cache_factory->get_driver()); + $cache = $cache_factory->get_service(); $request = new phpbb_request(); $db = new $sql_db(); |