Index: trunk/phase3/maintenance/archives/patch-rd_fragment.sql |
— | — | @@ -0,0 +1,4 @@ |
| 2 | +-- Add fragment (section link) column to redirect table |
| 3 | + |
| 4 | +ALTER TABLE /*$wgDBprefix*/redirect |
| 5 | + ADD rd_fragment varchar(255) binary DEFAULT NULL; |
\ No newline at end of file |
Property changes on: trunk/phase3/maintenance/archives/patch-rd_fragment.sql |
___________________________________________________________________ |
Added: svn:eol-style |
1 | 6 | + native |
Index: trunk/phase3/maintenance/archives/patch-rd_interwiki.sql |
— | — | @@ -0,0 +1,4 @@ |
| 2 | +-- Add interwiki column to redirect table |
| 3 | + |
| 4 | +ALTER TABLE /*$wgDBprefix*/redirect |
| 5 | + ADD rd_interwiki varchar(32) default NULL; |
\ No newline at end of file |
Property changes on: trunk/phase3/maintenance/archives/patch-rd_interwiki.sql |
___________________________________________________________________ |
Added: svn:eol-style |
1 | 6 | + native |
Index: trunk/phase3/maintenance/updaters.inc |
— | — | @@ -143,6 +143,10 @@ |
144 | 144 | array( 'maybe_do_profiling_memory_update' ), |
145 | 145 | array( 'do_filearchive_indices_update' ), |
146 | 146 | array( 'update_password_format' ), |
| 147 | + |
| 148 | + // 1.14 |
| 149 | + array( 'add_field', 'redirect', 'rd_interwiki', 'patch-rd_interwiki.sql' ), |
| 150 | + array( 'add_field', 'redirect', 'rd_fragment', 'patch-rd_fragment.sql' ), |
147 | 151 | ); |
148 | 152 | |
149 | 153 | |
— | — | @@ -1716,3 +1720,4 @@ |
1717 | 1721 | return; |
1718 | 1722 | } |
1719 | 1723 | |
| 1724 | + |
Index: trunk/phase3/maintenance/tables.sql |
— | — | @@ -1157,6 +1157,8 @@ |
1158 | 1158 | -- goes by. |
1159 | 1159 | rd_namespace int NOT NULL default '0', |
1160 | 1160 | rd_title varchar(255) binary NOT NULL default '', |
| 1161 | + rd_interwiki varchar(32) default NULL, |
| 1162 | + rd_fragment varchar(255) binary DEFAULT NULL, |
1161 | 1163 | |
1162 | 1164 | PRIMARY KEY rd_from (rd_from), |
1163 | 1165 | KEY rd_ns_title (rd_namespace,rd_title,rd_from) |
Index: trunk/phase3/includes/Article.php |
— | — | @@ -103,7 +103,9 @@ |
104 | 104 | $dbw->replace('redirect', array('rd_from'), array( |
105 | 105 | 'rd_from' => $this->getID(), |
106 | 106 | 'rd_namespace' => $retval->getNamespace(), |
107 | | - 'rd_title' => $retval->getDBKey() |
| 107 | + 'rd_title' => $retval->getDBKey(), |
| 108 | + 'rd_interwiki' => $retval->getInterwiki(), |
| 109 | + 'rd_fragment' => $retval->getFragment(), |
108 | 110 | ), __METHOD__); |
109 | 111 | return $retval; |
110 | 112 | } |
— | — | @@ -1182,6 +1184,8 @@ |
1183 | 1185 | 'rd_namespace' => $redirectTitle->getNamespace(), |
1184 | 1186 | 'rd_title' => $redirectTitle->getDBkey(), |
1185 | 1187 | 'rd_from' => $this->getId(), |
| 1188 | + 'rd_interwiki' => $redirectTitle->getInterwiki(), |
| 1189 | + 'rd_fragment' => $redirectTitle->getFragment(), |
1186 | 1190 | ); |
1187 | 1191 | |
1188 | 1192 | $dbw->replace( 'redirect', array( 'rd_from' ), $set, __METHOD__ ); |
Index: trunk/phase3/includes/EditPage.php |
— | — | @@ -41,6 +41,7 @@ |
42 | 42 | const AS_SPAM_ERROR = 232; |
43 | 43 | const AS_IMAGE_REDIRECT_ANON = 233; |
44 | 44 | const AS_IMAGE_REDIRECT_LOGGED = 234; |
| 45 | + const AS_DOUBLE_REDIRECT = 235; |
45 | 46 | |
46 | 47 | var $mArticle; |
47 | 48 | var $mTitle; |
— | — | @@ -58,6 +59,7 @@ |
59 | 60 | var $kblength = false; |
60 | 61 | var $missingComment = false; |
61 | 62 | var $missingSummary = false; |
| 63 | + var $doubleRedirect = false; |
62 | 64 | var $allowBlankSummary = false; |
63 | 65 | var $autoSumm = ''; |
64 | 66 | var $hookError = ''; |
— | — | @@ -927,6 +929,11 @@ |
928 | 930 | return self::AS_HOOK_ERROR; |
929 | 931 | } |
930 | 932 | |
| 933 | + # Are we creating a double redirect? |
| 934 | + if ( $redirectTitle = Title::newFromRedirect( $this->textbox1 ) && $redirectTitle->isRedirect() ) { |
| 935 | + $this->doubleRedirect = $redirectTitle; |
| 936 | + } |
| 937 | + |
931 | 938 | # Handle the user preference to force summaries here, but not for null edits |
932 | 939 | if( $this->section != 'new' && !$this->allowBlankSummary && $wgUser->getOption( 'forceeditsummary') && |
933 | 940 | 0 != strcmp($oldtext, $text) && |
— | — | @@ -1087,6 +1094,11 @@ |
1088 | 1095 | $wgOut->wrapWikiMsg( '<div id="mw-missingcommenttext">$1</div>', 'missingcommenttext' ); |
1089 | 1096 | } |
1090 | 1097 | |
| 1098 | + if ( $this->doubleRedirect instanceof Title ) { |
| 1099 | + $wgOut->wrapWikiMsg( '<div id="mw-creatingdoubleredirect">$1</div>', |
| 1100 | + array( 'creatingdoubleredirect', $this->mTitle->getText(), $this->doubleRedirect->getText() ) ); |
| 1101 | + } |
| 1102 | + |
1091 | 1103 | if( $this->missingSummary && $this->section != 'new' ) { |
1092 | 1104 | $wgOut->wrapWikiMsg( '<div id="mw-missingsummary">$1</div>', 'missingsummary' ); |
1093 | 1105 | } |
— | — | @@ -1361,6 +1373,9 @@ |
1362 | 1374 | // mode will show an extra newline. A bit annoying. |
1363 | 1375 | $encodedtext .= "\n"; |
1364 | 1376 | } |
| 1377 | + if ( $this->doubleRedirect instanceof Title ) { |
| 1378 | + $wgOut->addHTML( Xml::hidden( 'wpIgnoreDoubleRedirect', true ) ); |
| 1379 | + } |
1365 | 1380 | |
1366 | 1381 | $wgOut->addHTML( <<<END |
1367 | 1382 | $recreate |
Index: trunk/phase3/languages/messages/MessagesEn.php |
— | — | @@ -1034,6 +1034,8 @@ |
1035 | 1035 | 'missingcommenttext' => 'Please enter a comment below.', |
1036 | 1036 | 'missingcommentheader' => "'''Reminder:''' You have not provided a subject/headline for this comment. |
1037 | 1037 | If you click Save again, your edit will be saved without one.", |
| 1038 | +'creatingdoubleredirect' => "'''Caution:''' You are attempting to redirect this page to [[$1]], but it redirects to |
| 1039 | +[[$2]]. Redirects that redirect two or more times do not work.", |
1038 | 1040 | 'summary-preview' => 'Summary preview', |
1039 | 1041 | 'subject-preview' => 'Subject/headline preview', |
1040 | 1042 | 'blockedtitle' => 'User is blocked', |