[ticket/11103] Inject table prefix to notifications system instead of constants

PHPBB3-11103
This commit is contained in:
Nathaniel Guse 2012-11-09 08:48:41 -06:00
parent 6a0f6833e6
commit 6c8c54d4d2
7 changed files with 81 additions and 38 deletions

View file

@ -12,6 +12,8 @@ services:
- @config - @config
- %core.root_path% - %core.root_path%
- %core.php_ext% - %core.php_ext%
- %tables.notifications%
- %tables.user_notifications%
tags: tags:
- { name: notification.type } - { name: notification.type }
@ -28,6 +30,8 @@ services:
- @config - @config
- %core.root_path% - %core.root_path%
- %core.php_ext% - %core.php_ext%
- %tables.notifications%
- %tables.user_notifications%
tags: tags:
- { name: notification.type } - { name: notification.type }
@ -44,6 +48,8 @@ services:
- @config - @config
- %core.root_path% - %core.root_path%
- %core.php_ext% - %core.php_ext%
- %tables.notifications%
- %tables.user_notifications%
tags: tags:
- { name: notification.type } - { name: notification.type }
@ -60,6 +66,8 @@ services:
- @config - @config
- %core.root_path% - %core.root_path%
- %core.php_ext% - %core.php_ext%
- %tables.notifications%
- %tables.user_notifications%
tags: tags:
- { name: notification.type } - { name: notification.type }
@ -76,6 +84,8 @@ services:
- @config - @config
- %core.root_path% - %core.root_path%
- %core.php_ext% - %core.php_ext%
- %tables.notifications%
- %tables.user_notifications%
tags: tags:
- { name: notification.type } - { name: notification.type }
@ -92,6 +102,8 @@ services:
- @config - @config
- %core.root_path% - %core.root_path%
- %core.php_ext% - %core.php_ext%
- %tables.notifications%
- %tables.user_notifications%
tags: tags:
- { name: notification.type } - { name: notification.type }
@ -108,6 +120,8 @@ services:
- @config - @config
- %core.root_path% - %core.root_path%
- %core.php_ext% - %core.php_ext%
- %tables.notifications%
- %tables.user_notifications%
tags: tags:
- { name: notification.type } - { name: notification.type }
@ -124,6 +138,8 @@ services:
- @config - @config
- %core.root_path% - %core.root_path%
- %core.php_ext% - %core.php_ext%
- %tables.notifications%
- %tables.user_notifications%
tags: tags:
- { name: notification.type } - { name: notification.type }
@ -140,6 +156,8 @@ services:
- @config - @config
- %core.root_path% - %core.root_path%
- %core.php_ext% - %core.php_ext%
- %tables.notifications%
- %tables.user_notifications%
tags: tags:
- { name: notification.type } - { name: notification.type }
@ -156,6 +174,8 @@ services:
- @config - @config
- %core.root_path% - %core.root_path%
- %core.php_ext% - %core.php_ext%
- %tables.notifications%
- %tables.user_notifications%
tags: tags:
- { name: notification.type } - { name: notification.type }
@ -172,6 +192,8 @@ services:
- @config - @config
- %core.root_path% - %core.root_path%
- %core.php_ext% - %core.php_ext%
- %tables.notifications%
- %tables.user_notifications%
tags: tags:
- { name: notification.type } - { name: notification.type }
@ -188,6 +210,8 @@ services:
- @config - @config
- %core.root_path% - %core.root_path%
- %core.php_ext% - %core.php_ext%
- %tables.notifications%
- %tables.user_notifications%
tags: tags:
- { name: notification.type } - { name: notification.type }
@ -204,6 +228,8 @@ services:
- @config - @config
- %core.root_path% - %core.root_path%
- %core.php_ext% - %core.php_ext%
- %tables.notifications%
- %tables.user_notifications%
tags: tags:
- { name: notification.type } - { name: notification.type }
@ -220,6 +246,8 @@ services:
- @config - @config
- %core.root_path% - %core.root_path%
- %core.php_ext% - %core.php_ext%
- %tables.notifications%
- %tables.user_notifications%
tags: tags:
- { name: notification.type } - { name: notification.type }
@ -236,6 +264,8 @@ services:
- @config - @config
- %core.root_path% - %core.root_path%
- %core.php_ext% - %core.php_ext%
- %tables.notifications%
- %tables.user_notifications%
tags: tags:
- { name: notification.type } - { name: notification.type }

View file

@ -103,6 +103,8 @@ services:
- @config - @config
- %core.root_path% - %core.root_path%
- %core.php_ext% - %core.php_ext%
- %tables.notifications%
- %tables.user_notifications%
processor.ext: processor.ext:
class: phpbb_di_processor_ext class: phpbb_di_processor_ext

View file

@ -1,3 +1,5 @@
parameters: parameters:
tables.config: %core.table_prefix%config tables.config: %core.table_prefix%config
tables.ext: %core.table_prefix%ext tables.ext: %core.table_prefix%ext
tables.notifications: %core.table_prefix%notifications
tables.user_notifications: %core.table_prefix%user_notifications

View file

@ -239,7 +239,6 @@ define('LOG_TABLE', $table_prefix . 'log');
define('LOGIN_ATTEMPT_TABLE', $table_prefix . 'login_attempts'); define('LOGIN_ATTEMPT_TABLE', $table_prefix . 'login_attempts');
define('MODERATOR_CACHE_TABLE', $table_prefix . 'moderator_cache'); define('MODERATOR_CACHE_TABLE', $table_prefix . 'moderator_cache');
define('MODULES_TABLE', $table_prefix . 'modules'); define('MODULES_TABLE', $table_prefix . 'modules');
define('NOTIFICATIONS_TABLE', $table_prefix . 'notifications');
define('POLL_OPTIONS_TABLE', $table_prefix . 'poll_options'); define('POLL_OPTIONS_TABLE', $table_prefix . 'poll_options');
define('POLL_VOTES_TABLE', $table_prefix . 'poll_votes'); define('POLL_VOTES_TABLE', $table_prefix . 'poll_votes');
define('POSTS_TABLE', $table_prefix . 'posts'); define('POSTS_TABLE', $table_prefix . 'posts');
@ -273,11 +272,9 @@ define('TOPICS_POSTED_TABLE', $table_prefix . 'topics_posted');
define('TOPICS_TRACK_TABLE', $table_prefix . 'topics_track'); define('TOPICS_TRACK_TABLE', $table_prefix . 'topics_track');
define('TOPICS_WATCH_TABLE', $table_prefix . 'topics_watch'); define('TOPICS_WATCH_TABLE', $table_prefix . 'topics_watch');
define('USER_GROUP_TABLE', $table_prefix . 'user_group'); define('USER_GROUP_TABLE', $table_prefix . 'user_group');
define('USER_NOTIFICATIONS_TABLE', $table_prefix . 'user_notifications');
define('USERS_TABLE', $table_prefix . 'users'); define('USERS_TABLE', $table_prefix . 'users');
define('WARNINGS_TABLE', $table_prefix . 'warnings'); define('WARNINGS_TABLE', $table_prefix . 'warnings');
define('WORDS_TABLE', $table_prefix . 'words'); define('WORDS_TABLE', $table_prefix . 'words');
define('ZEBRA_TABLE', $table_prefix . 'zebra'); define('ZEBRA_TABLE', $table_prefix . 'zebra');
// Additional tables // Additional tables

View file

@ -53,6 +53,12 @@ class phpbb_notification_manager
/** @var string */ /** @var string */
protected $php_ext = null; protected $php_ext = null;
/** @var string */
protected $notifications_table = null;
/** @var string */
protected $user_notifications_table = null;
/** /**
* Users loaded from the DB * Users loaded from the DB
* *
@ -60,7 +66,7 @@ class phpbb_notification_manager
*/ */
protected $users = array(); protected $users = array();
public function __construct(ContainerBuilder $phpbb_container, dbal $db, phpbb_cache_driver_interface $cache, phpbb_template $template, phpbb_extension_manager $extension_manager, $user, phpbb_auth $auth, phpbb_config $config, $phpbb_root_path, $php_ext) public function __construct(ContainerBuilder $phpbb_container, dbal $db, phpbb_cache_driver_interface $cache, phpbb_template $template, phpbb_extension_manager $extension_manager, $user, phpbb_auth $auth, phpbb_config $config, $phpbb_root_path, $php_ext, $notifications_table, $user_notifications_table)
{ {
$this->phpbb_container = $phpbb_container; $this->phpbb_container = $phpbb_container;
$this->db = $db; $this->db = $db;
@ -70,8 +76,12 @@ class phpbb_notification_manager
$this->user = $user; $this->user = $user;
$this->auth = $auth; $this->auth = $auth;
$this->config = $config; $this->config = $config;
$this->phpbb_root_path = $phpbb_root_path; $this->phpbb_root_path = $phpbb_root_path;
$this->php_ext = $php_ext; $this->php_ext = $php_ext;
$this->notifications_table = $notifications_table;
$this->user_notifications_table = $user_notifications_table;
} }
/** /**
@ -123,7 +133,7 @@ class phpbb_notification_manager
{ {
// Get the total number of unread notifications // Get the total number of unread notifications
$sql = 'SELECT COUNT(*) AS unread_count $sql = 'SELECT COUNT(*) AS unread_count
FROM ' . NOTIFICATIONS_TABLE . ' FROM ' . $this->notifications_table . '
WHERE user_id = ' . (int) $options['user_id'] . ' WHERE user_id = ' . (int) $options['user_id'] . '
AND unread = 1 AND unread = 1
AND is_enabled = 1'; AND is_enabled = 1';
@ -136,7 +146,7 @@ class phpbb_notification_manager
{ {
// Get the total number of notifications // Get the total number of notifications
$sql = 'SELECT COUNT(*) AS total_count $sql = 'SELECT COUNT(*) AS total_count
FROM ' . NOTIFICATIONS_TABLE . ' FROM ' . $this->notifications_table . '
WHERE user_id = ' . (int) $options['user_id'] . ' WHERE user_id = ' . (int) $options['user_id'] . '
AND is_enabled = 1'; AND is_enabled = 1';
$result = $this->db->sql_query($sql); $result = $this->db->sql_query($sql);
@ -150,7 +160,7 @@ class phpbb_notification_manager
// Get the main notifications // Get the main notifications
$sql = 'SELECT * $sql = 'SELECT *
FROM ' . NOTIFICATIONS_TABLE . ' FROM ' . $this->notifications_table . '
WHERE user_id = ' . (int) $options['user_id'] . WHERE user_id = ' . (int) $options['user_id'] .
(($options['notification_id']) ? ((is_array($options['notification_id'])) ? ' AND ' . $this->db->sql_in_set('notification_id', $options['notification_id']) : ' AND notification_id = ' . (int) $options['notification_id']) : '') . ' (($options['notification_id']) ? ((is_array($options['notification_id'])) ? ' AND ' . $this->db->sql_in_set('notification_id', $options['notification_id']) : ' AND notification_id = ' . (int) $options['notification_id']) : '') . '
AND is_enabled = 1 AND is_enabled = 1
@ -167,7 +177,7 @@ class phpbb_notification_manager
if ($unread_count && $options['all_unread'] && !empty($rowset)) if ($unread_count && $options['all_unread'] && !empty($rowset))
{ {
$sql = 'SELECT * $sql = 'SELECT *
FROM ' . NOTIFICATIONS_TABLE . ' FROM ' . $this->notifications_table . '
WHERE user_id = ' . (int) $options['user_id'] . ' WHERE user_id = ' . (int) $options['user_id'] . '
AND unread = 1 AND unread = 1
AND ' . $this->db->sql_in_set('notification_id', array_keys($rowset), true) . ' AND ' . $this->db->sql_in_set('notification_id', array_keys($rowset), true) . '
@ -239,7 +249,7 @@ class phpbb_notification_manager
$time = ($time !== false) ? $time : time(); $time = ($time !== false) ? $time : time();
$sql = 'UPDATE ' . NOTIFICATIONS_TABLE . " $sql = 'UPDATE ' . $this->notifications_table . "
SET unread = 0 SET unread = 0
WHERE time <= " . $time . WHERE time <= " . $time .
(($item_type !== false) ? ' AND ' . (is_array($item_type) ? $this->db->sql_in_set('item_type', $item_type) : " item_type = '" . $this->db->sql_escape($item_type) . "'") : '') . (($item_type !== false) ? ' AND ' . (is_array($item_type) ? $this->db->sql_in_set('item_type', $item_type) : " item_type = '" . $this->db->sql_escape($item_type) . "'") : '') .
@ -270,7 +280,7 @@ class phpbb_notification_manager
$time = ($time !== false) ? $time : time(); $time = ($time !== false) ? $time : time();
$sql = 'UPDATE ' . NOTIFICATIONS_TABLE . " $sql = 'UPDATE ' . $this->notifications_table . "
SET unread = 0 SET unread = 0
WHERE item_type = '" . $this->db->sql_escape($item_type) . "' WHERE item_type = '" . $this->db->sql_escape($item_type) . "'
AND time <= " . $time . AND time <= " . $time .
@ -289,7 +299,7 @@ class phpbb_notification_manager
{ {
$time = ($time !== false) ? $time : time(); $time = ($time !== false) ? $time : time();
$sql = 'UPDATE ' . NOTIFICATIONS_TABLE . " $sql = 'UPDATE ' . $this->notifications_table . "
SET unread = 0 SET unread = 0
WHERE time <= " . $time . ' WHERE time <= " . $time . '
AND ' . ((is_array($notification_id)) ? $this->db->sql_in_set('notification_id', $notification_id) : 'notification_id = ' . (int) $notification_id); AND ' . ((is_array($notification_id)) ? $this->db->sql_in_set('notification_id', $notification_id) : 'notification_id = ' . (int) $notification_id);
@ -365,7 +375,7 @@ class phpbb_notification_manager
// Make sure not to send new notifications to users who've already been notified about this item // Make sure not to send new notifications to users who've already been notified about this item
// This may happen when an item was added, but now new users are able to see the item // This may happen when an item was added, but now new users are able to see the item
$sql = 'SELECT user_id $sql = 'SELECT user_id
FROM ' . NOTIFICATIONS_TABLE . " FROM ' . $this->notifications_table . "
WHERE item_type = '" . $this->db->sql_escape($item_type) . "' WHERE item_type = '" . $this->db->sql_escape($item_type) . "'
AND item_id = " . (int) $item_id . ' AND item_id = " . (int) $item_id . '
AND is_enabled = 1'; AND is_enabled = 1';
@ -415,7 +425,7 @@ class phpbb_notification_manager
} }
// insert into the db // insert into the db
$this->db->sql_multi_insert(NOTIFICATIONS_TABLE, $new_rows); $this->db->sql_multi_insert($this->notifications_table, $new_rows);
// We need to load all of the users to send notifications // We need to load all of the users to send notifications
$this->load_users($user_ids); $this->load_users($user_ids);
@ -460,7 +470,7 @@ class phpbb_notification_manager
$item_id = $item_type::get_item_id($data); $item_id = $item_type::get_item_id($data);
$update_array = $notification->create_update_array($data); $update_array = $notification->create_update_array($data);
$sql = 'UPDATE ' . NOTIFICATIONS_TABLE . ' $sql = 'UPDATE ' . $this->notifications_table . '
SET ' . $this->db->sql_build_array('UPDATE', $update_array) . " SET ' . $this->db->sql_build_array('UPDATE', $update_array) . "
WHERE item_type = '" . $this->db->sql_escape($item_type) . "' WHERE item_type = '" . $this->db->sql_escape($item_type) . "'
AND item_id = " . (int) $item_id; AND item_id = " . (int) $item_id;
@ -486,7 +496,7 @@ class phpbb_notification_manager
return; return;
} }
$sql = 'DELETE FROM ' . NOTIFICATIONS_TABLE . " $sql = 'DELETE FROM ' . $this->notifications_table . "
WHERE item_type = '" . $this->db->sql_escape($item_type) . "' WHERE item_type = '" . $this->db->sql_escape($item_type) . "'
AND " . (is_array($item_id) ? $this->db->sql_in_set('item_id', $item_id) : 'item_id = ' . (int) $item_id); AND " . (is_array($item_id) ? $this->db->sql_in_set('item_id', $item_id) : 'item_id = ' . (int) $item_id);
$this->db->sql_query($sql); $this->db->sql_query($sql);
@ -571,7 +581,7 @@ class phpbb_notification_manager
foreach ($types as $id => $type) foreach ($types as $id => $type)
{ {
$sql = 'SELECT method, notify $sql = 'SELECT method, notify
FROM ' . USER_NOTIFICATIONS_TABLE . ' FROM ' . $this->user_notifications_table . '
WHERE user_id = ' . (int) $user_id . " WHERE user_id = ' . (int) $user_id . "
AND item_type = '" . $this->db->sql_escape($id) . "' AND item_type = '" . $this->db->sql_escape($id) . "'
AND item_id = 0"; AND item_id = 0";
@ -627,7 +637,7 @@ class phpbb_notification_manager
$user_id = ($user_id === false) ? $this->user->data['user_id'] : $user_id; $user_id = ($user_id === false) ? $this->user->data['user_id'] : $user_id;
$sql = 'SELECT notify $sql = 'SELECT notify
FROM ' . USER_NOTIFICATIONS_TABLE . " FROM ' . $this->user_notifications_table . "
WHERE item_type = '" . $this->db->sql_escape($item_type) . "' WHERE item_type = '" . $this->db->sql_escape($item_type) . "'
AND item_id = " . (int) $item_id . ' AND item_id = " . (int) $item_id . '
AND user_id = ' .(int) $user_id . " AND user_id = ' .(int) $user_id . "
@ -638,7 +648,7 @@ class phpbb_notification_manager
if ($current === false) if ($current === false)
{ {
$sql = 'INSERT INTO ' . USER_NOTIFICATIONS_TABLE . ' ' . $sql = 'INSERT INTO ' . $this->user_notifications_table . ' ' .
$this->db->sql_build_array('INSERT', array( $this->db->sql_build_array('INSERT', array(
'item_type' => $item_type, 'item_type' => $item_type,
'item_id' => (int) $item_id, 'item_id' => (int) $item_id,
@ -650,7 +660,7 @@ class phpbb_notification_manager
} }
else if (!$current) else if (!$current)
{ {
$sql = 'UPDATE ' . USER_NOTIFICATIONS_TABLE . " $sql = 'UPDATE ' . $this->user_notifications_table . "
SET notify = 1 SET notify = 1
WHERE item_type = '" . $this->db->sql_escape($item_type) . "' WHERE item_type = '" . $this->db->sql_escape($item_type) . "'
AND item_id = " . (int) $item_id . ' AND item_id = " . (int) $item_id . '
@ -676,7 +686,7 @@ class phpbb_notification_manager
if ($method === '') if ($method === '')
{ {
$sql = 'SELECT COUNT(*) as num_notifications $sql = 'SELECT COUNT(*) as num_notifications
FROM ' . USER_NOTIFICATIONS_TABLE . " FROM ' . $this->user_notifications_table . "
WHERE item_type = '" . $this->db->sql_escape($item_type) . "' WHERE item_type = '" . $this->db->sql_escape($item_type) . "'
AND item_id = " . (int) $item_id . ' AND item_id = " . (int) $item_id . '
AND user_id = ' .(int) $user_id . " AND user_id = ' .(int) $user_id . "
@ -692,7 +702,7 @@ class phpbb_notification_manager
} }
} }
$sql = 'UPDATE ' . USER_NOTIFICATIONS_TABLE . " $sql = 'UPDATE ' . $this->user_notifications_table . "
SET notify = 0 SET notify = 0
WHERE item_type = '" . $this->db->sql_escape($item_type) . "' WHERE item_type = '" . $this->db->sql_escape($item_type) . "'
AND item_id = " . (int) $item_id . ' AND item_id = " . (int) $item_id . '
@ -702,7 +712,7 @@ class phpbb_notification_manager
if (!$this->db->sql_affectedrows()) if (!$this->db->sql_affectedrows())
{ {
$sql = 'INSERT INTO ' . USER_NOTIFICATIONS_TABLE . ' ' . $sql = 'INSERT INTO ' . $this->user_notifications_table . ' ' .
$this->db->sql_build_array('INSERT', array( $this->db->sql_build_array('INSERT', array(
'item_type' => $item_type, 'item_type' => $item_type,
'item_id' => (int) $item_id, 'item_id' => (int) $item_id,
@ -725,7 +735,7 @@ class phpbb_notification_manager
*/ */
public function disable_notifications($item_type) public function disable_notifications($item_type)
{ {
$sql = 'UPDATE ' . NOTIFICATIONS_TABLE . " $sql = 'UPDATE ' . $this->notifications_table . "
SET is_enabled = 0 SET is_enabled = 0
WHERE item_type = '" . $this->db->sql_escape($item_type) . "'"; WHERE item_type = '" . $this->db->sql_escape($item_type) . "'";
$this->db->sql_query($sql); $this->db->sql_query($sql);
@ -742,7 +752,7 @@ class phpbb_notification_manager
*/ */
public function enable_notifications($item_type) public function enable_notifications($item_type)
{ {
$sql = 'UPDATE ' . NOTIFICATIONS_TABLE . " $sql = 'UPDATE ' . $this->notifications_table . "
SET is_enabled = 1 SET is_enabled = 1
WHERE item_type = '" . $this->db->sql_escape($item_type) . "'"; WHERE item_type = '" . $this->db->sql_escape($item_type) . "'";
$this->db->sql_query($sql); $this->db->sql_query($sql);

View file

@ -51,6 +51,12 @@ abstract class phpbb_notification_type_base implements phpbb_notification_type_i
/** @var string */ /** @var string */
protected $php_ext = null; protected $php_ext = null;
/** @var string */
protected $notifications_table = null;
/** @var string */
protected $user_notifications_table = null;
/** /**
* Notification option data (for outputting to the user) * Notification option data (for outputting to the user)
* *
@ -78,7 +84,7 @@ abstract class phpbb_notification_type_base implements phpbb_notification_type_i
*/ */
private $data = array(); private $data = array();
public function __construct(phpbb_notification_manager $notification_manager, dbal $db, phpbb_cache_driver_interface $cache, phpbb_template $template, phpbb_extension_manager $extension_manager, $user, phpbb_auth $auth, phpbb_config $config, $phpbb_root_path, $php_ext) public function __construct(phpbb_notification_manager $notification_manager, dbal $db, phpbb_cache_driver_interface $cache, phpbb_template $template, phpbb_extension_manager $extension_manager, $user, phpbb_auth $auth, phpbb_config $config, $phpbb_root_path, $php_ext, $notifications_table, $user_notifications_table)
{ {
$this->notification_manager = $notification_manager; $this->notification_manager = $notification_manager;
$this->db = $db; $this->db = $db;
@ -88,8 +94,12 @@ abstract class phpbb_notification_type_base implements phpbb_notification_type_i
$this->user = $user; $this->user = $user;
$this->auth = $auth; $this->auth = $auth;
$this->config = $config; $this->config = $config;
$this->phpbb_root_path = $phpbb_root_path; $this->phpbb_root_path = $phpbb_root_path;
$this->php_ext = $php_ext; $this->php_ext = $php_ext;
$this->notifications_table = $notifications_table;
$this->user_notifications_table = $user_notifications_table;
} }
/** /**

View file

@ -110,14 +110,6 @@ if (!defined('EXT_TABLE'))
{ {
define('EXT_TABLE', $table_prefix . 'ext'); define('EXT_TABLE', $table_prefix . 'ext');
} }
if (!defined('NOTIFICATIONS_TABLE'))
{
define('NOTIFICATIONS_TABLE', $table_prefix . 'notifications');
}
if (!defined('USER_NOTIFICATIONS_TABLE'))
{
define('USER_NOTIFICATIONS_TABLE', $table_prefix . 'user_notifications');
}
$phpbb_container = new ContainerBuilder(); $phpbb_container = new ContainerBuilder();
$loader = new YamlFileLoader($phpbb_container, new FileLocator(__DIR__.'/../config')); $loader = new YamlFileLoader($phpbb_container, new FileLocator(__DIR__.'/../config'));
@ -1125,7 +1117,7 @@ function database_update_info()
'ext_name' => array('UNIQUE', 'ext_name'), 'ext_name' => array('UNIQUE', 'ext_name'),
), ),
), ),
NOTIFICATIONS_TABLE => array( $table_prefix . 'notifications' => array(
'COLUMNS' => array( 'COLUMNS' => array(
'notification_id' => array('UINT', NULL, 'auto_increment'), 'notification_id' => array('UINT', NULL, 'auto_increment'),
'item_type' => array('VCHAR:255', ''), 'item_type' => array('VCHAR:255', ''),
@ -1148,7 +1140,7 @@ function database_update_info()
'is_enabled' => array('INDEX', 'is_enabled'), 'is_enabled' => array('INDEX', 'is_enabled'),
), ),
), ),
USER_NOTIFICATIONS_TABLE => array( $table_prefix . 'user_notifications' => array(
'COLUMNS' => array( 'COLUMNS' => array(
'item_type' => array('VCHAR:255', ''), 'item_type' => array('VCHAR:255', ''),
'item_id' => array('UINT', 0), 'item_id' => array('UINT', 0),
@ -2791,7 +2783,7 @@ function change_database_data(&$no_updates, $version)
$result = $db->sql_query($sql); $result = $db->sql_query($sql);
while ($row = $db->sql_fetchrow($result)) while ($row = $db->sql_fetchrow($result))
{ {
_sql('INSERT INTO ' . USER_NOTIFICATIONS_TABLE . ' ' . $db->sql_build_array('INSERT', array( _sql('INSERT INTO ' . $table_prefix . 'user_notifications ' . $db->sql_build_array('INSERT', array(
'item_type' => $convert_data['item_type'], 'item_type' => $convert_data['item_type'],
'item_id' => 0, 'item_id' => 0,
'user_id' => $row['user_id'], 'user_id' => $row['user_id'],
@ -2800,7 +2792,7 @@ function change_database_data(&$no_updates, $version)
if ($row['user_notify_type'] == NOTIFY_EMAIL || $row['user_notify_type'] == NOTIFY_BOTH) if ($row['user_notify_type'] == NOTIFY_EMAIL || $row['user_notify_type'] == NOTIFY_BOTH)
{ {
_sql('INSERT INTO ' . USER_NOTIFICATIONS_TABLE . ' ' . $db->sql_build_array('INSERT', array( _sql('INSERT INTO ' . $table_prefix . 'user_notifications ' . $db->sql_build_array('INSERT', array(
'item_type' => $convert_data['item_type'], 'item_type' => $convert_data['item_type'],
'item_id' => 0, 'item_id' => 0,
'user_id' => $row['user_id'], 'user_id' => $row['user_id'],
@ -2810,7 +2802,7 @@ function change_database_data(&$no_updates, $version)
if ($row['user_notify_type'] == NOTIFY_IM || $row['user_notify_type'] == NOTIFY_BOTH) if ($row['user_notify_type'] == NOTIFY_IM || $row['user_notify_type'] == NOTIFY_BOTH)
{ {
_sql('INSERT INTO ' . USER_NOTIFICATIONS_TABLE . ' ' . $db->sql_build_array('INSERT', array( _sql('INSERT INTO ' . $table_prefix . 'user_notifications ' . $db->sql_build_array('INSERT', array(
'item_type' => $convert_data['item_type'], 'item_type' => $convert_data['item_type'],
'item_id' => 0, 'item_id' => 0,
'user_id' => $row['user_id'], 'user_id' => $row['user_id'],