1
0
mirror of https://github.com/phpbb/phpbb.git synced 2025-07-25 02:51:35 +02:00

Merge branch 'develop-ascraeus' into develop

* develop-ascraeus:
  [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()
This commit is contained in:
Joas Schilling
2014-06-29 23:41:28 +02:00
6 changed files with 92 additions and 14 deletions

View File

@@ -137,7 +137,7 @@ class acp_extensions
trigger_error($user->lang['EXTENSION_NOT_AVAILABLE'] . adm_back_link($this->u_action), E_USER_WARNING);
}
if ($phpbb_extension_manager->enabled($ext_name))
if ($phpbb_extension_manager->is_enabled($ext_name))
{
redirect($this->u_action);
}
@@ -162,7 +162,7 @@ class acp_extensions
trigger_error($user->lang['EXTENSION_NOT_AVAILABLE'] . adm_back_link($this->u_action), E_USER_WARNING);
}
if ($phpbb_extension_manager->enabled($ext_name))
if ($phpbb_extension_manager->is_enabled($ext_name))
{
redirect($this->u_action);
}
@@ -194,7 +194,7 @@ class acp_extensions
break;
case 'disable_pre':
if (!$phpbb_extension_manager->enabled($ext_name))
if (!$phpbb_extension_manager->is_enabled($ext_name))
{
redirect($this->u_action);
}
@@ -209,7 +209,7 @@ class acp_extensions
break;
case 'disable':
if (!$phpbb_extension_manager->enabled($ext_name))
if (!$phpbb_extension_manager->is_enabled($ext_name))
{
redirect($this->u_action);
}
@@ -234,7 +234,7 @@ class acp_extensions
break;
case 'delete_data_pre':
if ($phpbb_extension_manager->enabled($ext_name))
if ($phpbb_extension_manager->is_enabled($ext_name))
{
redirect($this->u_action);
}
@@ -248,7 +248,7 @@ class acp_extensions
break;
case 'delete_data':
if ($phpbb_extension_manager->enabled($ext_name))
if ($phpbb_extension_manager->is_enabled($ext_name))
{
redirect($this->u_action);
}

View File

@@ -37,7 +37,7 @@ class disable extends command
$this->manager->disable($name);
$this->manager->load_extensions();
if ($this->manager->enabled($name))
if ($this->manager->is_enabled($name))
{
$output->writeln("<error>Could not disable extension $name</error>");
return 1;

View File

@@ -37,7 +37,7 @@ class enable extends command
$this->manager->enable($name);
$this->manager->load_extensions();
if ($this->manager->enabled($name))
if ($this->manager->is_enabled($name))
{
$this->log->add('admin', ANONYMOUS, '', 'LOG_EXT_ENABLE', time(), array($name));
$output->writeln("<info>Successfully enabled extension $name</info>");

View File

@@ -37,7 +37,7 @@ class purge extends command
$this->manager->purge($name);
$this->manager->load_extensions();
if ($this->manager->enabled($name))
if ($this->manager->is_enabled($name))
{
$output->writeln("<error>Could not purge extension $name</error>");
return 1;

View File

@@ -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,49 @@ 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.
*