diff options
author | Joas Schilling <nickvergessen@gmx.de> | 2014-08-07 13:00:08 +0200 |
---|---|---|
committer | Joas Schilling <nickvergessen@gmx.de> | 2014-08-07 13:00:08 +0200 |
commit | f474e33a430176fd7ef809141b258eec77993e03 (patch) | |
tree | 461209e195862e42360c4d60a45d8c7c55c16d96 /phpBB/phpbb | |
parent | 2f44a865a01d1c9d1198484c7a9e841c22ef267d (diff) | |
parent | 519e64205a50b15efa8589901c87f5b21448993a (diff) | |
download | forums-f474e33a430176fd7ef809141b258eec77993e03.tar forums-f474e33a430176fd7ef809141b258eec77993e03.tar.gz forums-f474e33a430176fd7ef809141b258eec77993e03.tar.bz2 forums-f474e33a430176fd7ef809141b258eec77993e03.tar.xz forums-f474e33a430176fd7ef809141b258eec77993e03.zip |
Merge pull request #2729 from Nicofuma/ticket/12847
[ticket/12847] Allow the extensions to say if they can be enabled
* Nicofuma/ticket/12847:
[ticket/12847] Allow the extensions to say if they can be enabled
Diffstat (limited to 'phpBB/phpbb')
-rw-r--r-- | phpBB/phpbb/extension/base.php | 8 | ||||
-rw-r--r-- | phpBB/phpbb/extension/extension_interface.php | 7 | ||||
-rw-r--r-- | phpBB/phpbb/extension/manager.php | 6 |
3 files changed, 21 insertions, 0 deletions
diff --git a/phpBB/phpbb/extension/base.php b/phpBB/phpbb/extension/base.php index 53051ce881..288fb7d19c 100644 --- a/phpBB/phpbb/extension/base.php +++ b/phpBB/phpbb/extension/base.php @@ -55,6 +55,14 @@ class base implements \phpbb\extension\extension_interface } /** + * {@inheritdoc} + */ + public function is_enableable() + { + return true; + } + + /** * Single enable step that installs any included migrations * * @param mixed $old_state State returned by previous call of this method diff --git a/phpBB/phpbb/extension/extension_interface.php b/phpBB/phpbb/extension/extension_interface.php index cc8b8be980..6a6b6adb8f 100644 --- a/phpBB/phpbb/extension/extension_interface.php +++ b/phpBB/phpbb/extension/extension_interface.php @@ -20,6 +20,13 @@ namespace phpbb\extension; interface extension_interface { /** + * Indicate whether or not the extension can be enabled. + * + * @return bool + */ + public function is_enableable(); + + /** * enable_step is executed on enabling an extension until it returns false. * * Calls to this function can be made in subsequent requests, when the diff --git a/phpBB/phpbb/extension/manager.php b/phpBB/phpbb/extension/manager.php index 4a12e9ec8c..76f0e3558e 100644 --- a/phpBB/phpbb/extension/manager.php +++ b/phpBB/phpbb/extension/manager.php @@ -178,6 +178,12 @@ class manager $old_state = (isset($this->extensions[$name]['ext_state'])) ? unserialize($this->extensions[$name]['ext_state']) : false; $extension = $this->get_extension($name); + + if (!$extension->is_enableable()) + { + return false; + } + $state = $extension->enable_step($old_state); $active = ($state === false); |