diff options
22 files changed, 55 insertions, 56 deletions
diff --git a/phpBB/develop/create_schema_files.php b/phpBB/develop/create_schema_files.php index 10306c9124..999ace57d7 100644 --- a/phpBB/develop/create_schema_files.php +++ b/phpBB/develop/create_schema_files.php @@ -1305,14 +1305,14 @@ function get_schema_struct() $schema_data['phpbb_notifications'] = array( 'COLUMNS' => array( - 'notification_id' => array('UINT', NULL, 'auto_increment'), - 'item_type' => array('VCHAR:255', ''), - 'item_id' => array('UINT', 0), - 'item_parent_id' => array('UINT', 0), - 'user_id' => array('UINT', 0), - 'unread' => array('BOOL', 1), - 'time' => array('TIMESTAMP', 1), - 'data' => array('TEXT_UNI', ''), + 'notification_id' => array('UINT', NULL, 'auto_increment'), + 'item_type' => array('VCHAR:255', ''), + 'item_id' => array('UINT', 0), + 'item_parent_id' => array('UINT', 0), + 'user_id' => array('UINT', 0), + 'unread' => array('BOOL', 1), + 'notification_time' => array('TIMESTAMP', 1), + 'data' => array('TEXT_UNI', ''), ), 'PRIMARY_KEY' => 'notification_id', 'KEYS' => array( diff --git a/phpBB/includes/notification/manager.php b/phpBB/includes/notification/manager.php index 63db3e6e9a..8276996b94 100644 --- a/phpBB/includes/notification/manager.php +++ b/phpBB/includes/notification/manager.php @@ -96,7 +96,7 @@ class phpbb_notification_manager $options = array_merge(array( 'notification_id' => false, 'user_id' => $this->user->data['user_id'], - 'order_by' => 'time', + 'order_by' => 'notification_time', 'order_dir' => 'DESC', 'limit' => 0, 'start' => 0, @@ -238,10 +238,9 @@ class phpbb_notification_manager $sql = 'UPDATE ' . $this->notifications_table . " SET unread = 0 - WHERE time <= " . $time . + 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) : '') . - (($user_id !== false) ? ' AND ' . (is_array($user_id) ? $this->db->sql_in_set('user_id', $user_id) : 'user_id = ' . (int) $user_id) : ''); $this->db->sql_query($sql); } @@ -270,7 +269,7 @@ class phpbb_notification_manager $sql = 'UPDATE ' . $this->notifications_table . " SET unread = 0 WHERE item_type = '" . $this->db->sql_escape($item_type) . "' - AND time <= " . $time . + 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) : ''); $this->db->sql_query($sql); @@ -288,7 +287,7 @@ class phpbb_notification_manager $sql = 'UPDATE ' . $this->notifications_table . " SET unread = 0 - WHERE time <= " . $time . ' + 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); } @@ -793,7 +792,7 @@ class phpbb_notification_manager public function prune_notifications($timestamp) { $sql = 'DELETE FROM ' . $this->notifications_table . ' - WHERE time < ' . (int) $timestamp; + WHERE notification_time < ' . (int) $timestamp; $this->db->sql_query($sql); } diff --git a/phpBB/includes/notification/type/approve_post.php b/phpBB/includes/notification/type/approve_post.php index 38ff3f1d70..1a30781c35 100644 --- a/phpBB/includes/notification/type/approve_post.php +++ b/phpBB/includes/notification/type/approve_post.php @@ -32,7 +32,7 @@ class phpbb_notification_type_approve_post extends phpbb_notification_type_post { return 'approve_post'; } - + /** * Language key used to output the text * @@ -123,7 +123,7 @@ class phpbb_notification_type_approve_post extends phpbb_notification_type_post $data = parent::create_insert_array($post, $pre_create_data); - $this->time = $data['time'] = time(); + $this->notification_time = $data['notification_time'] = time(); return $data; } diff --git a/phpBB/includes/notification/type/approve_topic.php b/phpBB/includes/notification/type/approve_topic.php index 5b9ea409fe..e728e9ac30 100644 --- a/phpBB/includes/notification/type/approve_topic.php +++ b/phpBB/includes/notification/type/approve_topic.php @@ -121,7 +121,7 @@ class phpbb_notification_type_approve_topic extends phpbb_notification_type_topi { $data = parent::create_insert_array($post, $pre_create_data); - $this->time = $data['time'] = time(); + $this->notification_time = $data['notification_time'] = time(); return $data; } diff --git a/phpBB/includes/notification/type/base.php b/phpBB/includes/notification/type/base.php index effa57e3a3..45d0e5f60c 100644 --- a/phpBB/includes/notification/type/base.php +++ b/phpBB/includes/notification/type/base.php @@ -168,7 +168,7 @@ 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), - 'time' => time(), + 'notification_time' => time(), 'unread' => true, 'data' => array(), @@ -195,7 +195,7 @@ abstract class phpbb_notification_type_base implements phpbb_notification_type_i // Unset data unique to each row unset( - $data['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_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['user_id'] @@ -250,7 +250,7 @@ abstract class phpbb_notification_type_base implements phpbb_notification_type_i 'FORMATTED_TITLE' => $this->get_title(), 'URL' => $this->get_url(), - 'TIME' => $this->user->format_date($this->time), + 'TIME' => $this->user->format_date($this->notification_time), 'UNREAD' => $this->unread, diff --git a/phpBB/includes/notification/type/disapprove_post.php b/phpBB/includes/notification/type/disapprove_post.php index d1d56086e7..951c7e0254 100644 --- a/phpBB/includes/notification/type/disapprove_post.php +++ b/phpBB/includes/notification/type/disapprove_post.php @@ -103,7 +103,7 @@ class phpbb_notification_type_disapprove_post extends phpbb_notification_type_ap $data = parent::create_insert_array($post); - $this->time = $data['time'] = time(); + $this->notification_time = $data['notification_time'] = time(); return $data; } diff --git a/phpBB/includes/notification/type/disapprove_topic.php b/phpBB/includes/notification/type/disapprove_topic.php index 7affaa8afa..038e528797 100644 --- a/phpBB/includes/notification/type/disapprove_topic.php +++ b/phpBB/includes/notification/type/disapprove_topic.php @@ -103,7 +103,7 @@ class phpbb_notification_type_disapprove_topic extends phpbb_notification_type_a $data = parent::create_insert_array($post, $pre_create_data); - $this->time = $data['time'] = time(); + $this->notification_time = $data['notification_time'] = time(); return $data; } diff --git a/phpBB/includes/notification/type/post.php b/phpBB/includes/notification/type/post.php index 0a42029f18..5eced0ca83 100644 --- a/phpBB/includes/notification/type/post.php +++ b/phpBB/includes/notification/type/post.php @@ -320,11 +320,11 @@ class phpbb_notification_type_post extends phpbb_notification_type_base $this->set_data('forum_name', $post['forum_name']); - $this->time = $post['post_time']; + $this->notification_time = $post['post_time']; // Topics can be "read" before they are public (while awaiting approval). // 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->time) + if (isset($pre_create_data[$this->user_id]) && $pre_create_data[$this->user_id] >= $this->notification_time) { $this->unread = false; } diff --git a/phpBB/includes/notification/type/post_in_queue.php b/phpBB/includes/notification/type/post_in_queue.php index 3cd9b11283..1c29bee3cd 100644 --- a/phpBB/includes/notification/type/post_in_queue.php +++ b/phpBB/includes/notification/type/post_in_queue.php @@ -120,7 +120,7 @@ class phpbb_notification_type_post_in_queue extends phpbb_notification_type_post { $data = parent::create_insert_array($post, $pre_create_data); - $this->time = $data['time'] = time(); + $this->notification_time = $data['notification_time'] = time(); return $data; } diff --git a/phpBB/includes/notification/type/report_pm_closed.php b/phpBB/includes/notification/type/report_pm_closed.php index 2d60ae21d4..a735d2a822 100644 --- a/phpBB/includes/notification/type/report_pm_closed.php +++ b/phpBB/includes/notification/type/report_pm_closed.php @@ -148,7 +148,7 @@ class phpbb_notification_type_report_pm_closed extends phpbb_notification_type_p $data = parent::create_insert_array($pm, $pre_create_data); - $this->time = $data['time'] = time(); + $this->notification_time = $data['notification_time'] = time(); return $data; } diff --git a/phpBB/includes/notification/type/report_post_closed.php b/phpBB/includes/notification/type/report_post_closed.php index 3282ba7d8c..8b984fc8ce 100644 --- a/phpBB/includes/notification/type/report_post_closed.php +++ b/phpBB/includes/notification/type/report_post_closed.php @@ -148,7 +148,7 @@ class phpbb_notification_type_report_post_closed extends phpbb_notification_type $data = parent::create_insert_array($post, $pre_create_data); - $this->time = $data['time'] = time(); + $this->notification_time = $data['notification_time'] = time(); return $data; } diff --git a/phpBB/includes/notification/type/topic.php b/phpBB/includes/notification/type/topic.php index 614d644501..6eb78c30bb 100644 --- a/phpBB/includes/notification/type/topic.php +++ b/phpBB/includes/notification/type/topic.php @@ -261,11 +261,11 @@ class phpbb_notification_type_topic extends phpbb_notification_type_base $this->set_data('forum_name', $post['forum_name']); - $this->time = $post['post_time']; + $this->notification_time = $post['post_time']; // Topics can be "read" before they are public (while awaiting approval). // 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->time) + if (isset($pre_create_data[$this->user_id]) && $pre_create_data[$this->user_id] >= $this->notification_time) { $this->unread = false; } diff --git a/phpBB/includes/notification/type/topic_in_queue.php b/phpBB/includes/notification/type/topic_in_queue.php index 170a98ca1b..dc0b9f9869 100644 --- a/phpBB/includes/notification/type/topic_in_queue.php +++ b/phpBB/includes/notification/type/topic_in_queue.php @@ -113,7 +113,7 @@ class phpbb_notification_type_topic_in_queue extends phpbb_notification_type_top { $data = parent::create_insert_array($topic, $pre_create_data); - $this->time = $data['time'] = time(); + $this->notification_time = $data['notification_time'] = time(); return $data; } diff --git a/phpBB/install/database_update.php b/phpBB/install/database_update.php index ae810e1022..614f41f139 100644 --- a/phpBB/install/database_update.php +++ b/phpBB/install/database_update.php @@ -1192,15 +1192,15 @@ function database_update_info() ), NOTIFICATIONS_TABLE => array( 'COLUMNS' => array( - 'notification_id' => array('UINT', NULL, 'auto_increment'), - 'item_type' => array('VCHAR:255', ''), - 'item_id' => array('UINT', 0), - 'item_parent_id' => array('UINT', 0), - 'user_id' => array('UINT', 0), - 'unread' => array('BOOL', 1), - 'is_enabled' => array('BOOL', 1), - 'time' => array('TIMESTAMP', 1), - 'data' => array('TEXT_UNI', ''), + 'notification_id' => array('UINT', NULL, 'auto_increment'), + 'item_type' => array('VCHAR:255', ''), + 'item_id' => array('UINT', 0), + 'item_parent_id' => array('UINT', 0), + 'user_id' => array('UINT', 0), + 'unread' => array('BOOL', 1), + 'is_enabled' => array('BOOL', 1), + 'notification_time' => array('TIMESTAMP', 1), + 'data' => array('TEXT_UNI', ''), ), 'PRIMARY_KEY' => 'notification_id', 'KEYS' => array( diff --git a/phpBB/install/schemas/firebird_schema.sql b/phpBB/install/schemas/firebird_schema.sql index 5f7d23e411..8f45265c17 100644 --- a/phpBB/install/schemas/firebird_schema.sql +++ b/phpBB/install/schemas/firebird_schema.sql @@ -635,7 +635,7 @@ CREATE TABLE phpbb_notifications ( item_parent_id INTEGER DEFAULT 0 NOT NULL, user_id INTEGER DEFAULT 0 NOT NULL, unread INTEGER DEFAULT 1 NOT NULL, - time INTEGER DEFAULT 1 NOT NULL, + notification_time INTEGER DEFAULT 1 NOT NULL, data BLOB SUB_TYPE TEXT CHARACTER SET UTF8 DEFAULT '' NOT NULL );; diff --git a/phpBB/install/schemas/mssql_schema.sql b/phpBB/install/schemas/mssql_schema.sql index 15529cde38..18f3dd3a04 100644 --- a/phpBB/install/schemas/mssql_schema.sql +++ b/phpBB/install/schemas/mssql_schema.sql @@ -779,7 +779,7 @@ CREATE TABLE [phpbb_notifications] ( [item_parent_id] [int] DEFAULT (0) NOT NULL , [user_id] [int] DEFAULT (0) NOT NULL , [unread] [int] DEFAULT (1) NOT NULL , - [time] [int] DEFAULT (1) NOT NULL , + [notification_time] [int] DEFAULT (1) NOT NULL , [data] [varchar] (4000) DEFAULT ('') NOT NULL ) ON [PRIMARY] GO diff --git a/phpBB/install/schemas/mysql_40_schema.sql b/phpBB/install/schemas/mysql_40_schema.sql index f295664c64..140cb354a7 100644 --- a/phpBB/install/schemas/mysql_40_schema.sql +++ b/phpBB/install/schemas/mysql_40_schema.sql @@ -446,7 +446,7 @@ CREATE TABLE phpbb_notifications ( 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, - time int(11) UNSIGNED DEFAULT '1' 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), diff --git a/phpBB/install/schemas/mysql_41_schema.sql b/phpBB/install/schemas/mysql_41_schema.sql index bfba8e5f64..913968c174 100644 --- a/phpBB/install/schemas/mysql_41_schema.sql +++ b/phpBB/install/schemas/mysql_41_schema.sql @@ -446,7 +446,7 @@ CREATE TABLE phpbb_notifications ( 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, - time int(11) UNSIGNED DEFAULT '1' 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), diff --git a/phpBB/install/schemas/oracle_schema.sql b/phpBB/install/schemas/oracle_schema.sql index aae49afd70..8a6e9fffc6 100644 --- a/phpBB/install/schemas/oracle_schema.sql +++ b/phpBB/install/schemas/oracle_schema.sql @@ -861,7 +861,7 @@ CREATE TABLE phpbb_notifications ( item_parent_id number(8) DEFAULT '0' NOT NULL, user_id number(8) DEFAULT '0' NOT NULL, unread number(1) DEFAULT '1' NOT NULL, - time number(11) DEFAULT '1' NOT NULL, + notification_time number(11) DEFAULT '1' NOT NULL, data clob DEFAULT '' , CONSTRAINT pk_phpbb_notifications PRIMARY KEY (notification_id) ) diff --git a/phpBB/install/schemas/postgres_schema.sql b/phpBB/install/schemas/postgres_schema.sql index 05533fc731..6d9a910912 100644 --- a/phpBB/install/schemas/postgres_schema.sql +++ b/phpBB/install/schemas/postgres_schema.sql @@ -618,7 +618,7 @@ CREATE TABLE phpbb_notifications ( 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), - time INT4 DEFAULT '1' NOT NULL CHECK (time >= 0), + notification_time INT4 DEFAULT '1' NOT NULL CHECK (notification_time >= 0), data varchar(4000) DEFAULT '' NOT NULL, PRIMARY KEY (notification_id) ); diff --git a/phpBB/install/schemas/sqlite_schema.sql b/phpBB/install/schemas/sqlite_schema.sql index fa61e4104f..7f93aaf0c7 100644 --- a/phpBB/install/schemas/sqlite_schema.sql +++ b/phpBB/install/schemas/sqlite_schema.sql @@ -433,7 +433,7 @@ CREATE TABLE phpbb_notifications ( item_parent_id INTEGER UNSIGNED NOT NULL DEFAULT '0', user_id INTEGER UNSIGNED NOT NULL DEFAULT '0', unread INTEGER UNSIGNED NOT NULL DEFAULT '1', - time INTEGER UNSIGNED NOT NULL DEFAULT '1', + notification_time INTEGER UNSIGNED NOT NULL DEFAULT '1', data text(65535) NOT NULL DEFAULT '' ); diff --git a/tests/notification/notification.php b/tests/notification/notification.php index 2f2a404216..cda0a7b70a 100644 --- a/tests/notification/notification.php +++ b/tests/notification/notification.php @@ -206,7 +206,7 @@ class phpbb_notification_test extends phpbb_database_test_case 'item_parent_id' => 1, 'user_id' => 0, 'unread' => 1, - 'time' => 1349413321, + 'notification_time' => 1349413321, 'data' => array(), ), 2 => array( @@ -215,7 +215,7 @@ class phpbb_notification_test extends phpbb_database_test_case 'item_parent_id' => 2, 'user_id' => 0, 'unread' => 1, - 'time' => 1349413322, + 'notification_time' => 1349413322, 'data' => array(), ), 3 => array( @@ -224,7 +224,7 @@ class phpbb_notification_test extends phpbb_database_test_case 'item_parent_id' => 2, 'user_id' => 0, 'unread' => 1, - 'time' => 1349413323, + 'notification_time' => 1349413323, 'data' => array(), ), 4 => array( @@ -233,7 +233,7 @@ class phpbb_notification_test extends phpbb_database_test_case 'item_parent_id' => 2, 'user_id' => 0, 'unread' => 1, - 'time' => 1349413324, + 'notification_time' => 1349413324, 'data' => array( 'poster_id' => 2, 'topic_title' => 'test-title', @@ -249,7 +249,7 @@ class phpbb_notification_test extends phpbb_database_test_case 'item_parent_id' => 2, 'user_id' => 0, 'unread' => 1, - 'time' => 1349413325, + 'notification_time' => 1349413325, 'data' => array( 'poster_id' => 2, 'topic_title' => 'test-title', @@ -312,7 +312,7 @@ class phpbb_notification_test extends phpbb_database_test_case 'item_parent_id' => 2, 'user_id' => 0, 'unread' => 1, - 'time' => 1349413321, + 'notification_time' => 1349413321, 'data' => array(), ), 2 => array( @@ -321,7 +321,7 @@ class phpbb_notification_test extends phpbb_database_test_case 'item_parent_id' => 2, 'user_id' => 0, 'unread' => 1, - 'time' => 1349413322, + 'notification_time' => 1349413322, 'data' => array(), ), 3 => array( @@ -330,7 +330,7 @@ class phpbb_notification_test extends phpbb_database_test_case 'item_parent_id' => 2, 'user_id' => 0, 'unread' => 1, - 'time' => 1234, + 'notification_time' => 1234, 'data' => array(), ), 4 => array( @@ -339,7 +339,7 @@ class phpbb_notification_test extends phpbb_database_test_case 'item_parent_id' => 2, 'user_id' => 0, 'unread' => 1, - 'time' => 1349413324, + 'notification_time' => 1349413324, 'data' => array( 'poster_id' => 2, 'topic_title' => 'test-title', @@ -355,7 +355,7 @@ class phpbb_notification_test extends phpbb_database_test_case 'item_parent_id' => 2, 'user_id' => 0, 'unread' => 1, - 'time' => 1349413325, + 'notification_time' => 1349413325, 'data' => array( 'poster_id' => 2, 'topic_title' => 'test-title2', |