[ticket/17507] Adjust module removal procedure

PHPBB-17507
This commit is contained in:
rxu 2025-07-06 19:01:06 +07:00
parent 0f71afae61
commit 07b63fc6a8
No known key found for this signature in database
GPG key ID: 955F0567380E586A
4 changed files with 20 additions and 22 deletions

View file

@ -377,7 +377,7 @@ class module implements \phpbb\db\migration\tool\tool_interface
{
if (!$this->exists($class, $parent, $module, true))
{
return;
throw new \phpbb\db\migration\exception('MODULE_NOT_EXIST', $module);
}
$parent_sql = '';

View file

@ -84,7 +84,7 @@
<value>1</value>
<value></value>
<value>acp</value>
<value>0</value>
<value>1</value>
<value>48</value>
<value>59</value>
<value>ACP_CLIENT_COMMUNICATION</value>
@ -120,7 +120,7 @@
</row>
<row>
<value>121</value>
<value>u_sendim </value>
<value>u_sendim</value>
<value>1</value>
<value>0</value>
<value>0</value>

View file

@ -59,10 +59,10 @@ abstract class phpbb_migration_test_base extends phpbb_database_test_case
$this->cache = new phpbb_mock_cache();
$this->auth = new \phpbb\auth\auth();
$phpbb_dispatcher = new phpbb_mock_event_dispatcher();
$cache = $this->cache_service = new \phpbb\cache\service(new \phpbb\cache\driver\dummy(), new \phpbb\config\config(array()), $this->db, $phpbb_dispatcher, $phpbb_root_path, $phpEx);
$this->config = new \phpbb\config\db($this->db, $this->cache, 'phpbb_config');
$this->config->initialise($this->cache);
$cache = $this->cache_service = new \phpbb\cache\service($this->cache, $this->config, $this->db, $phpbb_dispatcher, $phpbb_root_path, $phpEx);
$lang_loader = new \phpbb\language\language_file_loader($phpbb_root_path, $phpEx);
$lang = new \phpbb\language\language($lang_loader);
@ -86,11 +86,11 @@ abstract class phpbb_migration_test_base extends phpbb_database_test_case
$module_manager = new \phpbb\module\module_manager($this->cache, $this->db, $this->extension_manager, 'phpbb_modules', $phpbb_root_path, $phpEx);
$tools = array(
new \phpbb\db\migration\tool\config($this->config),
new \phpbb\db\migration\tool\config_text(new \phpbb\config\db_text($this->db, 'phpbb_config_text')),
new \phpbb\db\migration\tool\module($this->db, $this->user, $module_manager, 'phpbb_modules'),
new \phpbb\db\migration\tool\permission($this->db, $this->cache_service, $this->auth, $phpbb_root_path, $phpEx),
$this->tools = array(
'config' => new \phpbb\db\migration\tool\config($this->config),
'config_text' => new \phpbb\db\migration\tool\config_text(new \phpbb\config\db_text($this->db, 'phpbb_config_text')),
'module' => new \phpbb\db\migration\tool\module($this->db, $this->user, $module_manager, 'phpbb_modules'),
'permission' => new \phpbb\db\migration\tool\permission($this->db, $this->cache_service, $this->auth, $phpbb_root_path, $phpEx),
);
$this->migrator = new \phpbb\db\migrator(
@ -103,7 +103,7 @@ abstract class phpbb_migration_test_base extends phpbb_database_test_case
'php',
'phpbb_',
self::get_core_tables(),
$tools,
$this->tools,
new \phpbb\db\migration\helper()
);
$container->set('migrator', $this->migrator);

View file

@ -32,9 +32,9 @@ class phpbb_migrations_remove_jabber_migration_test extends phpbb_migration_test
WHERE config_name = 'jab_enable'";
$this->assertNotFalse($this->db->sql_query($sql));
$sql = "SELECT auth_option FROM phpbb_acl_options
WHERE auth_option = 'a_jabber'";
$this->assertNotFalse($this->db->sql_query($sql));
$this->assertTrue($this->tools['permission']->exists('a_jabber'));
$this->assertTrue($this->tools['permission']->exists('u_sendim'));
$this->assertTrue($this->tools['module']->exists('acp', 'ACP_CLIENT_COMMUNICATION', 'ACP_JABBER_SETTINGS'));
$this->apply_migration();
@ -55,10 +55,9 @@ class phpbb_migrations_remove_jabber_migration_test extends phpbb_migration_test
$this->db->sql_query($sql);
$this->assertFalse($this->db->sql_fetchfield('config_name'));
$sql = "SELECT auth_option FROM phpbb_acl_options
WHERE auth_option = 'a_jabber'";
$this->db->sql_query($sql);
$this->assertFalse($this->db->sql_fetchfield('auth_option'));
$this->assertFalse($this->tools['permission']->exists('a_jabber'));
$this->assertFalse($this->tools['permission']->exists('u_sendim'));
$this->assertFalse($this->tools['module']->exists('acp', 'ACP_CLIENT_COMMUNICATION', 'ACP_JABBER_SETTINGS'));
$this->revert_migration();
@ -67,9 +66,8 @@ class phpbb_migrations_remove_jabber_migration_test extends phpbb_migration_test
$this->db->sql_query($sql);
$this->assertEquals('jab_enable', $this->db->sql_fetchfield('config_name'));
$sql = "SELECT auth_option FROM phpbb_acl_options
WHERE auth_option = 'a_jabber'";
$this->db->sql_query($sql);
$this->assertEquals('a_jabber', $this->db->sql_fetchfield('auth_option'));
$this->assertTrue($this->tools['permission']->exists('a_jabber'));
$this->assertTrue($this->tools['permission']->exists('u_sendim'));
$this->assertTrue($this->tools['module']->exists('acp', 'ACP_CLIENT_COMMUNICATION', 'ACP_JABBER_SETTINGS'));
}
}