Skip to content

Commit 5ecc737

Browse files
committed
Adjust migration and add some docblock explanations.
1 parent 8bd67d6 commit 5ecc737

File tree

1 file changed

+13
-2
lines changed

1 file changed

+13
-2
lines changed

migrations/handle_subscriptions.php

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,16 +32,22 @@ public function revert_data(): array
3232
['config.update', ['webpush_enable', $this->config['wpn_webpush_enable']]],
3333
]],
3434
['if', [
35-
(isset($this->config['webpush_vapid_public'])),
35+
(isset($this->config['webpush_vapid_public']) && empty($this->config['webpush_vapid_public'])),
3636
['config.update', ['webpush_vapid_public', $this->config['wpn_webpush_vapid_public']]],
3737
]],
3838
['if', [
39-
(isset($this->config['webpush_vapid_private'])),
39+
(isset($this->config['webpush_vapid_private']) && empty($this->config['webpush_vapid_private'])),
4040
['config.update', ['webpush_vapid_private', $this->config['wpn_webpush_vapid_private']]],
4141
]],
4242
];
4343
}
4444

45+
/*
46+
* For phpBB 4.0 with core webpush notifications update notification method
47+
* from extension's notification.method.phpbb.wpn.webpush to the core one
48+
* notification.method.webpush otherwise remove notification method from
49+
* user notifications table on the extension purge.
50+
*/
4551
public function update_subscriptions()
4652
{
4753
$user_notifications_table = $this->table_prefix . 'user_notifications';
@@ -65,6 +71,11 @@ public function update_subscriptions()
6571
$this->db->sql_query($sql);
6672
}
6773

74+
/*
75+
* For phpBB 4.0 with core webpush notifications copy all
76+
* webpush subscriptions data from extension's tables to the core ones
77+
* on the extension purge.
78+
*/
6879
public function copy_subscription_tables()
6980
{
7081
$core_notification_push_table = $this->table_prefix . 'notification_push';

0 commit comments

Comments
 (0)