mirror of
https://github.com/phpbb/phpbb.git
synced 2025-06-08 04:18:52 +00:00
[ticket/16688] Fix PHP fatal errors on installing extensions via catalog
PHPBB3-16688
This commit is contained in:
parent
7911c9cb73
commit
d4d26987e5
2 changed files with 21 additions and 1 deletions
|
@ -152,7 +152,9 @@ class installer
|
||||||
{
|
{
|
||||||
if (!$io)
|
if (!$io)
|
||||||
{
|
{
|
||||||
|
$this->restore_cwd();
|
||||||
$io = new null_io();
|
$io = new null_io();
|
||||||
|
$this->move_to_root();
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->generate_ext_json_file($packages);
|
$this->generate_ext_json_file($packages);
|
||||||
|
@ -183,6 +185,7 @@ class installer
|
||||||
}
|
}
|
||||||
catch (\Exception $e)
|
catch (\Exception $e)
|
||||||
{
|
{
|
||||||
|
$this->restore_cwd();
|
||||||
$this->restore_ext_json_file();
|
$this->restore_ext_json_file();
|
||||||
|
|
||||||
throw new runtime_exception('COMPOSER_CANNOT_INSTALL', [], $e);
|
throw new runtime_exception('COMPOSER_CANNOT_INSTALL', [], $e);
|
||||||
|
@ -190,6 +193,7 @@ class installer
|
||||||
|
|
||||||
if ($result !== 0)
|
if ($result !== 0)
|
||||||
{
|
{
|
||||||
|
$this->restore_cwd();
|
||||||
$this->restore_ext_json_file();
|
$this->restore_ext_json_file();
|
||||||
|
|
||||||
throw new runtime_exception($io->get_composer_error(), []);
|
throw new runtime_exception($io->get_composer_error(), []);
|
||||||
|
|
|
@ -76,7 +76,7 @@ class phpbb_functional_extension_acp_test extends phpbb_functional_test_case
|
||||||
$this->login();
|
$this->login();
|
||||||
$this->admin_login();
|
$this->admin_login();
|
||||||
|
|
||||||
$this->add_lang('acp/extensions');
|
$this->add_lang(['acp/common', 'acp/extensions']);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function test_list()
|
public function test_list()
|
||||||
|
@ -264,4 +264,20 @@ class phpbb_functional_extension_acp_test extends phpbb_functional_test_case
|
||||||
// Ensure catalog has any records in extensions list
|
// Ensure catalog has any records in extensions list
|
||||||
$this->assertGreaterThan(0, $crawler->filter('tbody > tr > td > strong')->count());
|
$this->assertGreaterThan(0, $crawler->filter('tbody > tr > td > strong')->count());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function test_extensions_catalog_installing_extension()
|
||||||
|
{
|
||||||
|
$crawler = self::request('GET', 'adm/index.php?i=acp_extensions&mode=catalog&sid=' . $this->sid);
|
||||||
|
$this->assertContainsLang('ACP_EXTENSIONS_CATALOG', $this->get_content());
|
||||||
|
|
||||||
|
// Ensure catalog has any records in extensions list
|
||||||
|
$this->assertGreaterThan(0, $crawler->filter('tbody > tr > td > strong')->count());
|
||||||
|
|
||||||
|
// Attempt to install any extension which is 1st in the list
|
||||||
|
$extension_install_link = $crawler->filter('tbody')->selectLink($this->lang('INSTALL'))->link();
|
||||||
|
$crawler = self::$client->click($extension_install_link);
|
||||||
|
|
||||||
|
// Assert any action result is presented regardless of success
|
||||||
|
$this->assertTrue(strlen($crawler->filter('.console-output > pre')->text()) > 0, $this->get_content());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue