From 9c5482317ecf749012fc76e925b9fe1a07a1963b Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Sun, 21 Oct 2012 22:33:28 +0200 Subject: [PATCH] [feature/soft-delete] Add new fields for topic/post counts for softdelete We can not use the replies vs replies_real anymore, as we need to be able to determinate whether the posts are unapproved or softdeleted. So we need to add a new field and there by change the second one for consistency. We also add the posts_* fields for forums, which are a missing feature. PHPBB3-9567 --- phpBB/develop/create_schema_files.php | 14 +++++++++----- phpBB/install/schemas/firebird_schema.sql | 10 +++++++--- phpBB/install/schemas/mssql_schema.sql | 10 +++++++--- phpBB/install/schemas/mysql_40_schema.sql | 10 +++++++--- phpBB/install/schemas/mysql_41_schema.sql | 10 +++++++--- phpBB/install/schemas/oracle_schema.sql | 10 +++++++--- phpBB/install/schemas/postgres_schema.sql | 10 +++++++--- phpBB/install/schemas/sqlite_schema.sql | 10 +++++++--- 8 files changed, 58 insertions(+), 26 deletions(-) diff --git a/phpBB/develop/create_schema_files.php b/phpBB/develop/create_schema_files.php index c011dc91bb..ef679b1ea2 100644 --- a/phpBB/develop/create_schema_files.php +++ b/phpBB/develop/create_schema_files.php @@ -1096,9 +1096,12 @@ function get_schema_struct() 'forum_topics_per_page' => array('TINT:4', 0), 'forum_type' => array('TINT:4', 0), 'forum_status' => array('TINT:4', 0), - 'forum_posts' => array('UINT', 0), - 'forum_topics' => array('UINT', 0), - 'forum_topics_real' => array('UINT', 0), + 'forum_posts' => array('UINT', 0), + 'forum_posts_unapproved' => array('UINT', 0), + 'forum_posts_softdeleted' => array('UINT', 0), + 'forum_topics' => array('UINT', 0), + 'forum_topics_unapproved' => array('UINT', 0), + 'forum_topics_softdeleted' => array('UINT', 0), 'forum_last_post_id' => array('UINT', 0), 'forum_last_poster_id' => array('UINT', 0), 'forum_last_post_subject' => array('STEXT_UNI', ''), @@ -1683,8 +1686,9 @@ function get_schema_struct() 'topic_time' => array('TIMESTAMP', 0), 'topic_time_limit' => array('TIMESTAMP', 0), 'topic_views' => array('UINT', 0), - 'topic_replies' => array('UINT', 0), - 'topic_replies_real' => array('UINT', 0), + 'topic_posts' => array('UINT', 0), + 'topic_posts_unapproved' => array('UINT', 0), + 'topic_posts_softdeleted' => array('UINT', 0), 'topic_status' => array('TINT:3', 0), 'topic_type' => array('TINT:3', 0), 'topic_first_post_id' => array('UINT', 0), diff --git a/phpBB/install/schemas/firebird_schema.sql b/phpBB/install/schemas/firebird_schema.sql index a944ccd530..87ad0c6480 100644 --- a/phpBB/install/schemas/firebird_schema.sql +++ b/phpBB/install/schemas/firebird_schema.sql @@ -364,8 +364,11 @@ CREATE TABLE phpbb_forums ( forum_type INTEGER DEFAULT 0 NOT NULL, forum_status INTEGER DEFAULT 0 NOT NULL, forum_posts INTEGER DEFAULT 0 NOT NULL, + forum_posts_unapproved INTEGER DEFAULT 0 NOT NULL, + forum_posts_softdeleted INTEGER DEFAULT 0 NOT NULL, forum_topics INTEGER DEFAULT 0 NOT NULL, - forum_topics_real INTEGER DEFAULT 0 NOT NULL, + forum_topics_unapproved INTEGER DEFAULT 0 NOT NULL, + forum_topics_softdeleted INTEGER DEFAULT 0 NOT NULL, forum_last_post_id INTEGER DEFAULT 0 NOT NULL, forum_last_poster_id INTEGER DEFAULT 0 NOT NULL, forum_last_post_subject VARCHAR(255) CHARACTER SET UTF8 DEFAULT '' NOT NULL COLLATE UNICODE, @@ -1125,8 +1128,9 @@ CREATE TABLE phpbb_topics ( topic_time INTEGER DEFAULT 0 NOT NULL, topic_time_limit INTEGER DEFAULT 0 NOT NULL, topic_views INTEGER DEFAULT 0 NOT NULL, - topic_replies INTEGER DEFAULT 0 NOT NULL, - topic_replies_real INTEGER DEFAULT 0 NOT NULL, + topic_posts INTEGER DEFAULT 0 NOT NULL, + topic_posts_unapproved INTEGER DEFAULT 0 NOT NULL, + topic_posts_softdeleted INTEGER DEFAULT 0 NOT NULL, topic_status INTEGER DEFAULT 0 NOT NULL, topic_type INTEGER DEFAULT 0 NOT NULL, topic_first_post_id INTEGER DEFAULT 0 NOT NULL, diff --git a/phpBB/install/schemas/mssql_schema.sql b/phpBB/install/schemas/mssql_schema.sql index 070a504d73..c823533135 100644 --- a/phpBB/install/schemas/mssql_schema.sql +++ b/phpBB/install/schemas/mssql_schema.sql @@ -443,8 +443,11 @@ CREATE TABLE [phpbb_forums] ( [forum_type] [int] DEFAULT (0) NOT NULL , [forum_status] [int] DEFAULT (0) NOT NULL , [forum_posts] [int] DEFAULT (0) NOT NULL , + [forum_posts_unapproved] [int] DEFAULT (0) NOT NULL , + [forum_posts_softdeleted] [int] DEFAULT (0) NOT NULL , [forum_topics] [int] DEFAULT (0) NOT NULL , - [forum_topics_real] [int] DEFAULT (0) NOT NULL , + [forum_topics_unapproved] [int] DEFAULT (0) NOT NULL , + [forum_topics_softdeleted] [int] DEFAULT (0) NOT NULL , [forum_last_post_id] [int] DEFAULT (0) NOT NULL , [forum_last_poster_id] [int] DEFAULT (0) NOT NULL , [forum_last_post_subject] [varchar] (255) DEFAULT ('') NOT NULL , @@ -1360,8 +1363,9 @@ CREATE TABLE [phpbb_topics] ( [topic_time] [int] DEFAULT (0) NOT NULL , [topic_time_limit] [int] DEFAULT (0) NOT NULL , [topic_views] [int] DEFAULT (0) NOT NULL , - [topic_replies] [int] DEFAULT (0) NOT NULL , - [topic_replies_real] [int] DEFAULT (0) NOT NULL , + [topic_posts] [int] DEFAULT (0) NOT NULL , + [topic_posts_unapproved] [int] DEFAULT (0) NOT NULL , + [topic_posts_softdeleted] [int] DEFAULT (0) NOT NULL , [topic_status] [int] DEFAULT (0) NOT NULL , [topic_type] [int] DEFAULT (0) NOT NULL , [topic_first_post_id] [int] DEFAULT (0) NOT NULL , diff --git a/phpBB/install/schemas/mysql_40_schema.sql b/phpBB/install/schemas/mysql_40_schema.sql index 87b71dc852..b4545ed4ac 100644 --- a/phpBB/install/schemas/mysql_40_schema.sql +++ b/phpBB/install/schemas/mysql_40_schema.sql @@ -250,8 +250,11 @@ CREATE TABLE phpbb_forums ( forum_type tinyint(4) DEFAULT '0' NOT NULL, forum_status tinyint(4) DEFAULT '0' NOT NULL, forum_posts mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + forum_posts_unapproved mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + forum_posts_softdeleted mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, forum_topics mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, - forum_topics_real mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + forum_topics_unapproved mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + forum_topics_softdeleted mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, forum_last_post_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, forum_last_poster_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, forum_last_post_subject blob NOT NULL, @@ -787,8 +790,9 @@ CREATE TABLE phpbb_topics ( topic_time int(11) UNSIGNED DEFAULT '0' NOT NULL, topic_time_limit int(11) UNSIGNED DEFAULT '0' NOT NULL, topic_views mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, - topic_replies mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, - topic_replies_real mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + topic_posts mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + topic_posts_unapproved mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + topic_posts_softdeleted mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, topic_status tinyint(3) DEFAULT '0' NOT NULL, topic_type tinyint(3) DEFAULT '0' NOT NULL, topic_first_post_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, diff --git a/phpBB/install/schemas/mysql_41_schema.sql b/phpBB/install/schemas/mysql_41_schema.sql index 1a70091bef..9c53cab44e 100644 --- a/phpBB/install/schemas/mysql_41_schema.sql +++ b/phpBB/install/schemas/mysql_41_schema.sql @@ -250,8 +250,11 @@ CREATE TABLE phpbb_forums ( forum_type tinyint(4) DEFAULT '0' NOT NULL, forum_status tinyint(4) DEFAULT '0' NOT NULL, forum_posts mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + forum_posts_unapproved mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + forum_posts_softdeleted mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, forum_topics mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, - forum_topics_real mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + forum_topics_unapproved mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + forum_topics_softdeleted mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, forum_last_post_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, forum_last_poster_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, forum_last_post_subject varchar(255) DEFAULT '' NOT NULL, @@ -787,8 +790,9 @@ CREATE TABLE phpbb_topics ( topic_time int(11) UNSIGNED DEFAULT '0' NOT NULL, topic_time_limit int(11) UNSIGNED DEFAULT '0' NOT NULL, topic_views mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, - topic_replies mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, - topic_replies_real mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + topic_posts mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + topic_posts_unapproved mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + topic_posts_softdeleted mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, topic_status tinyint(3) DEFAULT '0' NOT NULL, topic_type tinyint(3) DEFAULT '0' NOT NULL, topic_first_post_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, diff --git a/phpBB/install/schemas/oracle_schema.sql b/phpBB/install/schemas/oracle_schema.sql index 1730a42701..3a4525734f 100644 --- a/phpBB/install/schemas/oracle_schema.sql +++ b/phpBB/install/schemas/oracle_schema.sql @@ -510,8 +510,11 @@ CREATE TABLE phpbb_forums ( forum_type number(4) DEFAULT '0' NOT NULL, forum_status number(4) DEFAULT '0' NOT NULL, forum_posts number(8) DEFAULT '0' NOT NULL, + forum_posts_unapproved number(8) DEFAULT '0' NOT NULL, + forum_posts_softdeleted number(8) DEFAULT '0' NOT NULL, forum_topics number(8) DEFAULT '0' NOT NULL, - forum_topics_real number(8) DEFAULT '0' NOT NULL, + forum_topics_unapproved number(8) DEFAULT '0' NOT NULL, + forum_topics_softdeleted number(8) DEFAULT '0' NOT NULL, forum_last_post_id number(8) DEFAULT '0' NOT NULL, forum_last_poster_id number(8) DEFAULT '0' NOT NULL, forum_last_post_subject varchar2(765) DEFAULT '' , @@ -1490,8 +1493,9 @@ CREATE TABLE phpbb_topics ( topic_time number(11) DEFAULT '0' NOT NULL, topic_time_limit number(11) DEFAULT '0' NOT NULL, topic_views number(8) DEFAULT '0' NOT NULL, - topic_replies number(8) DEFAULT '0' NOT NULL, - topic_replies_real number(8) DEFAULT '0' NOT NULL, + topic_posts number(8) DEFAULT '0' NOT NULL, + topic_posts_unapproved number(8) DEFAULT '0' NOT NULL, + topic_posts_softdeleted number(8) DEFAULT '0' NOT NULL, topic_status number(3) DEFAULT '0' NOT NULL, topic_type number(3) DEFAULT '0' NOT NULL, topic_first_post_id number(8) DEFAULT '0' NOT NULL, diff --git a/phpBB/install/schemas/postgres_schema.sql b/phpBB/install/schemas/postgres_schema.sql index ea920ccd5e..a8289940a9 100644 --- a/phpBB/install/schemas/postgres_schema.sql +++ b/phpBB/install/schemas/postgres_schema.sql @@ -386,8 +386,11 @@ CREATE TABLE phpbb_forums ( forum_type INT2 DEFAULT '0' NOT NULL, forum_status INT2 DEFAULT '0' NOT NULL, forum_posts INT4 DEFAULT '0' NOT NULL CHECK (forum_posts >= 0), + forum_posts_unapproved INT4 DEFAULT '0' NOT NULL CHECK (forum_posts_unapproved >= 0), + forum_posts_softdeleted INT4 DEFAULT '0' NOT NULL CHECK (forum_posts_softdeleted >= 0), forum_topics INT4 DEFAULT '0' NOT NULL CHECK (forum_topics >= 0), - forum_topics_real INT4 DEFAULT '0' NOT NULL CHECK (forum_topics_real >= 0), + forum_topics_unapproved INT4 DEFAULT '0' NOT NULL CHECK (forum_topics_unapproved >= 0), + forum_topics_softdeleted INT4 DEFAULT '0' NOT NULL CHECK (forum_topics_softdeleted >= 0), forum_last_post_id INT4 DEFAULT '0' NOT NULL CHECK (forum_last_post_id >= 0), forum_last_poster_id INT4 DEFAULT '0' NOT NULL CHECK (forum_last_poster_id >= 0), forum_last_post_subject varchar(255) DEFAULT '' NOT NULL, @@ -1025,8 +1028,9 @@ CREATE TABLE phpbb_topics ( topic_time INT4 DEFAULT '0' NOT NULL CHECK (topic_time >= 0), topic_time_limit INT4 DEFAULT '0' NOT NULL CHECK (topic_time_limit >= 0), topic_views INT4 DEFAULT '0' NOT NULL CHECK (topic_views >= 0), - topic_replies INT4 DEFAULT '0' NOT NULL CHECK (topic_replies >= 0), - topic_replies_real INT4 DEFAULT '0' NOT NULL CHECK (topic_replies_real >= 0), + topic_posts INT4 DEFAULT '0' NOT NULL CHECK (topic_posts >= 0), + topic_posts_unapproved INT4 DEFAULT '0' NOT NULL CHECK (topic_posts_unapproved >= 0), + topic_posts_softdeleted INT4 DEFAULT '0' NOT NULL CHECK (topic_posts_softdeleted >= 0), topic_status INT2 DEFAULT '0' NOT NULL, topic_type INT2 DEFAULT '0' NOT NULL, topic_first_post_id INT4 DEFAULT '0' NOT NULL CHECK (topic_first_post_id >= 0), diff --git a/phpBB/install/schemas/sqlite_schema.sql b/phpBB/install/schemas/sqlite_schema.sql index 2291285ee7..83d0d032b3 100644 --- a/phpBB/install/schemas/sqlite_schema.sql +++ b/phpBB/install/schemas/sqlite_schema.sql @@ -243,8 +243,11 @@ CREATE TABLE phpbb_forums ( forum_type tinyint(4) NOT NULL DEFAULT '0', forum_status tinyint(4) NOT NULL DEFAULT '0', forum_posts INTEGER UNSIGNED NOT NULL DEFAULT '0', + forum_posts_unapproved INTEGER UNSIGNED NOT NULL DEFAULT '0', + forum_posts_softdeleted INTEGER UNSIGNED NOT NULL DEFAULT '0', forum_topics INTEGER UNSIGNED NOT NULL DEFAULT '0', - forum_topics_real INTEGER UNSIGNED NOT NULL DEFAULT '0', + forum_topics_unapproved INTEGER UNSIGNED NOT NULL DEFAULT '0', + forum_topics_softdeleted INTEGER UNSIGNED NOT NULL DEFAULT '0', forum_last_post_id INTEGER UNSIGNED NOT NULL DEFAULT '0', forum_last_poster_id INTEGER UNSIGNED NOT NULL DEFAULT '0', forum_last_post_subject text(65535) NOT NULL DEFAULT '', @@ -762,8 +765,9 @@ CREATE TABLE phpbb_topics ( topic_time INTEGER UNSIGNED NOT NULL DEFAULT '0', topic_time_limit INTEGER UNSIGNED NOT NULL DEFAULT '0', topic_views INTEGER UNSIGNED NOT NULL DEFAULT '0', - topic_replies INTEGER UNSIGNED NOT NULL DEFAULT '0', - topic_replies_real INTEGER UNSIGNED NOT NULL DEFAULT '0', + topic_posts INTEGER UNSIGNED NOT NULL DEFAULT '0', + topic_posts_unapproved INTEGER UNSIGNED NOT NULL DEFAULT '0', + topic_posts_softdeleted INTEGER UNSIGNED NOT NULL DEFAULT '0', topic_status tinyint(3) NOT NULL DEFAULT '0', topic_type tinyint(3) NOT NULL DEFAULT '0', topic_first_post_id INTEGER UNSIGNED NOT NULL DEFAULT '0',