aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB/phpbb/extension
diff options
context:
space:
mode:
authorJoas Schilling <nickvergessen@gmx.de>2014-06-29 23:33:47 +0200
committerJoas Schilling <nickvergessen@gmx.de>2014-06-29 23:33:47 +0200
commit5652f33ccca36b093a20033f17cb42ec79a581da (patch)
tree90f7bae5fae10cc031b84ad6071776cfd9cb1cac /phpBB/phpbb/extension
parent404c2f11448f53e55eca4cfdf082671230711241 (diff)
parentdaeb635d6c27d94fe2f7135ab4d921da5d870447 (diff)
downloadforums-5652f33ccca36b093a20033f17cb42ec79a581da.tar
forums-5652f33ccca36b093a20033f17cb42ec79a581da.tar.gz
forums-5652f33ccca36b093a20033f17cb42ec79a581da.tar.bz2
forums-5652f33ccca36b093a20033f17cb42ec79a581da.tar.xz
forums-5652f33ccca36b093a20033f17cb42ec79a581da.zip
Merge pull request #2669 from Nicofuma/ticket/12777
[ticket/12777] Rename extension status functions and add is_configured() * Nicofuma/ticket/12777: [ticket/12777] Add tests for unavailable extension [ticket/12777] Add tests [ticket/12777] Add is_purged() [ticket/12777] Update doc block of is_configured() [ticket/12777] Rename extension status functions and add is_configured()
Diffstat (limited to 'phpBB/phpbb/extension')
-rw-r--r--phpBB/phpbb/extension/manager.php42
1 files changed, 40 insertions, 2 deletions
diff --git a/phpBB/phpbb/extension/manager.php b/phpBB/phpbb/extension/manager.php
index 4130e8455a..b19eb9f8a3 100644
--- a/phpBB/phpbb/extension/manager.php
+++ b/phpBB/phpbb/extension/manager.php
@@ -515,7 +515,7 @@ class manager
* @param string $name Extension name to check NOTE: Can be user input
* @return bool Depending on whether or not the extension is available
*/
- public function available($name)
+ public function is_available($name)
{
return file_exists($this->get_extension_path($name, true));
}
@@ -526,12 +526,50 @@ class manager
* @param string $name Extension name to check
* @return bool Depending on whether or not the extension is enabled
*/
- public function enabled($name)
+ public function is_enabled($name)
{
return isset($this->extensions[$name]) && $this->extensions[$name]['ext_active'];
}
/**
+ * Check to see if a given extension is disabled
+ *
+ * @param string $name Extension name to check
+ * @return bool Depending on whether or not the extension is disabled
+ */
+ public function is_disabled($name)
+ {
+ return isset($this->extensions[$name]) && !$this->extensions[$name]['ext_active'];
+ }
+
+ /**
+ * Check to see if a given extension is configured
+ *
+ * All enabled and disabled extensions are considered configured. A purged
+ * extension that is no longer in the database is not configured.
+ *
+ * @param string $name Extension name to check
+ * @return bool Depending on whether or not the extension is configured
+ */
+ public function is_configured($name)
+ {
+ return isset($this->extensions[$name]);
+ }
+
+ /**
+ * Check to see if a given extension is purged
+ *
+ * An extension is purged if it is available, not enabled and not disabled.
+ *
+ * @param string $name Extension name to check
+ * @return bool Depending on whether or not the extension is purged
+ */
+ public function is_purged($name)
+ {
+ return $this->is_available($name) && !$this->is_configured($name);
+ }
+
+ /**
* Instantiates a \phpbb\finder.
*
* @param bool $use_all_available Should we load all extensions, or just enabled ones