aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--phpBB/develop/create_schema_files.php4
-rw-r--r--phpBB/includes/notification/manager.php15
-rw-r--r--phpBB/includes/notification/type/base.php14
-rw-r--r--phpBB/includes/notification/type/bookmark.php2
-rw-r--r--phpBB/includes/notification/type/post.php4
-rw-r--r--phpBB/includes/notification/type/quote.php2
-rw-r--r--phpBB/includes/notification/type/topic.php2
-rw-r--r--phpBB/install/database_update.php4
-rw-r--r--phpBB/install/schemas/firebird_schema.sql4
-rw-r--r--phpBB/install/schemas/mssql_schema.sql4
-rw-r--r--phpBB/install/schemas/mysql_40_schema.sql4
-rw-r--r--phpBB/install/schemas/mysql_41_schema.sql4
-rw-r--r--phpBB/install/schemas/oracle_schema.sql4
-rw-r--r--phpBB/install/schemas/postgres_schema.sql4
-rw-r--r--phpBB/install/schemas/sqlite_schema.sql4
-rw-r--r--tests/notification/notification.php20
16 files changed, 51 insertions, 44 deletions
diff --git a/phpBB/develop/create_schema_files.php b/phpBB/develop/create_schema_files.php
index 999ace57d7..b3c10b1cfa 100644
--- a/phpBB/develop/create_schema_files.php
+++ b/phpBB/develop/create_schema_files.php
@@ -1310,14 +1310,14 @@ function get_schema_struct()
'item_id' => array('UINT', 0),
'item_parent_id' => array('UINT', 0),
'user_id' => array('UINT', 0),
- 'unread' => array('BOOL', 1),
+ 'notification_read' => array('BOOL', 0),
'notification_time' => array('TIMESTAMP', 1),
'data' => array('TEXT_UNI', ''),
),
'PRIMARY_KEY' => 'notification_id',
'KEYS' => array(
'item_ident' => array('INDEX', array('item_type', 'item_id')),
- 'user' => array('INDEX', array('user_id', 'unread')),
+ 'user' => array('INDEX', array('user_id', 'notification_read')),
),
);
diff --git a/phpBB/includes/notification/manager.php b/phpBB/includes/notification/manager.php
index 8276996b94..fa1fd4b81f 100644
--- a/phpBB/includes/notification/manager.php
+++ b/phpBB/includes/notification/manager.php
@@ -128,8 +128,13 @@ class phpbb_notification_manager
$sql = 'SELECT COUNT(n.notification_id) AS unread_count
FROM ' . $this->notifications_table . ' n, ' . $this->notification_types_table . ' nt
WHERE n.user_id = ' . (int) $options['user_id'] . '
+<<<<<<< HEAD
AND n.unread = 1
AND nt.notification_type = n.item_type
+=======
+ AND n.notification_read = 0
+ AND nt.notification_type = n.notification_type
+>>>>>>> 5cedca0... [ticket/11103] unread -> notification_read
AND nt.notification_type_enabled = 1';
$result = $this->db->sql_query($sql);
$unread_count = (int) $this->db->sql_fetchfield('unread_count', $result);
@@ -175,7 +180,7 @@ class phpbb_notification_manager
$sql = 'SELECT n.*
FROM ' . $this->notifications_table . ' n, ' . $this->notification_types_table . ' nt
WHERE n.user_id = ' . (int) $options['user_id'] . '
- AND n.unread = 1
+ AND n.notification_read = 0
AND ' . $this->db->sql_in_set('n.notification_id', array_keys($rowset), true) . '
AND nt.notification_type = n.item_type
AND nt.notification_type_enabled = 1
@@ -237,7 +242,7 @@ class phpbb_notification_manager
$time = ($time !== false) ? $time : time();
$sql = 'UPDATE ' . $this->notifications_table . "
- SET unread = 0
+ SET notification_read = 1
WHERE notification_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_id !== false) ? ' AND ' . (is_array($item_id) ? $this->db->sql_in_set('item_id', $item_id) : 'item_id = ' . (int) $item_id) : '') .
@@ -267,8 +272,10 @@ class phpbb_notification_manager
$time = ($time !== false) ? $time : time();
$sql = 'UPDATE ' . $this->notifications_table . "
- SET unread = 0
+ SET notification_read = 1
WHERE item_type = '" . $this->db->sql_escape($item_type) . "'
+ SET notification_read = 1
+ WHERE notification_type = '" . $this->db->sql_escape($notification_type) . "'
AND notification_time <= " . $time .
(($item_parent_id !== false) ? ' AND ' . (is_array($item_parent_id) ? $this->db->sql_in_set('item_parent_id', $item_parent_id) : 'item_parent_id = ' . (int) $item_parent_id) : '') .
(($user_id !== false) ? ' AND ' . (is_array($user_id) ? $this->db->sql_in_set('user_id', $user_id) : 'user_id = ' . (int) $user_id) : '');
@@ -286,7 +293,7 @@ class phpbb_notification_manager
$time = ($time !== false) ? $time : time();
$sql = 'UPDATE ' . $this->notifications_table . "
- SET unread = 0
+ SET notification_read = 1
WHERE notification_time <= " . $time . '
AND ' . ((is_array($notification_id)) ? $this->db->sql_in_set('notification_id', $notification_id) : 'notification_id = ' . (int) $notification_id);
$this->db->sql_query($sql);
diff --git a/phpBB/includes/notification/type/base.php b/phpBB/includes/notification/type/base.php
index 45d0e5f60c..cdca9aa642 100644
--- a/phpBB/includes/notification/type/base.php
+++ b/phpBB/includes/notification/type/base.php
@@ -168,8 +168,8 @@ abstract class phpbb_notification_type_base implements phpbb_notification_type_i
'item_type' => $this->get_type(),
'item_parent_id' => static::get_item_parent_id($type_data),
- 'notification_time' => time(),
- 'unread' => true,
+ 'notification_time' => time(),
+ 'notification_read' => false,
'data' => array(),
), $this->data);
@@ -197,7 +197,7 @@ abstract class phpbb_notification_type_base implements phpbb_notification_type_i
unset(
$data['notification_time'], // Also unsetting time, since it always tries to change the time to current (if you actually need to change the time, over-ride this function)
$data['notification_id'],
- $data['unread'],
+ $data['notification_read'],
$data['user_id']
);
@@ -252,9 +252,9 @@ abstract class phpbb_notification_type_base implements phpbb_notification_type_i
'URL' => $this->get_url(),
'TIME' => $this->user->format_date($this->notification_time),
- 'UNREAD' => $this->unread,
+ 'UNREAD' => !$this->notification_read,
- 'U_MARK_READ' => ($this->unread) ? $u_mark_read : '',
+ 'U_MARK_READ' => (!$this->notification_read) ? $u_mark_read : '',
);
}
@@ -402,7 +402,7 @@ abstract class phpbb_notification_type_base implements phpbb_notification_type_i
*/
protected function mark($unread = true, $return = false)
{
- $this->unread = (bool) $unread;
+ $this->notification_read = (bool) !$unread;
$where = array(
"item_type = '" . $this->db->sql_escape($this->item_type) . "'",
@@ -417,7 +417,7 @@ abstract class phpbb_notification_type_base implements phpbb_notification_type_i
}
$sql = 'UPDATE ' . $this->notifications_table . '
- SET unread = ' . (int) $this->unread . '
+ SET notification_read = ' . (int) $this->notification_read . '
WHERE ' . $where;
$this->db->sql_query($sql);
}
diff --git a/phpBB/includes/notification/type/bookmark.php b/phpBB/includes/notification/type/bookmark.php
index 750bd3b6cb..4e48a967d0 100644
--- a/phpBB/includes/notification/type/bookmark.php
+++ b/phpBB/includes/notification/type/bookmark.php
@@ -105,7 +105,7 @@ class phpbb_notification_type_bookmark extends phpbb_notification_type_post
FROM ' . $this->notifications_table . ' n, ' . $this->notification_types_table . " nt
WHERE n.item_type = '" . $this->get_type() . "'
AND n.item_parent_id = " . (int) self::get_item_parent_id($post) . '
- AND n.unread = 1
+ AND n.notification_read = 0
AND nt.notification_type = n.item_type
AND nt.notification_type_enabled = 1';
$result = $this->db->sql_query($sql);
diff --git a/phpBB/includes/notification/type/post.php b/phpBB/includes/notification/type/post.php
index 5eced0ca83..f29372923e 100644
--- a/phpBB/includes/notification/type/post.php
+++ b/phpBB/includes/notification/type/post.php
@@ -126,7 +126,7 @@ class phpbb_notification_type_post extends phpbb_notification_type_base
FROM ' . $this->notifications_table . ' n, ' . $this->notification_types_table . " nt
WHERE n.item_type = '" . $this->get_type() . "'
AND n.item_parent_id = " . (int) self::get_item_parent_id($post) . '
- AND n.unread = 1
+ AND n.notification_read = 0
AND nt.notification_type = n.item_type
AND nt.notification_type_enabled = 1';
$result = $this->db->sql_query($sql);
@@ -326,7 +326,7 @@ class phpbb_notification_type_post extends phpbb_notification_type_base
// Make sure that if the user has read the topic, it's marked as read in the notification
if (isset($pre_create_data[$this->user_id]) && $pre_create_data[$this->user_id] >= $this->notification_time)
{
- $this->unread = false;
+ $this->notification_read = true;
}
return parent::create_insert_array($post, $pre_create_data);
diff --git a/phpBB/includes/notification/type/quote.php b/phpBB/includes/notification/type/quote.php
index b3a347f98c..5453b267c8 100644
--- a/phpBB/includes/notification/type/quote.php
+++ b/phpBB/includes/notification/type/quote.php
@@ -124,7 +124,7 @@ class phpbb_notification_type_quote extends phpbb_notification_type_post
FROM ' . $this->notifications_table . ' n, ' . $this->notification_types_table . " nt
WHERE n.item_type = '" . $this->get_type() . "'
AND n.item_parent_id = " . (int) self::get_item_parent_id($post) . '
- AND n.unread = 1
+ AND n.notification_read = 0
AND nt.notification_type = n.item_type
AND nt.notification_type_enabled = 1';
$result = $this->db->sql_query($sql);
diff --git a/phpBB/includes/notification/type/topic.php b/phpBB/includes/notification/type/topic.php
index 6eb78c30bb..4f51ed4cb1 100644
--- a/phpBB/includes/notification/type/topic.php
+++ b/phpBB/includes/notification/type/topic.php
@@ -267,7 +267,7 @@ class phpbb_notification_type_topic extends phpbb_notification_type_base
// Make sure that if the user has read the topic, it's marked as read in the notification
if (isset($pre_create_data[$this->user_id]) && $pre_create_data[$this->user_id] >= $this->notification_time)
{
- $this->unread = false;
+ $this->notification_read = true;
}
return parent::create_insert_array($post, $pre_create_data);
diff --git a/phpBB/install/database_update.php b/phpBB/install/database_update.php
index 614f41f139..364eca9267 100644
--- a/phpBB/install/database_update.php
+++ b/phpBB/install/database_update.php
@@ -1197,7 +1197,7 @@ function database_update_info()
'item_id' => array('UINT', 0),
'item_parent_id' => array('UINT', 0),
'user_id' => array('UINT', 0),
- 'unread' => array('BOOL', 1),
+ 'notification_read' => array('BOOL', 0),
'is_enabled' => array('BOOL', 1),
'notification_time' => array('TIMESTAMP', 1),
'data' => array('TEXT_UNI', ''),
@@ -1205,7 +1205,7 @@ function database_update_info()
'PRIMARY_KEY' => 'notification_id',
'KEYS' => array(
'item_ident' => array('INDEX', array('item_type', 'item_id')),
- 'user' => array('INDEX', array('user_id', 'unread')),
+ 'user' => array('INDEX', array('user_id', 'notification_read')),
),
),
USER_NOTIFICATIONS_TABLE => array(
diff --git a/phpBB/install/schemas/firebird_schema.sql b/phpBB/install/schemas/firebird_schema.sql
index 8f45265c17..bb4e413ba1 100644
--- a/phpBB/install/schemas/firebird_schema.sql
+++ b/phpBB/install/schemas/firebird_schema.sql
@@ -634,7 +634,7 @@ CREATE TABLE phpbb_notifications (
item_id INTEGER DEFAULT 0 NOT NULL,
item_parent_id INTEGER DEFAULT 0 NOT NULL,
user_id INTEGER DEFAULT 0 NOT NULL,
- unread INTEGER DEFAULT 1 NOT NULL,
+ notification_read INTEGER DEFAULT 0 NOT NULL,
notification_time INTEGER DEFAULT 1 NOT NULL,
data BLOB SUB_TYPE TEXT CHARACTER SET UTF8 DEFAULT '' NOT NULL
);;
@@ -642,7 +642,7 @@ CREATE TABLE phpbb_notifications (
ALTER TABLE phpbb_notifications ADD PRIMARY KEY (notification_id);;
CREATE INDEX phpbb_notifications_item_ident ON phpbb_notifications(item_type, item_id);;
-CREATE INDEX phpbb_notifications_user ON phpbb_notifications(user_id, unread);;
+CREATE INDEX phpbb_notifications_user ON phpbb_notifications(user_id, notification_read);;
CREATE GENERATOR phpbb_notifications_gen;;
SET GENERATOR phpbb_notifications_gen TO 0;;
diff --git a/phpBB/install/schemas/mssql_schema.sql b/phpBB/install/schemas/mssql_schema.sql
index 18f3dd3a04..1fa3616857 100644
--- a/phpBB/install/schemas/mssql_schema.sql
+++ b/phpBB/install/schemas/mssql_schema.sql
@@ -778,7 +778,7 @@ CREATE TABLE [phpbb_notifications] (
[item_id] [int] DEFAULT (0) NOT NULL ,
[item_parent_id] [int] DEFAULT (0) NOT NULL ,
[user_id] [int] DEFAULT (0) NOT NULL ,
- [unread] [int] DEFAULT (1) NOT NULL ,
+ [notification_read] [int] DEFAULT (0) NOT NULL ,
[notification_time] [int] DEFAULT (1) NOT NULL ,
[data] [varchar] (4000) DEFAULT ('') NOT NULL
) ON [PRIMARY]
@@ -794,7 +794,7 @@ GO
CREATE INDEX [item_ident] ON [phpbb_notifications]([item_type], [item_id]) ON [PRIMARY]
GO
-CREATE INDEX [user] ON [phpbb_notifications]([user_id], [unread]) ON [PRIMARY]
+CREATE INDEX [user] ON [phpbb_notifications]([user_id], [notification_read]) ON [PRIMARY]
GO
diff --git a/phpBB/install/schemas/mysql_40_schema.sql b/phpBB/install/schemas/mysql_40_schema.sql
index 140cb354a7..8163b7a051 100644
--- a/phpBB/install/schemas/mysql_40_schema.sql
+++ b/phpBB/install/schemas/mysql_40_schema.sql
@@ -445,12 +445,12 @@ CREATE TABLE phpbb_notifications (
item_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL,
item_parent_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL,
user_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL,
- unread tinyint(1) UNSIGNED DEFAULT '1' NOT NULL,
+ notification_read tinyint(1) UNSIGNED DEFAULT '0' NOT NULL,
notification_time int(11) UNSIGNED DEFAULT '1' NOT NULL,
data blob NOT NULL,
PRIMARY KEY (notification_id),
KEY item_ident (item_type, item_id),
- KEY user (user_id, unread)
+ KEY user (user_id, notification_read)
);
diff --git a/phpBB/install/schemas/mysql_41_schema.sql b/phpBB/install/schemas/mysql_41_schema.sql
index 913968c174..6654734ab8 100644
--- a/phpBB/install/schemas/mysql_41_schema.sql
+++ b/phpBB/install/schemas/mysql_41_schema.sql
@@ -445,12 +445,12 @@ CREATE TABLE phpbb_notifications (
item_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL,
item_parent_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL,
user_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL,
- unread tinyint(1) UNSIGNED DEFAULT '1' NOT NULL,
+ notification_read tinyint(1) UNSIGNED DEFAULT '0' NOT NULL,
notification_time int(11) UNSIGNED DEFAULT '1' NOT NULL,
data text NOT NULL,
PRIMARY KEY (notification_id),
KEY item_ident (item_type, item_id),
- KEY user (user_id, unread)
+ KEY user (user_id, notification_read)
) CHARACTER SET `utf8` COLLATE `utf8_bin`;
diff --git a/phpBB/install/schemas/oracle_schema.sql b/phpBB/install/schemas/oracle_schema.sql
index 8a6e9fffc6..a65fe63167 100644
--- a/phpBB/install/schemas/oracle_schema.sql
+++ b/phpBB/install/schemas/oracle_schema.sql
@@ -860,7 +860,7 @@ CREATE TABLE phpbb_notifications (
item_id number(8) DEFAULT '0' NOT NULL,
item_parent_id number(8) DEFAULT '0' NOT NULL,
user_id number(8) DEFAULT '0' NOT NULL,
- unread number(1) DEFAULT '1' NOT NULL,
+ notification_read number(1) DEFAULT '0' NOT NULL,
notification_time number(11) DEFAULT '1' NOT NULL,
data clob DEFAULT '' ,
CONSTRAINT pk_phpbb_notifications PRIMARY KEY (notification_id)
@@ -869,7 +869,7 @@ CREATE TABLE phpbb_notifications (
CREATE INDEX phpbb_notifications_item_ident ON phpbb_notifications (item_type, item_id)
/
-CREATE INDEX phpbb_notifications_user ON phpbb_notifications (user_id, unread)
+CREATE INDEX phpbb_notifications_user ON phpbb_notifications (user_id, notification_read)
/
CREATE SEQUENCE phpbb_notifications_seq
diff --git a/phpBB/install/schemas/postgres_schema.sql b/phpBB/install/schemas/postgres_schema.sql
index 6d9a910912..504ffe8282 100644
--- a/phpBB/install/schemas/postgres_schema.sql
+++ b/phpBB/install/schemas/postgres_schema.sql
@@ -617,14 +617,14 @@ CREATE TABLE phpbb_notifications (
item_id INT4 DEFAULT '0' NOT NULL CHECK (item_id >= 0),
item_parent_id INT4 DEFAULT '0' NOT NULL CHECK (item_parent_id >= 0),
user_id INT4 DEFAULT '0' NOT NULL CHECK (user_id >= 0),
- unread INT2 DEFAULT '1' NOT NULL CHECK (unread >= 0),
+ notification_read INT2 DEFAULT '0' NOT NULL CHECK (notification_read >= 0),
notification_time INT4 DEFAULT '1' NOT NULL CHECK (notification_time >= 0),
data varchar(4000) DEFAULT '' NOT NULL,
PRIMARY KEY (notification_id)
);
CREATE INDEX phpbb_notifications_item_ident ON phpbb_notifications (item_type, item_id);
-CREATE INDEX phpbb_notifications_user ON phpbb_notifications (user_id, unread);
+CREATE INDEX phpbb_notifications_user ON phpbb_notifications (user_id, notification_read);
/*
Table: 'phpbb_poll_options'
diff --git a/phpBB/install/schemas/sqlite_schema.sql b/phpBB/install/schemas/sqlite_schema.sql
index 7f93aaf0c7..836d0a0bd0 100644
--- a/phpBB/install/schemas/sqlite_schema.sql
+++ b/phpBB/install/schemas/sqlite_schema.sql
@@ -432,13 +432,13 @@ CREATE TABLE phpbb_notifications (
item_id INTEGER UNSIGNED NOT NULL DEFAULT '0',
item_parent_id INTEGER UNSIGNED NOT NULL DEFAULT '0',
user_id INTEGER UNSIGNED NOT NULL DEFAULT '0',
- unread INTEGER UNSIGNED NOT NULL DEFAULT '1',
+ notification_read INTEGER UNSIGNED NOT NULL DEFAULT '0',
notification_time INTEGER UNSIGNED NOT NULL DEFAULT '1',
data text(65535) NOT NULL DEFAULT ''
);
CREATE INDEX phpbb_notifications_item_ident ON phpbb_notifications (item_type, item_id);
-CREATE INDEX phpbb_notifications_user ON phpbb_notifications (user_id, unread);
+CREATE INDEX phpbb_notifications_user ON phpbb_notifications (user_id, notification_read);
# Table: 'phpbb_poll_options'
CREATE TABLE phpbb_poll_options (
diff --git a/tests/notification/notification.php b/tests/notification/notification.php
index cda0a7b70a..34b8423689 100644
--- a/tests/notification/notification.php
+++ b/tests/notification/notification.php
@@ -205,7 +205,7 @@ class phpbb_notification_test extends phpbb_database_test_case
'item_id' => 1,
'item_parent_id' => 1,
'user_id' => 0,
- 'unread' => 1,
+ 'notification_read' => 0,
'notification_time' => 1349413321,
'data' => array(),
),
@@ -214,7 +214,7 @@ class phpbb_notification_test extends phpbb_database_test_case
'item_id' => 2,
'item_parent_id' => 2,
'user_id' => 0,
- 'unread' => 1,
+ 'notification_read' => 0,
'notification_time' => 1349413322,
'data' => array(),
),
@@ -223,7 +223,7 @@ class phpbb_notification_test extends phpbb_database_test_case
'item_id' => 3,
'item_parent_id' => 2,
'user_id' => 0,
- 'unread' => 1,
+ 'notification_read' => 0,
'notification_time' => 1349413323,
'data' => array(),
),
@@ -232,7 +232,7 @@ class phpbb_notification_test extends phpbb_database_test_case
'item_id' => 4,
'item_parent_id' => 2,
'user_id' => 0,
- 'unread' => 1,
+ 'notification_read' => 0,
'notification_time' => 1349413324,
'data' => array(
'poster_id' => 2,
@@ -248,7 +248,7 @@ class phpbb_notification_test extends phpbb_database_test_case
'item_id' => 5,
'item_parent_id' => 2,
'user_id' => 0,
- 'unread' => 1,
+ 'notification_read' => 0,
'notification_time' => 1349413325,
'data' => array(
'poster_id' => 2,
@@ -311,7 +311,7 @@ class phpbb_notification_test extends phpbb_database_test_case
'item_id' => 1,
'item_parent_id' => 2,
'user_id' => 0,
- 'unread' => 1,
+ 'notification_read' => 0,
'notification_time' => 1349413321,
'data' => array(),
),
@@ -320,7 +320,7 @@ class phpbb_notification_test extends phpbb_database_test_case
'item_id' => 2,
'item_parent_id' => 2,
'user_id' => 0,
- 'unread' => 1,
+ 'notification_read' => 0,
'notification_time' => 1349413322,
'data' => array(),
),
@@ -329,7 +329,7 @@ class phpbb_notification_test extends phpbb_database_test_case
'item_id' => 3,
'item_parent_id' => 2,
'user_id' => 0,
- 'unread' => 1,
+ 'notification_read' => 0,
'notification_time' => 1234,
'data' => array(),
),
@@ -338,7 +338,7 @@ class phpbb_notification_test extends phpbb_database_test_case
'item_id' => 4,
'item_parent_id' => 2,
'user_id' => 0,
- 'unread' => 1,
+ 'notification_read' => 0,
'notification_time' => 1349413324,
'data' => array(
'poster_id' => 2,
@@ -354,7 +354,7 @@ class phpbb_notification_test extends phpbb_database_test_case
'item_id' => 5,
'item_parent_id' => 2,
'user_id' => 0,
- 'unread' => 1,
+ 'notification_read' => 0,
'notification_time' => 1349413325,
'data' => array(
'poster_id' => 2,