1
0
mirror of https://github.com/phpbb/phpbb.git synced 2025-07-30 21:40:43 +02:00

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
This commit is contained in:
Joas Schilling
2014-08-07 13:00:08 +02:00
9 changed files with 96 additions and 2 deletions

View File

@@ -54,6 +54,14 @@ class base implements \phpbb\extension\extension_interface
$this->extension_path = $extension_path;
}
/**
* {@inheritdoc}
*/
public function is_enableable()
{
return true;
}
/**
* Single enable step that installs any included migrations
*

View File

@@ -19,6 +19,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.
*

View File

@@ -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);