r38272 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r38271‎ | r38272 | r38273 >
Date:02:28, 31 July 2008
Author:demon
Status:old
Tags:
Comment:
Modified paths:
  • /trunk/phase3/includes/Article.php (modified) (history)
  • /trunk/phase3/includes/EditPage.php (modified) (history)
  • /trunk/phase3/languages/messages/MessagesEn.php (modified) (history)
  • /trunk/phase3/maintenance/archives/patch-rd_fragment.sql (added) (history)
  • /trunk/phase3/maintenance/archives/patch-rd_interwiki.sql (added) (history)
  • /trunk/phase3/maintenance/tables.sql (modified) (history)
  • /trunk/phase3/maintenance/updaters.inc (modified) (history)

Diff [purge]

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
16 + 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
16 + native
Index: trunk/phase3/maintenance/updaters.inc
@@ -143,6 +143,10 @@
144144 array( 'maybe_do_profiling_memory_update' ),
145145 array( 'do_filearchive_indices_update' ),
146146 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' ),
147151 );
148152
149153
@@ -1716,3 +1720,4 @@
17171721 return;
17181722 }
17191723
 1724+
Index: trunk/phase3/maintenance/tables.sql
@@ -1157,6 +1157,8 @@
11581158 -- goes by.
11591159 rd_namespace int NOT NULL default '0',
11601160 rd_title varchar(255) binary NOT NULL default '',
 1161+ rd_interwiki varchar(32) default NULL,
 1162+ rd_fragment varchar(255) binary DEFAULT NULL,
11611163
11621164 PRIMARY KEY rd_from (rd_from),
11631165 KEY rd_ns_title (rd_namespace,rd_title,rd_from)
Index: trunk/phase3/includes/Article.php
@@ -103,7 +103,9 @@
104104 $dbw->replace('redirect', array('rd_from'), array(
105105 'rd_from' => $this->getID(),
106106 'rd_namespace' => $retval->getNamespace(),
107 - 'rd_title' => $retval->getDBKey()
 107+ 'rd_title' => $retval->getDBKey(),
 108+ 'rd_interwiki' => $retval->getInterwiki(),
 109+ 'rd_fragment' => $retval->getFragment(),
108110 ), __METHOD__);
109111 return $retval;
110112 }
@@ -1182,6 +1184,8 @@
11831185 'rd_namespace' => $redirectTitle->getNamespace(),
11841186 'rd_title' => $redirectTitle->getDBkey(),
11851187 'rd_from' => $this->getId(),
 1188+ 'rd_interwiki' => $redirectTitle->getInterwiki(),
 1189+ 'rd_fragment' => $redirectTitle->getFragment(),
11861190 );
11871191
11881192 $dbw->replace( 'redirect', array( 'rd_from' ), $set, __METHOD__ );
Index: trunk/phase3/includes/EditPage.php
@@ -41,6 +41,7 @@
4242 const AS_SPAM_ERROR = 232;
4343 const AS_IMAGE_REDIRECT_ANON = 233;
4444 const AS_IMAGE_REDIRECT_LOGGED = 234;
 45+ const AS_DOUBLE_REDIRECT = 235;
4546
4647 var $mArticle;
4748 var $mTitle;
@@ -58,6 +59,7 @@
5960 var $kblength = false;
6061 var $missingComment = false;
6162 var $missingSummary = false;
 63+ var $doubleRedirect = false;
6264 var $allowBlankSummary = false;
6365 var $autoSumm = '';
6466 var $hookError = '';
@@ -927,6 +929,11 @@
928930 return self::AS_HOOK_ERROR;
929931 }
930932
 933+ # Are we creating a double redirect?
 934+ if ( $redirectTitle = Title::newFromRedirect( $this->textbox1 ) && $redirectTitle->isRedirect() ) {
 935+ $this->doubleRedirect = $redirectTitle;
 936+ }
 937+
931938 # Handle the user preference to force summaries here, but not for null edits
932939 if( $this->section != 'new' && !$this->allowBlankSummary && $wgUser->getOption( 'forceeditsummary') &&
933940 0 != strcmp($oldtext, $text) &&
@@ -1087,6 +1094,11 @@
10881095 $wgOut->wrapWikiMsg( '<div id="mw-missingcommenttext">$1</div>', 'missingcommenttext' );
10891096 }
10901097
 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+
10911103 if( $this->missingSummary && $this->section != 'new' ) {
10921104 $wgOut->wrapWikiMsg( '<div id="mw-missingsummary">$1</div>', 'missingsummary' );
10931105 }
@@ -1361,6 +1373,9 @@
13621374 // mode will show an extra newline. A bit annoying.
13631375 $encodedtext .= "\n";
13641376 }
 1377+ if ( $this->doubleRedirect instanceof Title ) {
 1378+ $wgOut->addHTML( Xml::hidden( 'wpIgnoreDoubleRedirect', true ) );
 1379+ }
13651380
13661381 $wgOut->addHTML( <<<END
13671382 $recreate
Index: trunk/phase3/languages/messages/MessagesEn.php
@@ -1034,6 +1034,8 @@
10351035 'missingcommenttext' => 'Please enter a comment below.',
10361036 'missingcommentheader' => "'''Reminder:''' You have not provided a subject/headline for this comment.
10371037 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.",
10381040 'summary-preview' => 'Summary preview',
10391041 'subject-preview' => 'Subject/headline preview',
10401042 'blockedtitle' => 'User is blocked',

Status & tagging log