r25267 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r25266‎ | r25267 | r25268 >
Date:02:33, 29 August 2007
Author:simetrical
Status:reverted
Tags:
Comment:
* Add an index to (rev_page,rev_user,rev_timestamp) for use in "All edits by a user to this page". Also potentially useful for "edits to a page grouped by user". (Would "edits by a user grouped by page" be more useful instead?) See bug 10788. Code to implement that feature will follow at some point when the index has actually been applied to Wikimedia servers, probably shortly after I get annoyed at its nonexistence again when looking for an old edit of mine.
* Bowlderism
Modified paths:
  • /trunk/phase3/includes/Article.php (modified) (history)
  • /trunk/phase3/maintenance/archives/patch-revision-user-page-index.sql (added) (history)
  • /trunk/phase3/maintenance/tables.sql (modified) (history)
  • /trunk/phase3/maintenance/updaters.inc (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/Article.php
@@ -2461,8 +2461,8 @@
24622462 *
24632463 * @param Revision $rev
24642464 *
2465 - * @todo This is a shitty interface function. Kill it and replace the
2466 - * other shitty functions like editUpdates and such so it's not needed
 2465+ * @todo This is a lousy interface function. Kill it and replace the
 2466+ * other cruddy functions like editUpdates and such so it's not needed
24672467 * anymore.
24682468 */
24692469 function createUpdates( $rev ) {
Index: trunk/phase3/maintenance/updaters.inc
@@ -1032,6 +1032,8 @@
10331033
10341034 do_oldimage_user_index(); flush ();
10351035
 1036+ do_revision_page_user_index(); flush ();
 1037+
10361038 echo "Deleting old default messages (this may take a long time!)..."; flush();
10371039 deleteDefaultMessages();
10381040 echo "Done\n"; flush();
@@ -1130,6 +1132,17 @@
11311133
11321134 }
11331135
 1136+function do_revision_page_user_index() {
 1137+ global $wgDatabase;
 1138+ if( $wgDatabase->indexExists( 'revision', 'page_user_timestamp' ) ) {
 1139+ echo "...page,user,timestamp key on revision already exists.\n";
 1140+ } else {
 1141+ echo "Adding page,user,timestamp key on revision table... ";
 1142+ dbsource( archive("patch-revision-user-page-index.sql"), $wgDatabase );
 1143+ echo "ok\n";
 1144+ }
 1145+}
 1146+
11341147 function
11351148 pg_describe_table($table)
11361149 {
@@ -1529,4 +1542,4 @@
15301543 }
15311544
15321545 return;
1533 -}
\ No newline at end of file
 1546+}
Index: trunk/phase3/maintenance/archives/patch-revision-user-page-index.sql
@@ -0,0 +1,5 @@
 2+-- New index on revision table to allow searches for all edits by a given user
 3+-- to a given page. Added 2007-08-28
 4+
 5+ALTER TABLE /*$wgDBprefix*/revision
 6+ ADD INDEX page_user_timestamp (rev_page,rev_user,rev_timestamp);
Property changes on: trunk/phase3/maintenance/archives/patch-revision-user-page-index.sql
___________________________________________________________________
Added: svn:eol-style
17 + native
Index: trunk/phase3/maintenance/tables.sql
@@ -282,7 +282,8 @@
283283 INDEX rev_timestamp (rev_timestamp),
284284 INDEX page_timestamp (rev_page,rev_timestamp),
285285 INDEX user_timestamp (rev_user,rev_timestamp),
286 - INDEX usertext_timestamp (rev_user_text,rev_timestamp)
 286+ INDEX usertext_timestamp (rev_user_text,rev_timestamp),
 287+ INDEX page_user_timestamp (rev_page,rev_user,rev_timestamp)
287288
288289 ) /*$wgDBTableOptions*/ MAX_ROWS=10000000 AVG_ROW_LENGTH=1024;
289290 -- In case tables are created as MyISAM, use row hints for MySQL <5.0 to avoid 4GB limit

Follow-up revisions

RevisionCommit summaryAuthorDate
r25290Revert schema change in r25267 -- no more schema changes right before release...brion15:30, 29 August 2007
r25303Merged revisions 25215-25302 via svnmerge from...david07:10, 30 August 2007
r113109Pull patch-revision-user-page-index.sql from r25267reedy00:05, 6 March 2012
r113110Followup r113109, forward port the rest of r25267 for Bug 10788 - Filter page...reedy00:09, 6 March 2012

Status & tagging log