mirror of
https://github.com/phpbb/phpbb.git
synced 2025-06-29 06:38:52 +00:00
[ticket/10631] Make failure to meet ext enable requirements clearer
Turn the blocks red on the details page if requirement is not met. Also changing a how the errors come up when trying to enable/disable an extension when they cannot be. PHPBB3-10631
This commit is contained in:
parent
dce04b2d03
commit
7b643fe8a5
5 changed files with 39 additions and 21 deletions
|
@ -3,7 +3,7 @@
|
||||||
<a name="maincontent"></a>
|
<a name="maincontent"></a>
|
||||||
|
|
||||||
<a href="{U_BACK}" style="float: {S_CONTENT_FLOW_END};">« {L_BACK}</a>
|
<a href="{U_BACK}" style="float: {S_CONTENT_FLOW_END};">« {L_BACK}</a>
|
||||||
|
|
||||||
<h1>{L_EXTENSIONS_ADMIN}</h1>
|
<h1>{L_EXTENSIONS_ADMIN}</h1>
|
||||||
|
|
||||||
<fieldset>
|
<fieldset>
|
||||||
|
@ -50,13 +50,13 @@
|
||||||
<fieldset>
|
<fieldset>
|
||||||
<legend>{L_REQUIREMENTS}</legend>
|
<legend>{L_REQUIREMENTS}</legend>
|
||||||
<!-- IF MD_REQUIRE_PHPBB -->
|
<!-- IF MD_REQUIRE_PHPBB -->
|
||||||
<dl>
|
<dl<!-- IF MD_REQUIRE_PHPBB_FAIL --> class="requirements_not_met"<!-- ENDIF -->>
|
||||||
<dt><label for="require_phpbb">{L_PHPBB_VERSION}:</label></dt>
|
<dt><label for="require_phpbb">{L_PHPBB_VERSION}:</label></dt>
|
||||||
<dd><p id="require_phpbb">{MD_REQUIRE_PHPBB}</p></dd>
|
<dd><p id="require_phpbb">{MD_REQUIRE_PHPBB}</p></dd>
|
||||||
</dl>
|
</dl>
|
||||||
<!-- ENDIF -->
|
<!-- ENDIF -->
|
||||||
<!-- IF MD_REQUIRE_PHP -->
|
<!-- IF MD_REQUIRE_PHP -->
|
||||||
<dl>
|
<dl<!-- IF MD_REQUIRE_PHP_FAIL --> class="requirements_not_met"<!-- ENDIF -->>
|
||||||
<dt><label for="require_php">{L_PHP_VERSION}:</label></dt>
|
<dt><label for="require_php">{L_PHP_VERSION}:</label></dt>
|
||||||
<dd><p id="require_php">{MD_REQUIRE_PHP}</p></dd>
|
<dd><p id="require_php">{MD_REQUIRE_PHP}</p></dd>
|
||||||
</dl>
|
</dl>
|
||||||
|
|
|
@ -1718,3 +1718,13 @@ fieldset.permissions .padding {
|
||||||
.phpinfo td, .phpinfo th, .phpinfo h2, .phpinfo h1 {
|
.phpinfo td, .phpinfo th, .phpinfo h2, .phpinfo h1 {
|
||||||
text-align: left;
|
text-align: left;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.requirements_not_met {
|
||||||
|
padding: 5px;
|
||||||
|
background-color: #BC2A4D;
|
||||||
|
}
|
||||||
|
|
||||||
|
.requirements_not_met dt label, .requirements_not_met dd p {
|
||||||
|
color: #FFFFFF;
|
||||||
|
font-size: 1.4em;
|
||||||
|
}
|
|
@ -43,7 +43,7 @@ class acp_extensions
|
||||||
|
|
||||||
$action = $request->variable('action', 'list');
|
$action = $request->variable('action', 'list');
|
||||||
$ext_name = $request->variable('ext_name', '');
|
$ext_name = $request->variable('ext_name', '');
|
||||||
|
|
||||||
// Cancel action
|
// Cancel action
|
||||||
if ($request->is_set_post('cancel'))
|
if ($request->is_set_post('cancel'))
|
||||||
{
|
{
|
||||||
|
@ -79,9 +79,14 @@ class acp_extensions
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'enable_pre':
|
case 'enable_pre':
|
||||||
if (!$md_manager->validate_enable() || $phpbb_extension_manager->enabled($ext_name))
|
if (!$md_manager->validate_enable())
|
||||||
{
|
{
|
||||||
trigger_error('EXTENSION_NOT_AVAILABLE');
|
trigger_error($user->lang['EXTENSION_NOT_AVAILABLE'] . adm_back_link($this->u_action));
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($phpbb_extension_manager->enabled($ext_name))
|
||||||
|
{
|
||||||
|
redirect($this->u_action);
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->tpl_name = 'acp_ext_enable';
|
$this->tpl_name = 'acp_ext_enable';
|
||||||
|
@ -95,7 +100,7 @@ class acp_extensions
|
||||||
case 'enable':
|
case 'enable':
|
||||||
if (!$md_manager->validate_enable())
|
if (!$md_manager->validate_enable())
|
||||||
{
|
{
|
||||||
trigger_error('EXTENSION_NOT_AVAILABLE');
|
trigger_error($user->lang['EXTENSION_NOT_AVAILABLE'] . adm_back_link($this->u_action));
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($phpbb_extension_manager->enable_step($ext_name))
|
if ($phpbb_extension_manager->enable_step($ext_name))
|
||||||
|
@ -115,7 +120,7 @@ class acp_extensions
|
||||||
case 'disable_pre':
|
case 'disable_pre':
|
||||||
if (!$phpbb_extension_manager->enabled($ext_name))
|
if (!$phpbb_extension_manager->enabled($ext_name))
|
||||||
{
|
{
|
||||||
trigger_error('EXTENSION_NOT_AVAILABLE');
|
redirect($this->u_action);
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->tpl_name = 'acp_ext_disable';
|
$this->tpl_name = 'acp_ext_disable';
|
||||||
|
|
|
@ -320,8 +320,13 @@ class phpbb_extension_metadata_manager
|
||||||
'MD_VERSION' => (isset($this->metadata['version'])) ? htmlspecialchars($this->metadata['version']) : '',
|
'MD_VERSION' => (isset($this->metadata['version'])) ? htmlspecialchars($this->metadata['version']) : '',
|
||||||
'MD_TIME' => (isset($this->metadata['time'])) ? htmlspecialchars($this->metadata['time']) : '',
|
'MD_TIME' => (isset($this->metadata['time'])) ? htmlspecialchars($this->metadata['time']) : '',
|
||||||
'MD_LICENCE' => htmlspecialchars($this->metadata['licence']),
|
'MD_LICENCE' => htmlspecialchars($this->metadata['licence']),
|
||||||
'MD_REQUIRE_PHP' => (isset($this->metadata['require']['php'])) ? htmlspecialchars($this->metadata['require']['php']) : '',
|
|
||||||
'MD_REQUIRE_PHPBB' => (isset($this->metadata['require']['phpbb'])) ? htmlspecialchars($this->metadata['require']['phpbb']) : '',
|
'MD_REQUIRE_PHP' => (isset($this->metadata['require']['php'])) ? htmlspecialchars($this->metadata['require']['php']) : '',
|
||||||
|
'MD_REQUIRE_PHP_FAIL' => !$this->validate_require_php(),
|
||||||
|
|
||||||
|
'MD_REQUIRE_PHPBB' => (isset($this->metadata['require']['phpbb'])) ? htmlspecialchars($this->metadata['require']['phpbb']) : '',
|
||||||
|
'MD_REQUIRE_PHPBB_FAIL' => !$this->validate_require_phpbb(),
|
||||||
|
|
||||||
'MD_DISPLAY_NAME' => (isset($this->metadata['extra']['display-name'])) ? htmlspecialchars($this->metadata['extra']['display-name']) : '',
|
'MD_DISPLAY_NAME' => (isset($this->metadata['extra']['display-name'])) ? htmlspecialchars($this->metadata['extra']['display-name']) : '',
|
||||||
));
|
));
|
||||||
|
|
||||||
|
|
|
@ -178,9 +178,11 @@ class acp_test extends phpbb_functional_test_case
|
||||||
|
|
||||||
public function test_enable_pre()
|
public function test_enable_pre()
|
||||||
{
|
{
|
||||||
// Foo is already enabled (error)
|
// Foo is already enabled (redirect to list)
|
||||||
$crawler = $this->request('GET', 'adm/index.php?i=acp_extensions&mode=main&action=enable_pre&ext_name=foo&sid=' . $this->sid);
|
$crawler = $this->request('GET', 'adm/index.php?i=acp_extensions&mode=main&action=enable_pre&ext_name=foo&sid=' . $this->sid);
|
||||||
$this->assertContainsLang('EXTENSION_NOT_AVAILABLE', $crawler->filter('html')->text());
|
$this->assertContainsLang('EXTENSION_NAME', $crawler->filter('html')->text());
|
||||||
|
$this->assertContainsLang('EXTENSION_OPTIONS', $crawler->filter('html')->text());
|
||||||
|
$this->assertContainsLang('EXTENSION_ACTIONS', $crawler->filter('html')->text());
|
||||||
|
|
||||||
$crawler = $this->request('GET', 'adm/index.php?i=acp_extensions&mode=main&action=enable_pre&ext_name=vendor%2Fmoo&sid=' . $this->sid);
|
$crawler = $this->request('GET', 'adm/index.php?i=acp_extensions&mode=main&action=enable_pre&ext_name=vendor%2Fmoo&sid=' . $this->sid);
|
||||||
$this->assertContainsLang('ENABLE_CONFIRM', $crawler->filter('html')->text());
|
$this->assertContainsLang('ENABLE_CONFIRM', $crawler->filter('html')->text());
|
||||||
|
@ -188,9 +190,11 @@ class acp_test extends phpbb_functional_test_case
|
||||||
|
|
||||||
public function test_disable_pre()
|
public function test_disable_pre()
|
||||||
{
|
{
|
||||||
// Moo is not enabled (error)
|
// Moo is not enabled (redirect to list)
|
||||||
$crawler = $this->request('GET', 'adm/index.php?i=acp_extensions&mode=main&action=disable_pre&ext_name=vendor%2Fmoo&sid=' . $this->sid);
|
$crawler = $this->request('GET', 'adm/index.php?i=acp_extensions&mode=main&action=disable_pre&ext_name=vendor%2Fmoo&sid=' . $this->sid);
|
||||||
$this->assertContainsLang('EXTENSION_NOT_AVAILABLE', $crawler->filter('html')->text());
|
$this->assertContainsLang('EXTENSION_NAME', $crawler->filter('html')->text());
|
||||||
|
$this->assertContainsLang('EXTENSION_OPTIONS', $crawler->filter('html')->text());
|
||||||
|
$this->assertContainsLang('EXTENSION_ACTIONS', $crawler->filter('html')->text());
|
||||||
|
|
||||||
$crawler = $this->request('GET', 'adm/index.php?i=acp_extensions&mode=main&action=disable_pre&ext_name=foo&sid=' . $this->sid);
|
$crawler = $this->request('GET', 'adm/index.php?i=acp_extensions&mode=main&action=disable_pre&ext_name=foo&sid=' . $this->sid);
|
||||||
$this->assertContainsLang('DISABLE_CONFIRM', $crawler->filter('html')->text());
|
$this->assertContainsLang('DISABLE_CONFIRM', $crawler->filter('html')->text());
|
||||||
|
@ -206,20 +210,14 @@ class acp_test extends phpbb_functional_test_case
|
||||||
$this->assertContainsLang('PURGE_CONFIRM', $crawler->filter('html')->text());
|
$this->assertContainsLang('PURGE_CONFIRM', $crawler->filter('html')->text());
|
||||||
}
|
}
|
||||||
|
|
||||||
public function test_enable()
|
public function test_actions()
|
||||||
{
|
{
|
||||||
$crawler = $this->request('GET', 'adm/index.php?i=acp_extensions&mode=main&action=enable&ext_name=vendor%2Fmoo&sid=' . $this->sid);
|
$crawler = $this->request('GET', 'adm/index.php?i=acp_extensions&mode=main&action=enable&ext_name=vendor%2Fmoo&sid=' . $this->sid);
|
||||||
$this->assertContainsLang('ENABLE_SUCCESS', $crawler->filter('html')->text());
|
$this->assertContainsLang('ENABLE_SUCCESS', $crawler->filter('html')->text());
|
||||||
}
|
|
||||||
|
|
||||||
public function test_disable()
|
|
||||||
{
|
|
||||||
$crawler = $this->request('GET', 'adm/index.php?i=acp_extensions&mode=main&action=disable&ext_name=vendor%2Fmoo&sid=' . $this->sid);
|
$crawler = $this->request('GET', 'adm/index.php?i=acp_extensions&mode=main&action=disable&ext_name=vendor%2Fmoo&sid=' . $this->sid);
|
||||||
$this->assertContainsLang('DISABLE_SUCCESS', $crawler->filter('html')->text());
|
$this->assertContainsLang('DISABLE_SUCCESS', $crawler->filter('html')->text());
|
||||||
}
|
|
||||||
|
|
||||||
public function test_purge()
|
|
||||||
{
|
|
||||||
$crawler = $this->request('GET', 'adm/index.php?i=acp_extensions&mode=main&action=purge&ext_name=vendor%2Fmoo&sid=' . $this->sid);
|
$crawler = $this->request('GET', 'adm/index.php?i=acp_extensions&mode=main&action=purge&ext_name=vendor%2Fmoo&sid=' . $this->sid);
|
||||||
$this->assertContainsLang('PURGE_SUCCESS', $crawler->filter('html')->text());
|
$this->assertContainsLang('PURGE_SUCCESS', $crawler->filter('html')->text());
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue