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

[feature/extension-manager] Use an incremental process for enable and purge

The enable or purge operation of an extension could take a long time if an
expensive operation needs to be executed on a large set of data. To allow
this to succeed from a web interface with max_execution_time set in the
webserver's php configuration, subsequent requests must continue the
operation started earlier. So individual enable and purge implementations
must be able to spread their work across multiple steps.

PHPBB3-10323
This commit is contained in:
Nils Adermann
2011-08-29 17:17:40 -04:00
parent 897063d3e2
commit c7a986eccd
13 changed files with 151 additions and 22 deletions

View File

@@ -8,6 +8,8 @@
*/
require_once dirname(__FILE__) . '/../mock/cache.php';
require_once dirname(__FILE__) . '/ext/bar/bar.php';
require_once dirname(__FILE__) . '/ext/moo/moo.php';
class phpbb_extension_manager_test extends phpbb_database_test_case
{
@@ -49,10 +51,14 @@ class phpbb_extension_manager_test extends phpbb_database_test_case
public function test_enable()
{
phpbb_ext_bar::$state = 0;
$this->assertEquals(array('foo'), array_keys($this->extension_manager->all_enabled()));
$this->extension_manager->enable('bar');
$this->assertEquals(array('bar', 'foo'), array_keys($this->extension_manager->all_enabled()));
$this->assertEquals(array('bar', 'foo', 'moo'), array_keys($this->extension_manager->all_configured()));
$this->assertEquals(4, phpbb_ext_bar::$state);
}
public function test_disable()
@@ -65,10 +71,14 @@ class phpbb_extension_manager_test extends phpbb_database_test_case
public function test_purge()
{
phpbb_ext_moo::$purged = false;
$this->assertEquals(array('foo'), array_keys($this->extension_manager->all_enabled()));
$this->assertEquals(array('foo', 'moo'), array_keys($this->extension_manager->all_configured()));
$this->extension_manager->purge('moo');
$this->assertEquals(array('foo'), array_keys($this->extension_manager->all_enabled()));
$this->assertEquals(array('foo'), array_keys($this->extension_manager->all_configured()));
$this->assertTrue(phpbb_ext_moo::$purged);
}
}