aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB/phpbb/extension/manager.php
diff options
context:
space:
mode:
authorEtienne Baroux <barouxe@phelma.grenoble-inp.fr>2014-06-02 10:12:18 +0200
committerTristan Darricau <github@nicofuma.fr>2016-12-03 16:37:35 +0100
commit346f31a03156839d1b1931d2fc69cd2ab5656bc0 (patch)
treeaed312ce3f9e890a260a02132119cdfff8764d9b /phpBB/phpbb/extension/manager.php
parent17e8726582df3e3115893668c7b1ea39b87028ba (diff)
downloadforums-346f31a03156839d1b1931d2fc69cd2ab5656bc0.tar
forums-346f31a03156839d1b1931d2fc69cd2ab5656bc0.tar.gz
forums-346f31a03156839d1b1931d2fc69cd2ab5656bc0.tar.bz2
forums-346f31a03156839d1b1931d2fc69cd2ab5656bc0.tar.xz
forums-346f31a03156839d1b1931d2fc69cd2ab5656bc0.zip
[ticket/12610] Add command to check if the board is up to date.
PHPBB3-12610
Diffstat (limited to 'phpBB/phpbb/extension/manager.php')
-rw-r--r--phpBB/phpbb/extension/manager.php38
1 files changed, 33 insertions, 5 deletions
diff --git a/phpBB/phpbb/extension/manager.php b/phpBB/phpbb/extension/manager.php
index 98d2d27278..6cdc8c0cc7 100644
--- a/phpBB/phpbb/extension/manager.php
+++ b/phpBB/phpbb/extension/manager.php
@@ -42,10 +42,10 @@ class manager
* @param string $extension_table The name of the table holding extensions
* @param string $phpbb_root_path Path to the phpbb includes directory.
* @param string $php_ext php file extension, defaults to php
- * @param \phpbb\cache\driver\driver_interface $cache A cache instance or null
+ * @param \phpbb\cache\service $cache A cache instance or null
* @param string $cache_name The name of the cache variable, defaults to _ext
*/
- public function __construct(ContainerInterface $container, \phpbb\db\driver\driver_interface $db, \phpbb\config\config $config, \phpbb\filesystem\filesystem_interface $filesystem, $extension_table, $phpbb_root_path, $php_ext = 'php', \phpbb\cache\driver\driver_interface $cache = null, $cache_name = '_ext')
+ public function __construct(ContainerInterface $container, \phpbb\db\driver\driver_interface $db, \phpbb\config\config $config, \phpbb\filesystem\filesystem_interface $filesystem, $extension_table, $phpbb_root_path, $php_ext = 'php', \phpbb\cache\service $cache = null, $cache_name = '_ext')
{
$this->cache = $cache;
$this->cache_name = $cache_name;
@@ -146,12 +146,11 @@ class manager
* Instantiates the metadata manager for the extension with the given name
*
* @param string $name The extension name
- * @param \phpbb\template\template $template The template manager
* @return \phpbb\extension\metadata_manager Instance of the metadata manager
*/
- public function create_extension_metadata_manager($name, \phpbb\template\template $template)
+ public function create_extension_metadata_manager($name)
{
- return new \phpbb\extension\metadata_manager($name, $this->config, $this, $template, $this->phpbb_root_path);
+ return new \phpbb\extension\metadata_manager($name, $this->config, $this, $this->phpbb_root_path);
}
/**
@@ -566,6 +565,35 @@ class manager
}
/**
+ * Check the version and return the available updates (for an extension).
+ *
+ * @param \phpbb\extension\metadata_manager $md_manager The metadata manager for the version to check.
+ * @param bool $force_update Ignores cached data. Defaults to false.
+ * @param bool $force_cache Force the use of the cache. Override $force_update.
+ * @param string $stability Force the stability (null by default).
+ * @return string
+ * @throws \RuntimeException
+ */
+ public function version_check(\phpbb\extension\metadata_manager $md_manager, $force_update = false, $force_cache = false, $stability = null)
+ {
+ $meta = $md_manager->get_metadata('all');
+
+ if (!isset($meta['extra']['version-check']))
+ {
+ throw new \RuntimeException($this->user->lang('NO_VERSIONCHECK'), 1);
+ }
+
+ $version_check = $meta['extra']['version-check'];
+
+ $version_helper = new \phpbb\version_helper($this->cache, $this->config, $this->user);
+ $version_helper->set_current_version($meta['version']);
+ $version_helper->set_file_location($version_check ['host'], $version_check ['directory'], $version_check ['filename']);
+ $version_helper->force_stability($stability);
+
+ return $updates = $version_helper->get_suggested_updates($force_update, $force_cache);
+ }
+
+ /**
* Check to see if a given extension is purged
*
* An extension is purged if it is available, not enabled and not disabled.