Index: trunk/phase3/maintenance/updaters.inc |
— | — | @@ -27,7 +27,6 @@ |
28 | 28 | array( 'recentchanges', 'rc_patrolled', 'patch-rc-patrol.sql' ), |
29 | 29 | array( 'user', 'user_real_name', 'patch-user-realname.sql' ), |
30 | 30 | array( 'user', 'user_token', 'patch-user_token.sql' ), |
31 | | - array( 'old', 'old_articleid', 'patch-remove-old-title-namespace.sql' ), |
32 | 31 | ); |
33 | 32 | |
34 | 33 | function add_table( $name, $patch ) { |
Index: trunk/phase3/maintenance/tables.sql |
— | — | @@ -50,7 +50,7 @@ |
51 | 51 | cur_touched char(14) binary NOT NULL default '', |
52 | 52 | inverse_timestamp char(14) binary NOT NULL default '', |
53 | 53 | PRIMARY KEY cur_id (cur_id), |
54 | | - INDEX name_title (cur_namespace,cur_title), |
| 54 | + UNIQUE INDEX name_title (cur_namespace,cur_title), |
55 | 55 | |
56 | 56 | -- Is this one necessary? |
57 | 57 | INDEX cur_title (cur_title(20)), |
— | — | @@ -65,7 +65,8 @@ |
66 | 66 | |
67 | 67 | CREATE TABLE old ( |
68 | 68 | old_id int(8) unsigned NOT NULL auto_increment, |
69 | | - old_articleid int(8) unsigned NOT NULL, |
| 69 | + old_namespace tinyint(2) unsigned NOT NULL default '0', |
| 70 | + old_title varchar(255) binary NOT NULL default '', |
70 | 71 | old_text mediumtext NOT NULL default '', |
71 | 72 | old_comment tinyblob NOT NULL default '', |
72 | 73 | old_user int(5) unsigned NOT NULL default '0', |
— | — | @@ -76,9 +77,8 @@ |
77 | 78 | inverse_timestamp char(14) binary NOT NULL default '', |
78 | 79 | |
79 | 80 | PRIMARY KEY old_id (old_id), |
80 | | - INDEX articleid (old_articleid), |
81 | 81 | INDEX old_timestamp (old_timestamp), |
82 | | - INDEX articleid_timestamp (old_articleid,inverse_timestamp), |
| 82 | + INDEX name_title_timestamp (old_namespace,old_title,inverse_timestamp), |
83 | 83 | INDEX user_timestamp (old_user,inverse_timestamp), |
84 | 84 | INDEX usertext_timestamp (old_user_text,inverse_timestamp) |
85 | 85 | ); |
— | — | @@ -328,7 +328,7 @@ |
329 | 329 | -- Key to the page affected. Where a user is the target, |
330 | 330 | -- this will point to the user page. |
331 | 331 | log_namespace tinyint unsigned NOT NULL default 0, |
332 | | - log_title varchar(255) binary NOT NULL default '', |
| 332 | + log_title varchar(255) NOT NULL default '', |
333 | 333 | |
334 | 334 | -- Freeform text. Interpreted as edit history comments. |
335 | 335 | log_comment varchar(255) NOT NULL default '', |
Index: trunk/phase3/includes/SpecialAsksql.php |
— | — | @@ -154,9 +154,10 @@ |
155 | 155 | $r .= "<tr>"; |
156 | 156 | foreach ( $k as $x ) { |
157 | 157 | $o = $y->$x ; |
158 | | - if ( $x == "cur_title" or $x == "rc_title") { |
| 158 | + if ( $x == "cur_title" or $x == "old_title" or $x == "rc_title") { |
159 | 159 | $namespace = 0; |
160 | 160 | if( $x == "cur_title" ) $namespace = $y->cur_namespace; |
| 161 | + if( $x == "old_title" ) $namespace = $y->old_namespace; |
161 | 162 | if( $x == "rc_title" ) $namespace = $y->rc_namespace; |
162 | 163 | if( $namespace ) $o = $wgContLang->getNsText( $namespace ) . ":" . $o; |
163 | 164 | $o = "<a href=\"" . wfLocalUrlE($o) . "\" class='internal'>" . |
Index: trunk/phase3/includes/SpecialUndelete.php |
— | — | @@ -88,7 +88,7 @@ |
89 | 89 | global $wgUser, $wgOut, $wgLang, $wgDeferredUpdateList; |
90 | 90 | global $wgUseSquid, $wgInternalServer, $wgLinkCache; |
91 | 91 | |
92 | | - $fname = "undelete"; |
| 92 | + $fname = "doUndeleteArticle"; |
93 | 93 | |
94 | 94 | $dbw =& wfGetDB( DB_MASTER ); |
95 | 95 | extract( $dbw->tableNames( 'cur', 'archive', 'old' ) ); |
— | — | @@ -134,9 +134,9 @@ |
135 | 135 | # We should merge. |
136 | 136 | } |
137 | 137 | |
138 | | - $sql = "INSERT INTO $old (old_articleid,old_text," . |
| 138 | + $sql = "INSERT INTO $old (old_namespace,old_title,old_text," . |
139 | 139 | "old_comment,old_user,old_user_text,old_timestamp,inverse_timestamp,old_minor_edit," . |
140 | | - "old_flags) SELECT ".$this->title->getArticleID().",ar_text,ar_comment," . |
| 140 | + "old_flags) SELECT ar_namespace,ar_title,ar_text,ar_comment," . |
141 | 141 | "ar_user,ar_user_text,ar_timestamp,99999999999999-ar_timestamp,ar_minor_edit,ar_flags " . |
142 | 142 | "FROM $archive WHERE ar_namespace={$namespace} AND ar_title='{$t}' {$oldones}"; |
143 | 143 | $dbw->query( $sql, $fname ); |
Index: trunk/phase3/includes/DifferenceEngine.php |
— | — | @@ -27,7 +27,8 @@ |
28 | 28 | $this->mNewid = intval($old); |
29 | 29 | $dbr =& wfGetDB( DB_SLAVE ); |
30 | 30 | $this->mOldid = $dbr->selectField( 'old', 'old_id', |
31 | | - "old_articleid = " . $wgTitle->getArticleID() . |
| 31 | + "old_title='" . $wgTitle->getDBkey() . "'" . |
| 32 | + ' AND old_namespace=' . $wgTitle->getNamespace() . |
32 | 33 | " AND old_id<{$this->mNewid} ORDER BY old_id DESC" ); |
33 | 34 | |
34 | 35 | } elseif ( 'next' == $new ) { |
— | — | @@ -38,7 +39,8 @@ |
39 | 40 | $this->mOldid = intval($old); |
40 | 41 | $dbr =& wfGetDB( DB_SLAVE ); |
41 | 42 | $this->mNewid = $dbr->selectField( 'old', 'old_id', |
42 | | - "old_articleid = " . $wgTitle->getArticleID() . |
| 43 | + "old_title='" . $wgTitle->getDBkey() . "'" . |
| 44 | + ' AND old_namespace=' . $wgTitle->getNamespace() . |
43 | 45 | " AND old_id>{$this->mOldid} ORDER BY old_id " ); |
44 | 46 | if ( false === $this->mNewid ) { |
45 | 47 | # if no result, NewId points to the newest old revision. The only newer |
— | — | @@ -271,7 +273,7 @@ |
272 | 274 | $this->mNewUser = $s->cur_user_text; |
273 | 275 | $this->mNewComment = $s->cur_comment; |
274 | 276 | } else { |
275 | | - $s = $dbr->getArray( 'old', array( 'old_articleid', 'old_timestamp', 'old_text', |
| 277 | + $s = $dbr->getArray( 'old', array( 'old_namespace','old_title','old_timestamp', 'old_text', |
276 | 278 | 'old_flags','old_user_text','old_comment' ), array( 'old_id' => $this->mNewid ), $fname ); |
277 | 279 | |
278 | 280 | if ( $s === false ) { |
— | — | @@ -282,7 +284,7 @@ |
283 | 285 | $this->mNewtext = Article::getRevisionText( $s ); |
284 | 286 | |
285 | 287 | $t = $wgLang->timeanddate( $s->old_timestamp, true ); |
286 | | - $this->mNewPage = Title::newFromID( $s->old_articleid ); |
| 288 | + $this->mNewPage = Title::MakeTitle( $s->old_namespace, $s->old_title ); |
287 | 289 | $newLink = $wgTitle->getLocalUrl ('oldid=' . $this->mNewid); |
288 | 290 | $this->mPagetitle = wfMsg( 'revisionasof', $t ); |
289 | 291 | $this->mNewtitle = "<a href='$newLink'>{$this->mPagetitle}</a>"; |
— | — | @@ -291,10 +293,11 @@ |
292 | 294 | } |
293 | 295 | if ( 0 == $this->mOldid ) { |
294 | 296 | $s = $dbr->getArray( 'old', |
295 | | - array( 'old_timestamp','old_text', 'old_flags','old_user_text','old_comment' ), |
| 297 | + array( 'old_namespace','old_title','old_timestamp','old_text', 'old_flags','old_user_text','old_comment' ), |
296 | 298 | array( /* WHERE */ |
297 | | - 'old_articleid' => $this->mNewPage->getArticleID(), |
298 | | - ), $fname, array( 'ORDER BY' => 'inverse_timestamp', 'USE INDEX' => 'articleid_timestamp' ) |
| 299 | + 'old_namespace' => $this->mNewPage->getNamespace(), |
| 300 | + 'old_title' => $this->mNewPage->getDBkey() |
| 301 | + ), $fname, array( 'ORDER BY' => 'inverse_timestamp', 'USE INDEX' => 'name_title_timestamp' ) |
299 | 302 | ); |
300 | 303 | if ( $s === false ) { |
301 | 304 | wfDebug( 'Unable to load ' . $this->mNewPage->getPrefixedDBkey . " from old\n" ); |
— | — | @@ -302,7 +305,7 @@ |
303 | 306 | } |
304 | 307 | } else { |
305 | 308 | $s = $dbr->getArray( 'old', |
306 | | - array( 'old_timestamp','old_text','old_flags','old_user_text','old_comment'), |
| 309 | + array( 'old_namespace','old_title','old_timestamp','old_text','old_flags','old_user_text','old_comment'), |
307 | 310 | array( 'old_id' => $this->mOldid ), |
308 | 311 | $fname |
309 | 312 | ); |
— | — | @@ -311,7 +314,7 @@ |
312 | 315 | return false; |
313 | 316 | } |
314 | 317 | } |
315 | | - $this->mOldPage = Title::newFromID( $wgTitle->getArticleID() ); |
| 318 | + $this->mOldPage = Title::MakeTitle( $s->old_namespace, $s->old_title ); |
316 | 319 | $this->mOldtext = Article::getRevisionText( $s ); |
317 | 320 | |
318 | 321 | $t = $wgLang->timeanddate( $s->old_timestamp, true ); |
Index: trunk/phase3/includes/Title.php |
— | — | @@ -49,11 +49,10 @@ |
50 | 50 | $this->mInterwiki = $this->mUrlform = |
51 | 51 | $this->mTextform = $this->mDbkeyform = ''; |
52 | 52 | $this->mArticleID = -1; |
53 | | - $this->mID = -1; |
54 | 53 | $this->mNamespace = 0; |
55 | 54 | $this->mRestrictionsLoaded = false; |
56 | 55 | $this->mRestrictions = array(); |
57 | | - $this->mDefaultNamespace = 0; |
| 56 | + $this->mDefaultNamespace = 0; |
58 | 57 | } |
59 | 58 | |
60 | 59 | # From a prefixed DB key |
— | — | @@ -969,8 +968,8 @@ |
970 | 969 | $fname = 'Title::moveOverExistingRedirect'; |
971 | 970 | $comment = wfMsg( '1movedto2', $this->getPrefixedText(), $nt->getPrefixedText() ); |
972 | 971 | |
973 | | - $now = wfTimestampNow(); |
974 | | - $won = wfInvertTimestamp( $now ); |
| 972 | + $now = wfTimestampNow(); |
| 973 | + $won = wfInvertTimestamp( $now ); |
975 | 974 | $newid = $nt->getArticleID(); |
976 | 975 | $oldid = $this->getArticleID(); |
977 | 976 | $dbw =& wfGetDB( DB_MASTER ); |
— | — | @@ -1015,6 +1014,21 @@ |
1016 | 1015 | |
1017 | 1016 | $wgLinkCache->clearLink( $this->getPrefixedDBkey() ); |
1018 | 1017 | |
| 1018 | + # Fix the redundant names for the past revisions of the target page. |
| 1019 | + # The redirect should have no old revisions. |
| 1020 | + $dbw->updateArray( |
| 1021 | + /* table */ 'old', |
| 1022 | + /* SET */ array( |
| 1023 | + 'old_namespace' => $nt->getNamespace(), |
| 1024 | + 'old_title' => $nt->getDBkey(), |
| 1025 | + ), |
| 1026 | + /* WHERE */ array( |
| 1027 | + 'old_namespace' => $this->getNamespace(), |
| 1028 | + 'old_title' => $this->getDBkey(), |
| 1029 | + ), |
| 1030 | + $fname |
| 1031 | + ); |
| 1032 | + |
1019 | 1033 | RecentChange::notifyMoveOverRedirect( $now, $this, $nt, $wgUser, $comment ); |
1020 | 1034 | |
1021 | 1035 | # Swap links |
— | — | @@ -1122,6 +1136,19 @@ |
1123 | 1137 | $newid = $dbw->insertId(); |
1124 | 1138 | $wgLinkCache->clearLink( $this->getPrefixedDBkey() ); |
1125 | 1139 | |
| 1140 | + # Rename old entries |
| 1141 | + $dbw->updateArray( |
| 1142 | + /* table */ 'old', |
| 1143 | + /* SET */ array( |
| 1144 | + 'old_namespace' => $nt->getNamespace(), |
| 1145 | + 'old_title' => $nt->getDBkey() |
| 1146 | + ), |
| 1147 | + /* WHERE */ array( |
| 1148 | + 'old_namespace' => $this->getNamespace(), |
| 1149 | + 'old_title' => $this->getDBkey() |
| 1150 | + ), $fname |
| 1151 | + ); |
| 1152 | + |
1126 | 1153 | # Record in RC |
1127 | 1154 | RecentChange::notifyMoveToNew( $now, $this, $nt, $wgUser, $comment ); |
1128 | 1155 | |
— | — | @@ -1181,7 +1208,8 @@ |
1182 | 1209 | # Does the article have a history? |
1183 | 1210 | $row = $dbw->getArray( 'old', array( 'old_id' ), |
1184 | 1211 | array( |
1185 | | - 'old_articleid' => $nt->getArticleID() |
| 1212 | + 'old_namespace' => $nt->getNamespace(), |
| 1213 | + 'old_title' => $nt->getDBkey() |
1186 | 1214 | ), $fname, 'FOR UPDATE' |
1187 | 1215 | ); |
1188 | 1216 | |
— | — | @@ -1297,8 +1325,7 @@ |
1298 | 1326 | } |
1299 | 1327 | |
1300 | 1328 | function oldCond() { |
1301 | | - #return array( 'old_namespace' => $this->mNamespace, 'old_title' => $this->mDbkeyform ); |
1302 | | - return array( 'old_articleid' => $this->getArticleID() ); |
| 1329 | + return array( 'old_namespace' => $this->mNamespace, 'old_title' => $this->mDbkeyform ); |
1303 | 1330 | } |
1304 | 1331 | } |
1305 | 1332 | ?> |
Index: trunk/phase3/includes/Article.php |
— | — | @@ -382,7 +382,7 @@ |
383 | 383 | function &getOldContentFields() { |
384 | 384 | global $wgArticleOldContentFields; |
385 | 385 | if ( !$wgArticleOldContentFields ) { |
386 | | - $wgArticleOldContentFields = array( 'old_articleid','old_text','old_timestamp', |
| 386 | + $wgArticleOldContentFields = array( 'old_namespace','old_title','old_text','old_timestamp', |
387 | 387 | 'old_user','old_user_text','old_comment','old_flags' ); |
388 | 388 | } |
389 | 389 | return $wgArticleOldContentFields; |
— | — | @@ -475,8 +475,9 @@ |
476 | 476 | return; |
477 | 477 | } |
478 | 478 | |
479 | | - if( $this->mTitle->getArticleID() != $s->old_articleid ) { |
480 | | - $oldTitle = Title::newFromID( $s->old_articleid ); |
| 479 | + if( $this->mTitle->getNamespace() != $s->old_namespace || |
| 480 | + $this->mTitle->getDBkey() != $s->old_title ) { |
| 481 | + $oldTitle = Title::makeTitle( $s->old_namesapce, $s->old_title ); |
481 | 482 | $this->mTitle = $oldTitle; |
482 | 483 | $wgTitle = $oldTitle; |
483 | 484 | } |
— | — | @@ -707,13 +708,14 @@ |
708 | 709 | $dbr =& $this->getDB(); |
709 | 710 | $oldTable = $dbr->tableName( 'old' ); |
710 | 711 | $userTable = $dbr->tableName( 'user' ); |
711 | | - $artid = $title->getArticleID(); |
| 712 | + $encDBkey = $dbr->addQuotes( $title->getDBkey() ); |
712 | 713 | $ns = $title->getNamespace(); |
713 | 714 | $user = $this->getUser(); |
714 | 715 | |
715 | 716 | $sql = "SELECT old_user, old_user_text, user_real_name, MAX(old_timestamp) as timestamp |
716 | 717 | FROM $oldTable LEFT JOIN $userTable ON old_user = user_id |
717 | | - WHERE old_articleid = $artid |
| 718 | + WHERE old_namespace = $user |
| 719 | + AND old_title = $encDBkey |
718 | 720 | AND old_user != $user |
719 | 721 | GROUP BY old_user, old_user_text, user_real_name |
720 | 722 | ORDER BY timestamp DESC"; |
— | — | @@ -949,10 +951,9 @@ |
950 | 952 | $dbw =& wfGetDB( DB_MASTER ); |
951 | 953 | $ns = $this->mTitle->getNamespace(); |
952 | 954 | $title = $this->mTitle->getDBkey(); |
953 | | - $aid = $this->mTitle->getArticleID(); |
954 | 955 | $obj = $dbw->getArray( 'old', |
955 | 956 | array( 'old_text','old_flags'), |
956 | | - array( 'old_articleid' => $aid, |
| 957 | + array( 'old_namespace' => $ns, 'old_title' => $title, |
957 | 958 | 'old_timestamp' => $dbw->timestamp($edittime)), |
958 | 959 | $fname ); |
959 | 960 | $oldtext = Article::getRevisionText( $obj ); |
— | — | @@ -1111,7 +1112,8 @@ |
1112 | 1113 | $dbw->insertArray( 'old', |
1113 | 1114 | array( |
1114 | 1115 | 'old_id' => $dbw->nextSequenceValue( 'old_old_id_seq' ), |
1115 | | - 'old_articleid' => $this->mTitle->getArticleID(), |
| 1116 | + 'old_namespace' => $this->mTitle->getNamespace(), |
| 1117 | + 'old_title' => $this->mTitle->getDBkey(), |
1116 | 1118 | 'old_text' => $oldtext, |
1117 | 1119 | 'old_comment' => $this->getComment(), |
1118 | 1120 | 'old_user' => $this->getUser(), |
— | — | @@ -1468,11 +1470,12 @@ |
1469 | 1471 | $dbr =& $this->getDB(); |
1470 | 1472 | $ns = $this->mTitle->getNamespace(); |
1471 | 1473 | $title = $this->mTitle->getDBkey(); |
1472 | | - $artid = $this->mTitle->getArticleID(); |
1473 | 1474 | $old = $dbr->getArray( 'old', |
1474 | 1475 | array( 'old_text', 'old_flags' ), |
1475 | | - array( 'old_articleid' => $artid ), |
1476 | | - $fname, $this->getSelectOptions( array( 'ORDER BY' => 'inverse_timestamp' ) ) |
| 1476 | + array( |
| 1477 | + 'old_namespace' => $ns, |
| 1478 | + 'old_title' => $title, |
| 1479 | + ), $fname, $this->getSelectOptions( array( 'ORDER BY' => 'inverse_timestamp' ) ) |
1477 | 1480 | ); |
1478 | 1481 | |
1479 | 1482 | if( $old !== false && !$confirm ) { |
— | — | @@ -1668,7 +1671,6 @@ |
1669 | 1672 | $recentchangesTable = $dbw->tableName( 'recentchanges' ); |
1670 | 1673 | $linksTable = $dbw->tableName( 'links' ); |
1671 | 1674 | $brokenlinksTable = $dbw->tableName( 'brokenlinks' ); |
1672 | | - $artid = $this->mTitle->getArticleID(); |
1673 | 1675 | |
1674 | 1676 | $dbw->insertSelect( 'archive', 'cur', |
1675 | 1677 | array( |
— | — | @@ -1687,10 +1689,10 @@ |
1688 | 1690 | ), $fname |
1689 | 1691 | ); |
1690 | 1692 | |
1691 | | - $dbw->insertSelect( 'archive', 'cur,old', |
| 1693 | + $dbw->insertSelect( 'archive', 'old', |
1692 | 1694 | array( |
1693 | | - 'ar_namespace' => 'cur_namespace', |
1694 | | - 'ar_title' => 'cur_title', |
| 1695 | + 'ar_namespace' => 'old_namespace', |
| 1696 | + 'ar_title' => 'old_title', |
1695 | 1697 | 'ar_text' => 'old_text', |
1696 | 1698 | 'ar_comment' => 'old_comment', |
1697 | 1699 | 'ar_user' => 'old_user', |
— | — | @@ -1699,14 +1701,15 @@ |
1700 | 1702 | 'ar_minor_edit' => 'old_minor_edit', |
1701 | 1703 | 'ar_flags' => 'old_flags' |
1702 | 1704 | ), array( |
1703 | | - 'old_articleid' => $artid |
| 1705 | + 'old_namespace' => $ns, |
| 1706 | + 'old_title' => $t, |
1704 | 1707 | ), $fname |
1705 | 1708 | ); |
1706 | 1709 | |
1707 | 1710 | # Now that it's safely backed up, delete it |
1708 | 1711 | |
1709 | 1712 | $dbw->delete( 'cur', array( 'cur_namespace' => $ns, 'cur_title' => $t ), $fname ); |
1710 | | - $dbw->delete( 'old', array( 'old_articleid' => $artid ), $fname ); |
| 1713 | + $dbw->delete( 'old', array( 'old_namespace' => $ns, 'old_title' => $t ), $fname ); |
1711 | 1714 | $dbw->delete( 'recentchanges', array( 'rc_namespace' => $ns, 'rc_title' => $t ), $fname ); |
1712 | 1715 | |
1713 | 1716 | # Finally, clean up the link tables |
— | — | @@ -1798,9 +1801,10 @@ |
1799 | 1802 | $s = $dbw->getArray( 'old', |
1800 | 1803 | array( 'old_text','old_user','old_user_text','old_timestamp','old_flags' ), |
1801 | 1804 | array( |
1802 | | - 'old_articleid' => $pid, |
| 1805 | + 'old_namespace' => $n, |
| 1806 | + 'old_title' => $tt, |
1803 | 1807 | "old_user <> {$uid} OR old_user_text <> '{$ut}'" |
1804 | | - ), $fname, array( 'FOR UPDATE', 'USE INDEX' => 'articleid_timestamp' ) |
| 1808 | + ), $fname, array( 'FOR UPDATE', 'USE INDEX' => 'name_title_timestamp' ) |
1805 | 1809 | ); |
1806 | 1810 | if( $s === false ) { |
1807 | 1811 | # Something wrong |
— | — | @@ -2013,7 +2017,8 @@ |
2014 | 2018 | # Save to history |
2015 | 2019 | $dbw->insertSelect( 'old', 'cur', |
2016 | 2020 | array( |
2017 | | - 'old_articleid' => 'cur_id', |
| 2021 | + 'old_namespace' => 'cur_namespace', |
| 2022 | + 'old_title' => 'cur_title', |
2018 | 2023 | 'old_text' => 'cur_text', |
2019 | 2024 | 'old_comment' => 'cur_comment', |
2020 | 2025 | 'old_user' => 'cur_user', |
— | — | @@ -2167,7 +2172,7 @@ |
2168 | 2173 | |
2169 | 2174 | $basenamespace = $wgTitle->getNamespace() & (~1); |
2170 | 2175 | $cur_clause = array( 'cur_title' => $wgTitle->getDBkey(), 'cur_namespace' => $basenamespace ); |
2171 | | - $old_clause = array( 'old_articleid' => $wgTitle->getArticleID() ); |
| 2176 | + $old_clause = array( 'old_title' => $wgTitle->getDBkey(), 'old_namespace' => $basenamespace ); |
2172 | 2177 | $wl_clause = array( 'wl_title' => $wgTitle->getDBkey(), 'wl_namespace' => $basenamespace ); |
2173 | 2178 | $fullTitle = $wgTitle->makeName($basenamespace, $wgTitle->getDBKey()); |
2174 | 2179 | $wgOut->setPagetitle( $fullTitle ); |
— | — | @@ -2200,15 +2205,13 @@ |
2201 | 2206 | |
2202 | 2207 | # now for the Talk page ... |
2203 | 2208 | $cur_clause = array( 'cur_title' => $wgTitle->getDBkey(), 'cur_namespace' => $basenamespace+1 ); |
| 2209 | + $old_clause = array( 'old_title' => $wgTitle->getDBkey(), 'old_namespace' => $basenamespace+1 ); |
2204 | 2210 | |
2205 | 2211 | # does it exist? |
2206 | 2212 | $exists = $dbr->selectField( 'cur', 'COUNT(*)', $cur_clause, $fname, $this->getSelectOptions() ); |
2207 | 2213 | |
2208 | 2214 | # number of edits |
2209 | 2215 | if ($exists > 0) { |
2210 | | - $oldartid = $dbr->selectField( 'cur', 'cur_id', |
2211 | | - $cur_clause, $fname, $this->getSelectOptions()); |
2212 | | - $old_clause = array( 'old_articleid' => $oldartid ); |
2213 | 2216 | $old = $dbr->selectField( 'old', 'COUNT(*)', $old_clause, $fname, $this->getSelectOptions() ); |
2214 | 2217 | $wgOut->addHTML( '<li>' . wfMsg("numtalkedits", $old + 1) . '</li>'); |
2215 | 2218 | } |
Index: trunk/phase3/includes/PageHistory.php |
— | — | @@ -61,13 +61,14 @@ |
62 | 62 | $title = $this->mTitle->getText(); |
63 | 63 | |
64 | 64 | $db =& wfGetDB( DB_SLAVE ); |
65 | | - $use_index = $db->useIndexClause( 'articleid_timestamp' ); |
| 65 | + $use_index = $db->useIndexClause( 'name_title_timestamp' ); |
66 | 66 | $oldtable = $db->tableName( 'old' ); |
67 | 67 | |
68 | 68 | $sql = "SELECT old_id,old_user," . |
69 | 69 | "old_comment,old_user_text,old_timestamp,old_minor_edit ". |
70 | 70 | "FROM $oldtable $use_index " . |
71 | | - "WHERE old_articleid='" . $db->strencode( $this->mTitle->getArticleID() ) . "' " . |
| 71 | + "WHERE old_namespace={$namespace} AND " . |
| 72 | + "old_title='" . $db->strencode( $this->mTitle->getDBkey() ) . "' " . |
72 | 73 | "ORDER BY inverse_timestamp".$db->limitResult($limitplus,$rawoffset); |
73 | 74 | $res = $db->query( $sql, $fname ); |
74 | 75 | |
Index: trunk/phase3/includes/SpecialContributions.php |
— | — | @@ -86,7 +86,7 @@ |
87 | 87 | "ORDER BY inverse_timestamp LIMIT {$querylimit}"; |
88 | 88 | $res1 = $dbr->query( $sql, $fname ); |
89 | 89 | |
90 | | - $sql = "SELECT old_articleid,old_timestamp,old_comment,old_minor_edit,old_user_text,old_id FROM $old " . |
| 90 | + $sql = "SELECT old_namespace,old_title,old_timestamp,old_comment,old_minor_edit,old_user_text,old_id FROM $old " . |
91 | 91 | "WHERE old_user_text='" . $dbr->strencode( $nt->getText() ) . "' {$omq} " . |
92 | 92 | "ORDER BY inverse_timestamp LIMIT {$querylimit}"; |
93 | 93 | $res2 = $dbr->query( $sql, $fname ); |
— | — | @@ -95,7 +95,7 @@ |
96 | 96 | "WHERE cur_user {$userCond} {$cmq} ORDER BY inverse_timestamp LIMIT {$querylimit}"; |
97 | 97 | $res1 = $dbr->query( $sql, $fname ); |
98 | 98 | |
99 | | - $sql = "SELECT old_articleid,old_timestamp,old_comment,old_minor_edit,old_user_text,old_id FROM $old " . |
| 99 | + $sql = "SELECT old_namespace,old_title,old_timestamp,old_comment,old_minor_edit,old_user_text,old_id FROM $old " . |
100 | 100 | "WHERE old_user {$userCond} {$omq} ORDER BY inverse_timestamp LIMIT {$querylimit}"; |
101 | 101 | $res2 = $dbr->query( $sql, $fname ); |
102 | 102 | } |
— | — | @@ -141,9 +141,8 @@ |
142 | 142 | $oldid = false; |
143 | 143 | --$nCur; |
144 | 144 | } else { |
145 | | - $tt = Title::newFromID($obj2->old_articleid); |
146 | | - $ns = $tt->getNamespace(); |
147 | | - $t = $tt->getDBkey(); |
| 145 | + $ns = $obj2->old_namespace; |
| 146 | + $t = $obj2->old_title; |
148 | 147 | $ts = $obj2->old_timestamp; |
149 | 148 | $comment =$obj2->old_comment; |
150 | 149 | $me = $obj2->old_minor_edit; |
Index: trunk/phase3/includes/EditPage.php |
— | — | @@ -621,7 +621,7 @@ |
622 | 622 | $title = $this->mTitle->getDBkey(); |
623 | 623 | $obj = $dbw->getArray( 'old', |
624 | 624 | array( 'old_text','old_flags'), |
625 | | - array( 'old_articleid' => $this->mTitle->getArticleID(), |
| 625 | + array( 'old_namespace' => $ns, 'old_title' => $title, |
626 | 626 | 'old_timestamp' => $dbw->timestamp($oldDate)), |
627 | 627 | $fname ); |
628 | 628 | $oldText = Article::getRevisionText( $obj ); |