From d13e02c7b100ac43943f11912a8f4acb740f69b6 Mon Sep 17 00:00:00 2001 From: Tristan Darricau Date: Fri, 27 Jun 2014 10:49:13 +0200 Subject: [ticket/12777] Rename extension status functions and add is_configured() PHPBB3-12777 --- phpBB/phpbb/extension/manager.php | 27 +++++++++++++++++++++++++-- 1 file changed, 25 insertions(+), 2 deletions(-) (limited to 'phpBB/phpbb/extension/manager.php') diff --git a/phpBB/phpbb/extension/manager.php b/phpBB/phpbb/extension/manager.php index 4130e8455a..580960ca01 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,11 +526,34 @@ 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 + * + * @param string $name Extension name to check + * @return bool Depending on whether or not the extension is configured + * @see all_configured() + */ + public function is_configured($name) + { + return isset($this->extensions[$name]); + } + /** * Instantiates a \phpbb\finder. * -- cgit v1.2.1 From 4d9e451f6037924329336ae3b01990fc7ef5828b Mon Sep 17 00:00:00 2001 From: Tristan Darricau Date: Fri, 27 Jun 2014 11:23:11 +0200 Subject: [ticket/12777] Update doc block of is_configured() PHPBB3-12777 --- phpBB/phpbb/extension/manager.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'phpBB/phpbb/extension/manager.php') diff --git a/phpBB/phpbb/extension/manager.php b/phpBB/phpbb/extension/manager.php index 580960ca01..95496926eb 100644 --- a/phpBB/phpbb/extension/manager.php +++ b/phpBB/phpbb/extension/manager.php @@ -545,9 +545,11 @@ class manager /** * 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 - * @see all_configured() */ public function is_configured($name) { -- cgit v1.2.1 From 8e8b493fae59aba59e1ea732c1f93d66f59fb640 Mon Sep 17 00:00:00 2001 From: Tristan Darricau Date: Fri, 27 Jun 2014 11:28:13 +0200 Subject: [ticket/12777] Add is_purged() PHPBB3-12777 --- phpBB/phpbb/extension/manager.php | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'phpBB/phpbb/extension/manager.php') diff --git a/phpBB/phpbb/extension/manager.php b/phpBB/phpbb/extension/manager.php index 95496926eb..b19eb9f8a3 100644 --- a/phpBB/phpbb/extension/manager.php +++ b/phpBB/phpbb/extension/manager.php @@ -556,6 +556,19 @@ class manager 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. * -- cgit v1.2.1