Skip to content

Commit 02d4500

Browse files
committed
Add an effectively installed to module auth migration
Signed-off-by: Matt Friedman <maf675@gmail.com>
1 parent 9a5a147 commit 02d4500

1 file changed

Lines changed: 16 additions & 2 deletions

File tree

migrations/fix_acp_module_auth.php

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,20 @@
1414

1515
class fix_acp_module_auth extends migration
1616
{
17+
public function effectively_installed()
18+
{
19+
$sql = 'SELECT module_id
20+
FROM ' . $this->table_prefix . "modules
21+
WHERE module_class = 'acp'
22+
AND module_langname = 'ACP_WEBPUSH_EXT_SETTINGS'
23+
AND module_auth = 'ext_phpbb/webpushnotifications && acl_a_server'";
24+
$result = $this->db->sql_query($sql);
25+
$module_id = $this->db->sql_fetchfield('module_id');
26+
$this->db->sql_freeresult($result);
27+
28+
return $module_id !== false;
29+
}
30+
1731
public static function depends_on()
1832
{
1933
return ['\phpbb\webpushnotifications\migrations\add_webpush'];
@@ -30,8 +44,8 @@ public function set_acp_module_auth()
3044
{
3145
$phpbb_modules_table = $this->table_prefix . 'modules';
3246
$sql = 'UPDATE ' . $phpbb_modules_table . "
33-
SET module_auth = '" . $this->db->sql_escape('ext_phpbb/webpushnotifications && acl_a_server') . "'
34-
WHERE module_langname = '" . $this->db->sql_escape('ACP_WEBPUSH_EXT_SETTINGS') . "'";
47+
SET module_auth = '" . $this->db->sql_escape('ext_phpbb/webpushnotifications && acl_a_server') . "'
48+
WHERE module_langname = '" . $this->db->sql_escape('ACP_WEBPUSH_EXT_SETTINGS') . "'";
3549
$this->db->sql_query($sql);
3650
}
3751
}

0 commit comments

Comments
 (0)