r79815 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r79814‎ | r79815 | r79816 >
Date:13:55, 7 January 2011
Author:catrope
Status:ok
Tags:
Comment:
Modified paths:
  • /branches/REL1_17/phase3/includes/Title.php (modified) (history)
  • /branches/REL1_17/phase3/includes/api/ApiParse.php (modified) (history)
  • /branches/REL1_17/phase3/includes/filerepo/ForeignAPIFile.php (modified) (history)
  • /branches/REL1_17/phase3/includes/specials/SpecialUpload.php (modified) (history)
  • /branches/REL1_17/phase3/includes/specials/SpecialVersion.php (modified) (history)
  • /branches/REL1_17/phase3/maintenance/tests/parser/parserTests.txt (modified) (history)

Diff [purge]

Index: branches/REL1_17/phase3/maintenance/tests/parser/parserTests.txt
@@ -6609,38 +6609,38 @@
66106610 !! result
66116611 <ul class="gallery">
66126612 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
6613 - <div style="height: 152px;">Image1.png</div>
 6613+ <div style="height: 150px;">Image1.png</div>
66146614 <div class="gallerytext">
66156615 </div>
66166616 </div></li>
66176617 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
6618 - <div style="height: 152px;">Image2.gif</div>
 6618+ <div style="height: 150px;">Image2.gif</div>
66196619 <div class="gallerytext">
66206620 <p>||||
66216621 </p>
66226622 </div>
66236623 </div></li>
66246624 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
6625 - <div style="height: 152px;">Image3</div>
 6625+ <div style="height: 150px;">Image3</div>
66266626 <div class="gallerytext">
66276627 </div>
66286628 </div></li>
66296629 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
6630 - <div style="height: 152px;">Image4</div>
 6630+ <div style="height: 150px;">Image4</div>
66316631 <div class="gallerytext">
66326632 <p>300px| centre
66336633 </p>
66346634 </div>
66356635 </div></li>
66366636 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
6637 - <div style="height: 152px;">Image5.svg</div>
 6637+ <div style="height: 150px;">Image5.svg</div>
66386638 <div class="gallerytext">
66396639 <p><a href="http://///////" class="external free" rel="nofollow">http://///////</a>
66406640 </p>
66416641 </div>
66426642 </div></li>
66436643 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
6644 - <div style="height: 152px;">* image6</div>
 6644+ <div style="height: 150px;">* image6</div>
66456645 <div class="gallerytext">
66466646 </div>
66476647 </div></li>
@@ -6661,26 +6661,26 @@
66626662 <ul class="gallery" style="max-width: 220px;_width: 220px;">
66636663 <li class='gallerycaption'>Foo <a href="https://www.mediawiki.org/wiki/Main_Page">Main Page</a></li>
66646664 <li class="gallerybox" style="width: 95px"><div style="width: 95px">
6665 - <div style="height: 52px;">Nonexistant.jpg</div>
 6665+ <div style="height: 70px;">Nonexistant.jpg</div>
66666666 <div class="gallerytext">
66676667 <p>caption
66686668 </p>
66696669 </div>
66706670 </div></li>
66716671 <li class="gallerybox" style="width: 95px"><div style="width: 95px">
6672 - <div style="height: 52px;">Nonexistant.jpg</div>
 6672+ <div style="height: 70px;">Nonexistant.jpg</div>
66736673 <div class="gallerytext">
66746674 </div>
66756675 </div></li>
66766676 <li class="gallerybox" style="width: 95px"><div style="width: 95px">
6677 - <div class="thumb" style="padding: 19px 0; width: 90px;"><div style="margin-left: auto; margin-right: auto; width: 60px;"><a href="https://www.mediawiki.org/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/3/3a/Foobar.jpg" width="60" height="7" /></a></div></div>
 6677+ <div class="thumb" style="width: 90px; height: 70px;"><div style="margin:31px auto;"><a href="https://www.mediawiki.org/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/3/3a/Foobar.jpg" width="60" height="7" /></a></div></div>
66786678 <div class="gallerytext">
66796679 <p>some <b>caption</b> <a href="https://www.mediawiki.org/wiki/Main_Page">Main Page</a>
66806680 </p>
66816681 </div>
66826682 </div></li>
66836683 <li class="gallerybox" style="width: 95px"><div style="width: 95px">
6684 - <div class="thumb" style="padding: 19px 0; width: 90px;"><div style="margin-left: auto; margin-right: auto; width: 60px;"><a href="https://www.mediawiki.org/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="60" height="7" /></a></div></div>
 6684+ <div class="thumb" style="width: 90px; height: 70px;"><div style="margin:31px auto;"><a href="https://www.mediawiki.org/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="60" height="7" /></a></div></div>
66856685 <div class="gallerytext">
66866686 </div>
66876687 </div></li>
@@ -6700,7 +6700,7 @@
67016701 !! result
67026702 <ul class="gallery">
67036703 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
6704 - <div style="height: 152px;">Nonexistant.jpg</div>
 6704+ <div style="height: 150px;">Nonexistant.jpg</div>
67056705 <div class="gallerytext">
67066706 <p><a href="https://www.mediawiki.org/wiki/File:Nonexistant.jpg" title="File:Nonexistant.jpg">Nonexistant.jpg</a><br />
67076707 caption
@@ -6708,14 +6708,14 @@
67096709 </div>
67106710 </div></li>
67116711 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
6712 - <div style="height: 152px;">Nonexistant.jpg</div>
 6712+ <div style="height: 150px;">Nonexistant.jpg</div>
67136713 <div class="gallerytext">
67146714 <p><a href="https://www.mediawiki.org/wiki/File:Nonexistant.jpg" title="File:Nonexistant.jpg">Nonexistant.jpg</a><br />
67156715 </p>
67166716 </div>
67176717 </div></li>
67186718 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
6719 - <div class="thumb" style="padding: 66px 0; width: 150px;"><div style="margin-left: auto; margin-right: auto; width: 120px;"><a href="https://www.mediawiki.org/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/3/3a/Foobar.jpg" width="120" height="14" /></a></div></div>
 6719+ <div class="thumb" style="width: 150px; height: 150px;"><div style="margin:68px auto;"><a href="https://www.mediawiki.org/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/3/3a/Foobar.jpg" width="120" height="14" /></a></div></div>
67206720 <div class="gallerytext">
67216721 <p><a href="https://www.mediawiki.org/wiki/File:Foobar.jpg" title="File:Foobar.jpg">Foobar.jpg</a><br />
67226722 some <b>caption</b> <a href="https://www.mediawiki.org/wiki/Main_Page">Main Page</a>
@@ -6723,7 +6723,7 @@
67246724 </div>
67256725 </div></li>
67266726 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
6727 - <div class="thumb" style="padding: 66px 0; width: 150px;"><div style="margin-left: auto; margin-right: auto; width: 120px;"><a href="https://www.mediawiki.org/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="120" height="14" /></a></div></div>
 6727+ <div class="thumb" style="width: 150px; height: 150px;"><div style="margin:68px auto;"><a href="https://www.mediawiki.org/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="120" height="14" /></a></div></div>
67286728 <div class="gallerytext">
67296729 <p><a href="https://www.mediawiki.org/wiki/File:Foobar.jpg" title="File:Foobar.jpg">Foobar.jpg</a><br />
67306730 </p>
Index: branches/REL1_17/phase3/includes/filerepo/ForeignAPIFile.php
@@ -21,7 +21,13 @@
2222 $this->mInfo = $info;
2323 $this->mExists = $exists;
2424 }
25 -
 25+
 26+ /**
 27+ * @static
 28+ * @param $title Title
 29+ * @param $repo ForeignApiRepo
 30+ * @return ForeignAPIFile|null
 31+ */
2632 static function newFromTitle( $title, $repo ) {
2733 $data = $repo->fetchImageQuery( array(
2834 'titles' => 'File:' . $title->getDBKey(),
@@ -30,11 +36,16 @@
3137
3238 $info = $repo->getImageInfo( $data );
3339
34 - if( $data && $info) {
35 - if( isset( $data['query']['redirects'][0] ) ) {
36 - $newtitle = Title::newFromText( $data['query']['redirects'][0]['to']);
 40+ if( $info ) {
 41+ $lastRedirect = isset( $data['query']['redirects'] )
 42+ ? count( $data['query']['redirects'] ) - 1
 43+ : -1;
 44+ if( $lastRedirect >= 0 ) {
 45+ $newtitle = Title::newFromText( $data['query']['redirects'][$lastRedirect]['to']);
3746 $img = new ForeignAPIFile( $newtitle, $repo, $info, true );
38 - if( $img ) $img->redirectedFrom( $title->getDBkey() );
 47+ if( $img ) {
 48+ $img->redirectedFrom( $title->getDBkey() );
 49+ }
3950 } else {
4051 $img = new ForeignAPIFile( $title, $repo, $info, true );
4152 }
Property changes on: branches/REL1_17/phase3/includes/filerepo/ForeignAPIFile.php
___________________________________________________________________
Added: svn:mergeinfo
4253 Merged /branches/new-installer/phase3/includes/filerepo/ForeignAPIFile.php:r43664-66004
4354 Merged /branches/wmf-deployment/includes/filerepo/ForeignAPIFile.php:r53381
4455 Merged /branches/REL1_15/phase3/includes/filerepo/ForeignAPIFile.php:r51646
4556 Merged /branches/sqlite/includes/filerepo/ForeignAPIFile.php:r58211-58321
4657 Merged /trunk/phase3/includes/filerepo/ForeignAPIFile.php:r79708,79725
Index: branches/REL1_17/phase3/includes/api/ApiParse.php
@@ -114,7 +114,7 @@
115115 $wgTitle = $titleObj;
116116
117117 if ( $this->section !== false ) {
118 - $text = $this->getSectionText( $text, 'r' . $rev );
 118+ $text = $this->getSectionText( $text, 'r' . $rev->getId() );
119119 }
120120
121121 $p_result = $wgParser->parse( $text, $titleObj, $popts );
Property changes on: branches/REL1_17/phase3/includes/api/ApiParse.php
___________________________________________________________________
Added: svn:mergeinfo
122122 Merged /branches/wmf-deployment/includes/api/ApiParse.php:r53381,59952
123123 Merged /branches/REL1_15/phase3/includes/api/ApiParse.php:r51646
124124 Merged /branches/REL1_16/phase3/includes/api/ApiParse.php:r63621-63636,69357
125125 Merged /branches/wmf/1.16wmf4/includes/api/ApiParse.php:r69521
126126 Merged /branches/sqlite/includes/api/ApiParse.php:r58211-58321
127127 Merged /trunk/phase3/includes/api/ApiParse.php:r79762
Index: branches/REL1_17/phase3/includes/Title.php
@@ -72,7 +72,7 @@
7373 var $mCascadeSources; ///< Where are the cascading restrictions coming from on this page?
7474 var $mRestrictionsLoaded = false; ///< Boolean for initialisation on demand
7575 var $mPrefixedText; ///< Text form including namespace/interwiki, initialised on demand
76 - var $mTitleProtection; ///< Cached value of getTitleProtection
 76+ var $mTitleProtection; ///< Cached value for getTitleProtection (create protection)
7777 # Don't change the following default, NS_MAIN is hardcoded in several
7878 # places. See bug 696.
7979 var $mDefaultNamespace = NS_MAIN; // /< Namespace index when there is no namespace
@@ -1624,6 +1624,7 @@
16251625
16261626 /**
16271627 * Is this title subject to title protection?
 1628+ * Title protection is the one applied against creation of such title.
16281629 *
16291630 * @return \type{\mixed} An associative array representing any existent title
16301631 * protection, or false if there's none.
@@ -1651,10 +1652,6 @@
16521653 return $this->mTitleProtection;
16531654 }
16541655
1655 - private function invalidateTitleProtectionCache() {
1656 - unset( $this->mTitleProtection );
1657 - }
1658 -
16591656 /**
16601657 * Update the title protection status
16611658 *
@@ -1688,8 +1685,7 @@
16891686
16901687 # Update protection table
16911688 if ( $create_perm != '' ) {
1692 - $dbw->replace( 'protected_titles', array( array( 'pt_namespace', 'pt_title' ) ),
1693 - array(
 1689+ $this->mTitleProtection = array(
16941690 'pt_namespace' => $namespace,
16951691 'pt_title' => $title,
16961692 'pt_create_perm' => $create_perm,
@@ -1697,13 +1693,14 @@
16981694 'pt_expiry' => $encodedExpiry,
16991695 'pt_user' => $wgUser->getId(),
17001696 'pt_reason' => $reason,
1701 - ), __METHOD__
1702 - );
 1697+ );
 1698+ $dbw->replace( 'protected_titles', array( array( 'pt_namespace', 'pt_title' ) ),
 1699+ $this->mTitleProtection, __METHOD__ );
17031700 } else {
17041701 $dbw->delete( 'protected_titles', array( 'pt_namespace' => $namespace,
17051702 'pt_title' => $title ), __METHOD__ );
 1703+ $this->mTitleProtection = false;
17061704 }
1707 - $this->invalidateTitleProtectionCache();
17081705
17091706 # Update the protection log
17101707 if ( $dbw->affectedRows() ) {
@@ -1731,7 +1728,7 @@
17321729 array( 'pt_namespace' => $this->getNamespace(), 'pt_title' => $this->getDBkey() ),
17331730 __METHOD__
17341731 );
1735 - $this->invalidateTitleProtectionCache();
 1732+ $this->mTitleProtection = false;
17361733 }
17371734
17381735 /**
@@ -2105,7 +2102,6 @@
21062103 }
21072104 if ( $purgeExpired ) {
21082105 Title::purgeExpiredRestrictions();
2109 - $this->invalidateTitleProtectionCache();
21102106 }
21112107
21122108 wfProfileOut( __METHOD__ );
@@ -2152,7 +2148,8 @@
21532149
21542150 /**
21552151 * Compiles list of active page restrictions from both page table (pre 1.10)
2156 - * and page_restrictions table
 2152+ * and page_restrictions table for this existing page.
 2153+ * Public for usage by LiquidThreads.
21572154 *
21582155 * @param $rows array of db result objects
21592156 * @param $oldFashionedRestrictions string comma-separated list of page
@@ -2225,7 +2222,6 @@
22262223
22272224 if ( $purgeExpired ) {
22282225 Title::purgeExpiredRestrictions();
2229 - $this->invalidateTitleProtectionCache();
22302226 }
22312227 }
22322228
@@ -2260,7 +2256,7 @@
22612257 $this->mRestrictions['create'] = explode( ',', trim( $title_protection['pt_create_perm'] ) );
22622258 } else { // Get rid of the old restrictions
22632259 Title::purgeExpiredRestrictions();
2264 - $this->invalidateTitleProtectionCache();
 2260+ $this->mTitleProtection = false;
22652261 }
22662262 } else {
22672263 $this->mRestrictionsExpiry['create'] = Block::decodeExpiry( '' );
Property changes on: branches/REL1_17/phase3/includes/Title.php
___________________________________________________________________
Modified: svn:mergeinfo
22682264 Merged /trunk/phase3/includes/Title.php:r79759,79764
Index: branches/REL1_17/phase3/includes/specials/SpecialUpload.php
@@ -264,7 +264,7 @@
265265
266266 # Give a notice if the user is uploading a file that has been deleted or moved
267267 # Note that this is independent from the message 'filewasdeleted' that requires JS
268 - $desiredTitleObj = Title::newFromText( $this->mDesiredDestName, NS_FILE );
 268+ $desiredTitleObj = Title::makeTitleSafe( NS_FILE, $this->mDesiredDestName );
269269 $delNotice = ''; // empty by default
270270 if ( $desiredTitleObj instanceof Title && !$desiredTitleObj->exists() ) {
271271 LogEventsList::showLogExtract( $delNotice, array( 'delete', 'move' ),
@@ -816,11 +816,11 @@
817817
818818 if ( $this->mSessionKey ) {
819819 return array(
820 - 'wpSessionKey' => array(
 820+ 'SessionKey' => array(
821821 'type' => 'hidden',
822822 'default' => $this->mSessionKey,
823823 ),
824 - 'wpSourceType' => array(
 824+ 'SourceType' => array(
825825 'type' => 'hidden',
826826 'default' => 'Stash',
827827 ),
Property changes on: branches/REL1_17/phase3/includes/specials/SpecialUpload.php
___________________________________________________________________
Added: svn:mergeinfo
828828 Merged /branches/wmf-deployment/includes/specials/SpecialUpload.php:r53381,56967
829829 Merged /branches/REL1_15/phase3/includes/specials/SpecialUpload.php:r51646
830830 Merged /branches/sqlite/includes/specials/SpecialUpload.php:r58211-58321
831831 Merged /trunk/phase3/includes/specials/SpecialUpload.php:r78560,79758
Index: branches/REL1_17/phase3/includes/specials/SpecialVersion.php
@@ -89,18 +89,20 @@
9090 }
9191
9292 /**
93 - * Get the "Mediawiki is copyright 2001-20xx by lots of cool guys" text
 93+ * Get the "MediaWiki is copyright 2001-20xx by lots of cool guys" text
9494 *
9595 * @return String
9696 */
9797 public static function getCopyrightAndAuthorList() {
9898 global $wgLang;
9999
100 - $authorList = array( 'Magnus Manske', 'Brion Vibber', 'Lee Daniel Crocker',
 100+ $authorList = array(
 101+ 'Magnus Manske', 'Brion Vibber', 'Lee Daniel Crocker',
101102 'Tim Starling', 'Erik Möller', 'Gabriel Wicke', 'Ævar Arnfjörð Bjarmason',
102103 'Niklas Laxström', 'Domas Mituzas', 'Rob Church', 'Yuri Astrakhan',
103104 'Aryeh Gregor', 'Aaron Schulz', 'Andrew Garrett', 'Raimond Spekking',
104105 'Alexandre Emsenhuber', 'Siebrand Mazeland', 'Chad Horohoe',
 106+ 'Roan Kattouw', 'Trevor Parscal', 'Bryan Tong Minh', 'Sam Reed',
105107 wfMsg( 'version-poweredby-others' )
106108 );
107109
@@ -183,7 +185,7 @@
184186
185187 $info = self::getSvnInfo( $IP );
186188
187 - if ( isset( $info['checkout-rev'] ) ) {
 189+ if ( isset( $info['checkout-rev'] ) ) {
188190 $linkText = wfMsg(
189191 'version-svn-revision',
190192 isset( $info['directory-rev'] ) ? $info['directory-rev'] : '',
Property changes on: branches/REL1_17/phase3/includes/specials/SpecialVersion.php
___________________________________________________________________
Modified: svn:mergeinfo
191193 Merged /trunk/phase3/includes/specials/SpecialVersion.php:r79131,79713

Follow-up revisions

RevisionCommit summaryAuthorDate
r79816Followup r79815: merge r79810 for realcatrope13:56, 7 January 2011

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r78327Followup to r77836. Update parserTestshartman20:34, 13 December 2010
r78560Fixing r65339: makeTitleSafe instead of newFromTextchurchofemacs13:57, 18 December 2010
r79131add Roan to Special:Version creditsashley20:46, 28 December 2010
r79708Fixup minor FIXME on r66724reedy03:21, 6 January 2011
r79713Added three more people to the author list.tstarling09:42, 6 January 2011
r79725Fixup my FIXME on r79708...reedy15:47, 6 January 2011
r79758Follow-up r78452: missed a couple of hidden fields in SpecialUploadhappy-melon21:17, 6 January 2011
r79759Address my r76242 fixme....platonides21:26, 6 January 2011
r79762Fix string concat error in r66150. Also was a bug/notice in TWreedy22:06, 6 January 2011
r79764Follow up r79759. Title::loadRestrictionsFromRows called by LiquidThreadsplatonides22:19, 6 January 2011
r79810Add missing return true; that was upsetting tesla! Will look for someone to b...reedy06:33, 7 January 2011

Status & tagging log