aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB/includes/extension/manager.php
diff options
context:
space:
mode:
Diffstat (limited to 'phpBB/includes/extension/manager.php')
-rw-r--r--phpBB/includes/extension/manager.php52
1 files changed, 39 insertions, 13 deletions
diff --git a/phpBB/includes/extension/manager.php b/phpBB/includes/extension/manager.php
index 537c19aff8..bfd4edde93 100644
--- a/phpBB/includes/extension/manager.php
+++ b/phpBB/includes/extension/manager.php
@@ -22,8 +22,10 @@ if (!defined('IN_PHPBB'))
*/
class phpbb_extension_manager
{
+ protected $db;
+ protected $config;
protected $cache;
- protected $phpEx;
+ protected $php_ext;
protected $extensions;
protected $extension_table;
protected $phpbb_root_path;
@@ -33,18 +35,20 @@ class phpbb_extension_manager
* Creates a manager and loads information from database
*
* @param dbal $db A database connection
+ * @param phpbb_config $config phpbb_config
* @param string $extension_table The name of the table holding extensions
* @param string $phpbb_root_path Path to the phpbb includes directory.
- * @param string $phpEx php file extension
+ * @param string $php_ext php file extension
* @param phpbb_cache_driver_interface $cache A cache instance or null
* @param string $cache_name The name of the cache variable, defaults to _ext
*/
- public function __construct(dbal $db, $extension_table, $phpbb_root_path, $phpEx = '.php', phpbb_cache_driver_interface $cache = null, $cache_name = '_ext')
+ public function __construct(dbal $db, phpbb_config $config, $extension_table, $phpbb_root_path, $php_ext = '.php', phpbb_cache_driver_interface $cache = null, $cache_name = '_ext')
{
$this->phpbb_root_path = $phpbb_root_path;
$this->db = $db;
+ $this->config = $config;
$this->cache = $cache;
- $this->phpEx = $phpEx;
+ $this->php_ext = $php_ext;
$this->extension_table = $extension_table;
$this->cache_name = $cache_name;
@@ -63,6 +67,17 @@ class phpbb_extension_manager
*/
public function load_extensions()
{
+ $this->extensions = array();
+
+ // Do not try to load any extensions when installing or updating
+ // Note: database updater invokes this code, and in 3.0
+ // there is no extension table therefore the rest of this function
+ // fails
+ if (defined('IN_INSTALL'))
+ {
+ return;
+ }
+
$sql = 'SELECT *
FROM ' . $this->extension_table;
@@ -70,7 +85,6 @@ class phpbb_extension_manager
$extensions = $this->db->sql_fetchrowset($result);
$this->db->sql_freeresult($result);
- $this->extensions = array();
foreach ($extensions as $extension)
{
$extension['ext_path'] = $this->get_extension_path($extension['ext_name']);
@@ -121,6 +135,18 @@ class phpbb_extension_manager
}
/**
+ * Instantiates the metadata manager for the extension with the given name
+ *
+ * @param string $name The extension name
+ * @param string $template The template manager
+ * @return phpbb_extension_metadata_manager Instance of the metadata manager
+ */
+ public function create_extension_metadata_manager($name, phpbb_template $template)
+ {
+ return new phpbb_extension_metadata_manager($name, $this->db, $this, $this->phpbb_root_path, $this->php_ext, $template, $this->config);
+ }
+
+ /**
* Runs a step of the extension enabling process.
*
* Allows the exentension to enable in a long running script that works
@@ -169,7 +195,7 @@ class phpbb_extension_manager
if ($this->cache)
{
- $this->cache->destroy($this->cache_name);
+ $this->cache->purge();
}
return !$active;
@@ -226,7 +252,7 @@ class phpbb_extension_manager
if ($this->cache)
{
- $this->cache->destroy($this->cache_name);
+ $this->cache->purge();
}
return true;
@@ -246,7 +272,7 @@ class phpbb_extension_manager
if ($this->cache)
{
- $this->cache->destroy($this->cache_name);
+ $this->cache->purge();
}
return false;
@@ -309,7 +335,7 @@ class phpbb_extension_manager
if ($this->cache)
{
- $this->cache->destroy($this->cache_name);
+ $this->cache->purge();
}
return true;
@@ -323,7 +349,7 @@ class phpbb_extension_manager
if ($this->cache)
{
- $this->cache->destroy($this->cache_name);
+ $this->cache->purge();
}
return false;
@@ -362,7 +388,7 @@ class phpbb_extension_manager
RecursiveIteratorIterator::SELF_FIRST);
foreach ($iterator as $file_info)
{
- if ($file_info->isFile() && $file_info->getFilename() == 'ext' . $this->phpEx)
+ if ($file_info->isFile() && $file_info->getFilename() == 'ext' . $this->php_ext)
{
$ext_name = $iterator->getInnerIterator()->getSubPath();
@@ -432,7 +458,7 @@ class phpbb_extension_manager
}
return $disabled;
}
-
+
/**
* Check to see if a given extension is available on the filesystem
*
@@ -462,6 +488,6 @@ class phpbb_extension_manager
*/
public function get_finder()
{
- return new phpbb_extension_finder($this, $this->phpbb_root_path, $this->cache, $this->phpEx, $this->cache_name . '_finder');
+ return new phpbb_extension_finder($this, $this->phpbb_root_path, $this->cache, $this->php_ext, $this->cache_name . '_finder');
}
}