mirror of
https://github.com/phpbb/phpbb.git
synced 2025-07-30 21:40:43 +02:00
[ticket/11413] Remove changes for ticket 11420 from this branch
PHPBB3-11413
This commit is contained in:
@@ -91,6 +91,70 @@ class phpbb_db_migration_data_310_notifications extends phpbb_db_migration
|
||||
),
|
||||
)),
|
||||
array('config.add', array('load_notifications', 1)),
|
||||
array('custom', array(array($this, 'convert_notifications'))),
|
||||
);
|
||||
}
|
||||
|
||||
public function convert_notifications()
|
||||
{
|
||||
$convert_notifications = array(
|
||||
array(
|
||||
'check' => ($this->config['allow_topic_notify']),
|
||||
'item_type' => 'post',
|
||||
),
|
||||
array(
|
||||
'check' => ($this->config['allow_forum_notify']),
|
||||
'item_type' => 'topic',
|
||||
),
|
||||
array(
|
||||
'check' => ($this->config['allow_bookmarks']),
|
||||
'item_type' => 'bookmark',
|
||||
),
|
||||
array(
|
||||
'check' => ($this->config['allow_privmsg']),
|
||||
'item_type' => 'pm',
|
||||
),
|
||||
);
|
||||
|
||||
foreach ($convert_notifications as $convert_data)
|
||||
{
|
||||
if ($convert_data['check'])
|
||||
{
|
||||
$sql = 'SELECT user_id, user_notify_type
|
||||
FROM ' . USERS_TABLE . '
|
||||
WHERE user_notify = 1';
|
||||
$result = $this->db->sql_query($sql);
|
||||
while ($row = $this->db->sql_fetchrow($result))
|
||||
{
|
||||
$this->sql_query('INSERT INTO ' . $this->table_prefix . 'user_notifications ' . $this->db->sql_build_array('INSERT', array(
|
||||
'item_type' => $convert_data['item_type'],
|
||||
'item_id' => 0,
|
||||
'user_id' => $row['user_id'],
|
||||
'method' => '',
|
||||
)));
|
||||
|
||||
if ($row['user_notify_type'] == NOTIFY_EMAIL || $row['user_notify_type'] == NOTIFY_BOTH)
|
||||
{
|
||||
$this->sql_query('INSERT INTO ' . $this->table_prefix . 'user_notifications ' . $this->db->sql_build_array('INSERT', array(
|
||||
'item_type' => $convert_data['item_type'],
|
||||
'item_id' => 0,
|
||||
'user_id' => $row['user_id'],
|
||||
'method' => 'email',
|
||||
)));
|
||||
}
|
||||
|
||||
if ($row['user_notify_type'] == NOTIFY_IM || $row['user_notify_type'] == NOTIFY_BOTH)
|
||||
{
|
||||
$this->sql_query('INSERT INTO ' . $this->table_prefix . 'user_notifications ' . $this->db->sql_build_array('INSERT', array(
|
||||
'item_type' => $convert_data['item_type'],
|
||||
'item_id' => 0,
|
||||
'user_id' => $row['user_id'],
|
||||
'method' => 'jabber',
|
||||
)));
|
||||
}
|
||||
}
|
||||
$this->db->sql_freeresult($result);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user