Skip to content

Commit

Permalink
refs #1633 : implements table schema / setup for trashes
Browse files Browse the repository at this point in the history
 - Installation SQL for trash tables.
 - Table check routine in setup.php
  • Loading branch information
inureyes committed Feb 7, 2014
1 parent 7f86ed6 commit e0e17af
Show file tree
Hide file tree
Showing 5 changed files with 168 additions and 2 deletions.
38 changes: 38 additions & 0 deletions resources/setup/initialize.Cubrid.sql
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,27 @@ CREATE INDEX [##_dbPrefix_##]Comments_blogid_idx ON [##_dbPrefix_##]Comments (bl
CREATE INDEX [##_dbPrefix_##]Comments_entry_idx ON [##_dbPrefix_##]Comments (entry);
CREATE INDEX [##_dbPrefix_##]Comments_parent_idx ON [##_dbPrefix_##]Comments (parent);
CREATE INDEX [##_dbPrefix_##]Comments_isfiltered_idx ON [##_dbPrefix_##]Comments (isfiltered);
CREATE TABLE [##_dbPrefix_##]TrashComments (
blogid integer default 0 NOT NULL,
replier integer default NULL,
id integer NOT NULL,
openid varchar(128) default '' NOT NULL,
entry integer default 0 NOT NULL,
parent integer default NULL,
name varchar(80) default '' NOT NULL,
password varchar(32) default '' NOT NULL,
homepage varchar(80) default '' NOT NULL,
secret integer default 0 NOT NULL,
comment varchar NOT NULL,
ip varchar(15) default '' NOT NULL,
written integer default 0 NOT NULL,
isfiltered integer default 0 NOT NULL,
PRIMARY KEY (blogid, id)
) [##_charset_##];
CREATE INDEX [##_dbPrefix_##]TrashComments_blogid_idx ON [##_dbPrefix_##]TrashComments (blogid);
CREATE INDEX [##_dbPrefix_##]TrashComments_entry_idx ON [##_dbPrefix_##]TrashComments (entry);
CREATE INDEX [##_dbPrefix_##]TrashComments_parent_idx ON [##_dbPrefix_##]TrashComments (parent);
CREATE INDEX [##_dbPrefix_##]TrashComments_isfiltered_idx ON [##_dbPrefix_##]TrashComments (isfiltered);
CREATE TABLE [##_dbPrefix_##]CommentsNotified (
blogid integer default 0 NOT NULL,
replier integer default NULL,
Expand Down Expand Up @@ -380,6 +401,23 @@ CREATE TABLE [##_dbPrefix_##]RemoteResponses (
) [##_charset_##];
CREATE INDEX [##_dbPrefix_##]RemoteResponses_isfiltered_idx ON [##_dbPrefix_##]RemoteResponses (isfiltered);
CREATE INDEX [##_dbPrefix_##]RemoteResponses_blogid_isfiltered_written_idx ON [##_dbPrefix_##]RemoteResponses (blogid, isfiltered, written);
CREATE TABLE [##_dbPrefix_##]TrashRemoteResponses (
id integer NOT NULL,
blogid integer default 0 NOT NULL,
entry integer default 0 NOT NULL,
responsetype varchar(10) default 'trackback' NOT NULL,
url varchar(255) default '' NOT NULL,
writer integer default NULL,
site varchar(255) default '' NOT NULL,
subject varchar(255) default '' NOT NULL,
excerpt varchar(255) default '' NOT NULL,
ip varchar(15) default '' NOT NULL,
written integer default 0 NOT NULL,
isfiltered integer default 0 NOT NULL,
PRIMARY KEY (blogid, id)
) [##_charset_##];
CREATE INDEX [##_dbPrefix_##]TrashRemoteResponses_isfiltered_idx ON [##_dbPrefix_##]TrashRemoteResponses (isfiltered);
CREATE INDEX [##_dbPrefix_##]TrashRemoteResponses_blogid_isfiltered_written_idx ON [##_dbPrefix_##]TrashRemoteResponses (blogid, isfiltered, written);
CREATE TABLE [##_dbPrefix_##]Users (
userid integer default 1 NOT NULL,
loginid varchar(64) default '' NOT NULL,
Expand Down
40 changes: 40 additions & 0 deletions resources/setup/initialize.MySQL.sql
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,29 @@ CREATE TABLE [##_dbPrefix_##]Comments (
KEY parent (parent),
KEY isfiltered (isfiltered)
) [##_charset_##];
CREATE TABLE [##_dbPrefix_##]TrashComments (
blogid int(11) NOT NULL default '0',
replier int(11) default NULL,
id int(11) NOT NULL,
openid varchar(128) NOT NULL default '',
entry int(11) NOT NULL default '0',
parent int(11) default NULL,
name varchar(80) NOT NULL default '',
password varchar(32) NOT NULL default '',
homepage varchar(80) NOT NULL default '',
secret int(1) NOT NULL default '0',
longitude FLOAT(10) NULL,
latitude FLOAT(10) NULL,
comment text NOT NULL,
ip varchar(15) NOT NULL default '',
written int(11) NOT NULL default '0',
isfiltered int(11) NOT NULL default '0',
PRIMARY KEY (blogid, id),
KEY blogid (blogid),
KEY entry (entry),
KEY parent (parent),
KEY isfiltered (isfiltered)
) [##_charset_##];
CREATE TABLE [##_dbPrefix_##]CommentsNotified (
blogid int(11) NOT NULL default '0',
replier int(11) default NULL,
Expand Down Expand Up @@ -382,6 +405,23 @@ CREATE TABLE [##_dbPrefix_##]RemoteResponses (
KEY isfiltered (isfiltered),
KEY blogid (blogid, isfiltered, written)
) [##_charset_##];
CREATE TABLE [##_dbPrefix_##]TrashRemoteResponses (
id int(11) NOT NULL,
blogid int(11) NOT NULL default '0',
entry int(11) NOT NULL default '0',
responsetype enum('trackback','pingback') NOT NULL default 'trackback',
url varchar(255) NOT NULL default '',
writer int(11) default NULL,
site varchar(255) default '',
subject varchar(255) default '',
excerpt varchar(255) default '',
ip varchar(15) NOT NULL default '',
written int(11) NOT NULL default '0',
isfiltered int(11) NOT NULL default '0',
PRIMARY KEY (blogid, id),
KEY isfiltered (isfiltered),
KEY blogid (blogid, isfiltered, written)
) [##_charset_##];
CREATE TABLE [##_dbPrefix_##]Users (
userid int(11) NOT NULL default 1,
loginid varchar(64) NOT NULL default '',
Expand Down
38 changes: 38 additions & 0 deletions resources/setup/initialize.PostgreSQL.sql
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,27 @@ CREATE INDEX [##_dbPrefix_##]Comments_blogid_idx ON [##_dbPrefix_##]Comments (bl
CREATE INDEX [##_dbPrefix_##]Comments_entry_idx ON [##_dbPrefix_##]Comments (entry);
CREATE INDEX [##_dbPrefix_##]Comments_parent_idx ON [##_dbPrefix_##]Comments (parent);
CREATE INDEX [##_dbPrefix_##]Comments_isfiltered_idx ON [##_dbPrefix_##]Comments (isfiltered);
CREATE TABLE [##_dbPrefix_##]TrashComments (
blogid integer NOT NULL default 0,
replier integer default NULL,
id integer NOT NULL,
openid varchar(128) NOT NULL default '',
entry integer NOT NULL default 0,
parent integer default NULL,
name varchar(80) NOT NULL default '',
password varchar(32) NOT NULL default '',
homepage varchar(80) NOT NULL default '',
secret integer NOT NULL default 0,
comment text NOT NULL,
ip varchar(15) NOT NULL default '',
written integer NOT NULL default 0,
isfiltered integer NOT NULL default 0,
PRIMARY KEY (blogid, id)
) [##_charset_##];
CREATE INDEX [##_dbPrefix_##]TrashComments_blogid_idx ON [##_dbPrefix_##]TrashComments (blogid);
CREATE INDEX [##_dbPrefix_##]TrashComments_entry_idx ON [##_dbPrefix_##]TrashComments (entry);
CREATE INDEX [##_dbPrefix_##]TrashComments_parent_idx ON [##_dbPrefix_##]TrashComments (parent);
CREATE INDEX [##_dbPrefix_##]TrashComments_isfiltered_idx ON [##_dbPrefix_##]TrashComments (isfiltered);
CREATE TABLE [##_dbPrefix_##]CommentsNotified (
blogid integer NOT NULL default 0,
replier integer default NULL,
Expand Down Expand Up @@ -380,6 +401,23 @@ CREATE TABLE [##_dbPrefix_##]RemoteResponses (
) [##_charset_##];
CREATE INDEX [##_dbPrefix_##]RemoteResponses_isfiltered_idx ON [##_dbPrefix_##]RemoteResponses (isfiltered);
CREATE INDEX [##_dbPrefix_##]RemoteResponses_blogid_isfiltered_written_idx ON [##_dbPrefix_##]RemoteResponses (blogid, isfiltered, written);
CREATE TABLE [##_dbPrefix_##]TrashRemoteResponses (
id integer NOT NULL,
blogid integer NOT NULL default 0,
entry integer NOT NULL default 0,
responsetype varchar(10) NOT NULL default 'trackback',
url varchar(255) NOT NULL default '',
writer integer default NULL,
site varchar(255) NOT NULL default '',
subject varchar(255) NOT NULL default '',
excerpt varchar(255) NOT NULL default '',
ip varchar(15) NOT NULL default '',
written integer NOT NULL default 0,
isfiltered integer NOT NULL default 0,
PRIMARY KEY (blogid, id)
) [##_charset_##];
CREATE INDEX [##_dbPrefix_##]TrashRemoteResponses_isfiltered_idx ON [##_dbPrefix_##]TrashRemoteResponses (isfiltered);
CREATE INDEX [##_dbPrefix_##]TrashRemoteResponses_blogid_isfiltered_written_idx ON [##_dbPrefix_##]TrashRemoteResponses (blogid, isfiltered, written);
CREATE TABLE [##_dbPrefix_##]Users (
userid integer NOT NULL default 1,
loginid varchar(64) NOT NULL default '',
Expand Down
38 changes: 38 additions & 0 deletions resources/setup/initialize.SQLite3.sql
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,27 @@ CREATE INDEX [##_dbPrefix_##]Comments_blogid_idx ON [##_dbPrefix_##]Comments (bl
CREATE INDEX [##_dbPrefix_##]Comments_entry_idx ON [##_dbPrefix_##]Comments (entry);
CREATE INDEX [##_dbPrefix_##]Comments_parent_idx ON [##_dbPrefix_##]Comments (parent);
CREATE INDEX [##_dbPrefix_##]Comments_isfiltered_idx ON [##_dbPrefix_##]Comments (isfiltered);
CREATE TABLE [##_dbPrefix_##]TrashComments (
blogid integer NOT NULL default 0,
replier integer default NULL,
id integer NOT NULL,
openid varchar(128) NOT NULL default '',
entry integer NOT NULL default 0,
parent integer default NULL,
name varchar(80) NOT NULL default '',
password varchar(32) NOT NULL default '',
homepage varchar(80) NOT NULL default '',
secret integer NOT NULL default 0,
comment text NOT NULL,
ip varchar(15) NOT NULL default '',
written integer NOT NULL default 0,
isfiltered integer NOT NULL default 0,
PRIMARY KEY (blogid, id)
) [##_charset_##];
CREATE INDEX [##_dbPrefix_##]TrashComments_blogid_idx ON [##_dbPrefix_##]TrashComments (blogid);
CREATE INDEX [##_dbPrefix_##]TrashComments_entry_idx ON [##_dbPrefix_##]TrashComments (entry);
CREATE INDEX [##_dbPrefix_##]TrashComments_parent_idx ON [##_dbPrefix_##]TrashComments (parent);
CREATE INDEX [##_dbPrefix_##]TrashComments_isfiltered_idx ON [##_dbPrefix_##]TrashComments (isfiltered);
CREATE TABLE [##_dbPrefix_##]CommentsNotified (
blogid integer NOT NULL default 0,
replier integer default NULL,
Expand Down Expand Up @@ -380,6 +401,23 @@ CREATE TABLE [##_dbPrefix_##]RemoteResponses (
) [##_charset_##];
CREATE INDEX [##_dbPrefix_##]RemoteResponses_isfiltered_idx ON [##_dbPrefix_##]RemoteResponses (isfiltered);
CREATE INDEX [##_dbPrefix_##]RemoteResponses_blogid_isfiltered_written_idx ON [##_dbPrefix_##]RemoteResponses (blogid, isfiltered, written);
CREATE TABLE [##_dbPrefix_##]TrashRemoteResponses (
id integer NOT NULL,
blogid integer NOT NULL default 0,
entry integer NOT NULL default 0,
responsetype varchar(10) NOT NULL default 'trackback',
url varchar(255) NOT NULL default '',
writer integer default NULL,
site varchar(255) NOT NULL default '',
subject varchar(255) NOT NULL default '',
excerpt varchar(255) NOT NULL default '',
ip varchar(15) NOT NULL default '',
written integer NOT NULL default 0,
isfiltered integer NOT NULL default 0,
PRIMARY KEY (blogid, id)
) [##_charset_##];
CREATE INDEX [##_dbPrefix_##]TrashRemoteResponses_isfiltered_idx ON [##_dbPrefix_##]TrashRemoteResponses (isfiltered);
CREATE INDEX [##_dbPrefix_##]TrashRemoteResponses_blogid_isfiltered_written_idx ON [##_dbPrefix_##]TrashRemoteResponses (blogid, isfiltered, written);
CREATE TABLE [##_dbPrefix_##]Users (
userid integer NOT NULL default 1,
loginid varchar(64) NOT NULL default '',
Expand Down
16 changes: 14 additions & 2 deletions setup.php
Original file line number Diff line number Diff line change
Expand Up @@ -1442,11 +1442,21 @@ function fail($msg) {
$entriesMatched = preg_match('/Entries$/', $table);


if ($entriesMatched && checkTables('1.8', $prefix = substr($table, 0, strlen($table) - 7))) {
if ($entriesMatched && checkTables('1.9', $prefix = substr($table, 0, strlen($table) - 7))) {
?>
<tr>
<th><?php echo $prefix;?></th>
<th>1.8 / 1.9</th>
<th>1.9</th>
<td><?php echo implode(', ', getTables('1.9', $prefix));?></td>
<th><input type="radio" name="target" value="1.9_<?php echo $prefix;?>" <?php echo $ckeckedString;?>/></th>
</tr>
<?php
$ckeckedString = '';
} else if ($entriesMatched && checkTables('1.8', $prefix = substr($table, 0, strlen($table) - 7))) {
?>
<tr>
<th><?php echo $prefix;?></th>
<th>1.8</th>
<td><?php echo implode(', ', getTables('1.8', $prefix));?></td>
<th><input type="radio" name="target" value="1.8_<?php echo $prefix;?>" <?php echo $ckeckedString;?>/></th>
</tr>
Expand Down Expand Up @@ -1687,6 +1697,8 @@ function checkTables($version, $prefix) {

function getTables($version, $prefix) {
switch ($version) {
case '1.9':
return array("{$prefix}Attachments", "{$prefix}BlogSettings", "{$prefix}BlogStatistics", "{$prefix}Categories", "{$prefix}Comments", "{$prefix}TrashComments", "{$prefix}CommentsNotified", "{$prefix}CommentsNotifiedQueue", "{$prefix}CommentsNotifiedSiteInfo", "{$prefix}DailyStatistics", "{$prefix}Entries", "{$prefix}EntriesArchive", "{$prefix}FeedGroupRelations", "{$prefix}FeedGroups", "{$prefix}FeedItems", "{$prefix}FeedReads", "{$prefix}Feeds", "{$prefix}FeedSettings", "{$prefix}FeedStarred", "{$prefix}Filters", "{$prefix}Lines", "{$prefix}Links", "{$prefix}LinkCategories", "{$prefix}OpenIDUsers", "{$prefix}Plugins", "{$prefix}RefererLogs", "{$prefix}RefererStatistics", "{$prefix}ReservedWords", "{$prefix}ServiceSettings", "{$prefix}Sessions", "{$prefix}SessionVisits", "{$prefix}SkinSettings", "{$prefix}TagRelations", "{$prefix}Tags", "{$prefix}RemoteResponseLogs", "{$prefix}RemoteResponses", "{$prefix}TrashRemoteResponses","{$prefix}Users", "{$prefix}UserSettings", "{$prefix}Widgets", "{$prefix}XMLRPCPingSettings", "{$prefix}Privileges", "{$prefix}PageCacheLog");
case '1.8':
return array("{$prefix}Attachments", "{$prefix}BlogSettings", "{$prefix}BlogStatistics", "{$prefix}Categories", "{$prefix}Comments", "{$prefix}CommentsNotified", "{$prefix}CommentsNotifiedQueue", "{$prefix}CommentsNotifiedSiteInfo", "{$prefix}DailyStatistics", "{$prefix}Entries", "{$prefix}EntriesArchive", "{$prefix}FeedGroupRelations", "{$prefix}FeedGroups", "{$prefix}FeedItems", "{$prefix}FeedReads", "{$prefix}Feeds", "{$prefix}FeedSettings", "{$prefix}FeedStarred", "{$prefix}Filters", "{$prefix}Lines", "{$prefix}Links", "{$prefix}LinkCategories", "{$prefix}OpenIDUsers", "{$prefix}Plugins", "{$prefix}RefererLogs", "{$prefix}RefererStatistics", "{$prefix}ReservedWords", "{$prefix}ServiceSettings", "{$prefix}Sessions", "{$prefix}SessionVisits", "{$prefix}SkinSettings", "{$prefix}TagRelations", "{$prefix}Tags", "{$prefix}RemoteResponseLogs", "{$prefix}RemoteResponses", "{$prefix}Users", "{$prefix}UserSettings", "{$prefix}Widgets", "{$prefix}XMLRPCPingSettings", "{$prefix}Privileges", "{$prefix}PageCacheLog");
case '1.7':
Expand Down

0 comments on commit e0e17af

Please sign in to comment.