mirror of
https://github.com/phpbb/phpbb.git
synced 2025-07-30 21:40:43 +02:00
[ticket/17493] Remove remnants of user_notify_type
PHPBB-17493
This commit is contained in:
@@ -69,7 +69,7 @@ class remove_jabber extends migration
|
||||
]],
|
||||
['permission.remove', ['a_jabber']],
|
||||
['permission.remove', ['u_sendim']],
|
||||
['custom', [[$this, 'remove_from_user_notifcations']]],
|
||||
['custom', [[$this, 'move_jabber_to_email_notifications']]],
|
||||
];
|
||||
}
|
||||
|
||||
@@ -101,10 +101,15 @@ class remove_jabber extends migration
|
||||
];
|
||||
}
|
||||
|
||||
public function remove_from_user_notifcations()
|
||||
public function move_jabber_to_email_notifications(int $start = 0)
|
||||
{
|
||||
$sql = 'DELETE FROM ' . $this->table_prefix . 'user_notifications
|
||||
WHERE notification_method = ' . $this->db->sql_escape('notification.method.jabber');
|
||||
$this->db->sql_query($sql);
|
||||
$limit = 1000;
|
||||
|
||||
$sql = 'UPDATE ' . $this->tables['user_notifications'] . '
|
||||
SET ' . $this->db->sql_build_array('UPDATE', ['method' => 'notification.method.email']) . "
|
||||
WHERE method = 'notification.method.jabber'";
|
||||
$this->db->sql_query_limit($sql, $limit, $start);
|
||||
|
||||
return $this->db->sql_affectedrows() < $limit ? true : $start + $limit;
|
||||
}
|
||||
}
|
||||
|
64
phpBB/phpbb/db/migration/data/v400/remove_notify_type.php
Normal file
64
phpBB/phpbb/db/migration/data/v400/remove_notify_type.php
Normal file
@@ -0,0 +1,64 @@
|
||||
<?php
|
||||
/**
|
||||
*
|
||||
* This file is part of the phpBB Forum Software package.
|
||||
*
|
||||
* @copyright (c) phpBB Limited <https://www.phpbb.com>
|
||||
* @license GNU General Public License, version 2 (GPL-2.0)
|
||||
*
|
||||
* For full copyright and license information, please see
|
||||
* the docs/CREDITS.txt file.
|
||||
*
|
||||
*/
|
||||
|
||||
namespace phpbb\db\migration\data\v400;
|
||||
|
||||
use phpbb\db\migration\migration;
|
||||
|
||||
class remove_notify_type extends migration
|
||||
{
|
||||
public static function depends_on(): array
|
||||
{
|
||||
return [
|
||||
'\phpbb\db\migration\data\v400\remove_jabber',
|
||||
'\phpbb\db\migration\data\v400\dev',
|
||||
'\phpbb\db\migration\data\v30x\release_3_0_0',
|
||||
];
|
||||
}
|
||||
|
||||
public function update_schema(): array
|
||||
{
|
||||
return [
|
||||
'drop_columns' => [
|
||||
$this->table_prefix . 'users' => [
|
||||
'user_notify_type',
|
||||
],
|
||||
]
|
||||
];
|
||||
}
|
||||
|
||||
public function revert_schema(): array
|
||||
{
|
||||
return [
|
||||
'add_columns' => [
|
||||
$this->table_prefix . 'users' => [
|
||||
'user_notify_type' => ['TINT:4', 0],
|
||||
],
|
||||
]
|
||||
];
|
||||
}
|
||||
|
||||
public function update_data()
|
||||
{
|
||||
return [
|
||||
['custom', [[$this, 'remove_jabber_user_notifications']]],
|
||||
];
|
||||
}
|
||||
|
||||
protected function remove_jabber_user_notifications(): void
|
||||
{
|
||||
$sql = 'DELETE FROM ' . $this->tables['user_notifications'] . "
|
||||
WHERE method = 'notification.method.jabber'";
|
||||
$this->db->sql_query($sql);
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user