r85211 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r85210‎ | r85211 | r85212 >
Date:21:01, 2 April 2011
Author:demon
Status:resolved (Comments)
Tags:
Comment:
Modified paths:
  • /branches/REL1_17/phase3/RELEASE-NOTES (modified) (history)
  • /branches/REL1_17/phase3/includes/ImageGallery.php (modified) (history)
  • /branches/REL1_17/phase3/includes/Import.php (modified) (history)
  • /branches/REL1_17/phase3/includes/Pager.php (modified) (history)
  • /branches/REL1_17/phase3/includes/Sanitizer.php (modified) (history)
  • /branches/REL1_17/phase3/includes/api/ApiQueryPageProps.php (modified) (history)
  • /branches/REL1_17/phase3/includes/json/FormatJson.php (modified) (history)
  • /branches/REL1_17/phase3/includes/libs/CSSMin.php (modified) (history)
  • /branches/REL1_17/phase3/includes/media/SVGMetadataExtractor.php (modified) (history)
  • /branches/REL1_17/phase3/includes/parser/Parser.php (modified) (history)
  • /branches/REL1_17/phase3/includes/specials/SpecialContributions.php (modified) (history)
  • /branches/REL1_17/phase3/includes/specials/SpecialEmailuser.php (modified) (history)
  • /branches/REL1_17/phase3/includes/specials/SpecialListfiles.php (modified) (history)
  • /branches/REL1_17/phase3/includes/specials/SpecialNewpages.php (modified) (history)
  • /branches/REL1_17/phase3/languages/classes/LanguageWa.php (modified) (history)
  • /branches/REL1_17/phase3/skins/common/shared.css (modified) (history)
  • /branches/REL1_17/phase3/skins/vector/screen.css (modified) (history)

Diff [purge]

Index: branches/REL1_17/phase3/skins/common/shared.css
@@ -780,10 +780,6 @@
781781 margin: 2px;
782782 }
783783
784 -li.gallerybox div.thumb a.image img {
785 - vertical-align: text-top;
786 -}
787 -
788784 div.gallerytext {
789785 overflow: hidden;
790786 font-size: 94%;
Property changes on: branches/REL1_17/phase3/skins/common/shared.css
___________________________________________________________________
Modified: svn:mergeinfo
791787 Merged /trunk/phase3/skins/common/shared.css:r82297,82307,82309,82312,82315,82337,82391-82392,82403,82411,82446,82457,82466,82473,82475,82478,82482,82486
Index: branches/REL1_17/phase3/skins/vector/screen.css
@@ -969,8 +969,8 @@
970970 }
971971 /* User Message */
972972 .usermessage {
973 - background-color: #e0e8ff;
974 - border: 1px solid #99b3ff;
 973+ background-color: #ffce7b;
 974+ border: 1px solid #ffa500;
975975 color: black;
976976 font-weight: bold;
977977 margin: 2em 0 1em;
Property changes on: branches/REL1_17/phase3/skins/vector/screen.css
___________________________________________________________________
Modified: svn:mergeinfo
978978 Merged /trunk/phase3/skins/vector/screen.css:r82297,82307,82309,82312,82315,82337,82391-82392,82403,82411,82446,82457,82466,82473,82475,82478,82482,82486
Index: branches/REL1_17/phase3/includes/json/FormatJson.php
@@ -9,6 +9,8 @@
1010 die( 1 );
1111 }
1212
 13+require_once dirname( __FILE__ ) . '/Services_JSON.php';
 14+
1315 class FormatJson {
1416
1517 /**
@@ -55,4 +57,4 @@
5658 }
5759 }
5860
59 -}
\ No newline at end of file
 61+}
Index: branches/REL1_17/phase3/includes/parser/Parser.php
@@ -318,8 +318,8 @@
319319
320320 /**
321321 * A converted title will be provided in the output object if title and
322 - * content conversion are enabled, the article text does not contain
323 - * a conversion-suppressing double-underscore tag, and no
 322+ * content conversion are enabled, the article text does not contain
 323+ * a conversion-suppressing double-underscore tag, and no
324324 * {{DISPLAYTITLE:...}} is present. DISPLAYTITLE takes precedence over
325325 * automatic link conversion.
326326 */
@@ -476,7 +476,9 @@
477477
478478 $flags = PPFrame::NO_ARGS | PPFrame::NO_TEMPLATES;
479479 $dom = $this->preprocessToDom( $text, self::PTD_FOR_INCLUSION );
480 - return $this->getPreprocessor()->newFrame()->expand( $dom, $flags );
 480+ $text = $this->getPreprocessor()->newFrame()->expand( $dom, $flags );
 481+ $text = $this->mStripState->unstripBoth( $text );
 482+ return $text;
481483 }
482484
483485 /**
@@ -4043,6 +4045,9 @@
40444046 # Because mOutputType is OT_WIKI, this will only process {{subst:xxx}} type tags
40454047 $text = $this->replaceVariables( $text );
40464048
 4049+ # This works almost by chance, as the replaceVariables are done before the getUserSig(),
 4050+ # which may corrupt this parser instance via its wfMsgExt( parsemag ) call-
 4051+
40474052 # Signatures
40484053 $sigText = $this->getUserSig( $user );
40494054 $text = strtr( $text, array(
@@ -4923,6 +4928,15 @@
49244929 return $this->extractSections( $text, $section, "get", $deftext );
49254930 }
49264931
 4932+ /**
 4933+ * This function returns $oldtext after the content of the section
 4934+ * specified by $section has been replaced with $text.
 4935+ *
 4936+ * @param $text String: former text of the article
 4937+ * @param $section Numeric: section identifier
 4938+ * @param $text String: replacing text
 4939+ * #return String: modified text
 4940+ */
49274941 public function replaceSection( $oldtext, $section, $text ) {
49284942 return $this->extractSections( $oldtext, $section, "replace", $text );
49294943 }
Property changes on: branches/REL1_17/phase3/includes/parser/Parser.php
___________________________________________________________________
Modified: svn:mergeinfo
49304944 Merged /trunk/phase3/includes/parser/Parser.php:r82297,82307,82309,82312,82315,82337,82391-82392,82403,82411,82446,82457,82466,82473,82475,82478,82482,82486
Index: branches/REL1_17/phase3/includes/Sanitizer.php
@@ -40,7 +40,7 @@
4141 * Allows some... latitude.
4242 * Used in Sanitizer::fixTagAttributes and Sanitizer::decodeTagAttributes
4343 */
44 -$attribFirst = '[:A-Z_a-z]';
 44+$attribFirst = '[:A-Z_a-z0-9]';
4545 $attrib = '[:A-Z_a-z-.0-9]';
4646 $space = '[\x09\x0a\x0d\x20]';
4747 define( 'MW_ATTRIBS_REGEX',
Property changes on: branches/REL1_17/phase3/includes/Sanitizer.php
___________________________________________________________________
Added: svn:mergeinfo
4848 Merged /branches/new-installer/phase3/includes/Sanitizer.php:r43664-66004
4949 Merged /branches/wmf-deployment/includes/Sanitizer.php:r53381
5050 Merged /branches/REL1_15/phase3/includes/Sanitizer.php:r51646
5151 Merged /branches/sqlite/includes/Sanitizer.php:r58211-58321
5252 Merged /trunk/phase3/includes/Sanitizer.php:r82297,82307,82309,82312,82315,82337,82391-82392,82403,82411,82446,82457,82466,82473,82475,82478,82480,82482,82486,82845,82847-82848
Index: branches/REL1_17/phase3/includes/api/ApiQueryPageProps.php
@@ -108,7 +108,7 @@
109109 * @return bool True if it fits in the result
110110 */
111111 private function addPageProps( $result, $page, $props ) {
112 - $fit = $result->addValue( array( 'query', 'pages' ), $page, $props );
 112+ $fit = $result->addValue( array( 'query', 'pages', $page ), 'pageprops', $props );
113113
114114 if ( !$fit ) {
115115 $this->setContinueEnumParameter( 'continue', $page );
Property changes on: branches/REL1_17/phase3/includes/api/ApiQueryPageProps.php
___________________________________________________________________
Modified: svn:mergeinfo
116116 Merged /trunk/phase3/includes/api/ApiQueryPageProps.php:r82297,82307,82309,82312,82315,82337,82391-82392,82403,82411,82446,82457,82466,82473,82475,82478,82482,82486
Index: branches/REL1_17/phase3/includes/media/SVGMetadataExtractor.php
@@ -74,7 +74,7 @@
7575 $keepReading = $this->reader->read();
7676 }
7777
78 - if ( $this->reader->name != 'svg' ) {
 78+ if ( !$this->qualifiedNameEquals( $this->reader->name, 'svg', 'svg' ) ) {
7979 throw new MWException( "Expected <svg> tag, got ".
8080 $this->reader->name );
8181 }
@@ -90,13 +90,13 @@
9191
9292 $this->debug( "$tag" );
9393
94 - if ( $tag == 'svg' && $type == XmlReader::END_ELEMENT && $this->reader->depth <= $exitDepth ) {
 94+ if ( $this->qualifiedNameEquals( $tag, 'svg', 'svg' ) && $type == XmlReader::END_ELEMENT && $this->reader->depth <= $exitDepth ) {
9595 break;
96 - } elseif ( $tag == 'title' ) {
 96+ } elseif ( $this->qualifiedNameEquals( $tag, 'svg', 'title' ) ) {
9797 $this->readField( $tag, 'title' );
98 - } elseif ( $tag == 'desc' ) {
 98+ } elseif ( $this->qualifiedNameEquals( $tag, 'svg', 'desc' ) ) {
9999 $this->readField( $tag, 'description' );
100 - } elseif ( $tag == 'metadata' && $type == XmlReader::ELEMENT ) {
 100+ } elseif ( $this->qualifiedNameEquals( $tag, 'svg', 'metadata' ) && $type == XmlReader::ELEMENT ) {
101101 $this->readXml( $tag, 'metadata' );
102102 } elseif ( $tag !== '#text' ) {
103103 $this->debug( "Unhandled top-level XML tag $tag" );
@@ -172,10 +172,15 @@
173173 } elseif ( $this->reader->nodeType == XmlReader::ELEMENT ) {
174174 switch( $this->reader->name ) {
175175 case 'animate':
 176+ case 'svg:animate':
176177 case 'set':
 178+ case 'svg:set':
177179 case 'animateMotion':
 180+ case 'svg:animateMotion':
178181 case 'animateColor':
 182+ case 'svg:animateColor':
179183 case 'animateTransform':
 184+ case 'svg:animateTransform':
180185 $this->debug( "HOUSTON WE HAVE ANIMATION" );
181186 $this->metadata['animated'] = true;
182187 break;
@@ -284,4 +289,22 @@
285290 return floatval( $length );
286291 }
287292 }
 293+
 294+ /**
 295+ * XML namespace check
 296+ *
 297+ * Check if a read node name matches the expected nodeName
 298+ * @param $qualifiedName as read by XMLReader
 299+ * @param $prefix the namespace prefix that you expect for this element, defaults to svg namespace
 300+ * @param $localName the localName part of the element that you want to match
 301+ *
 302+ * @return boolean
 303+ */
 304+ private function qualifiedNameEquals( $qualifiedName, $prefix="svg", $localName ) {
 305+ if( ($qualifiedName == $localName && $prefix == "svg" ) ||
 306+ $qualifiedName == ($prefix . ":" . $localName) ) {
 307+ return true;
 308+ }
 309+ return false;
 310+ }
288311 }
Index: branches/REL1_17/phase3/includes/libs/CSSMin.php
@@ -126,6 +126,17 @@
127127 $offset = $match[0][1] + strlen( $match[0][0] );
128128 continue;
129129 }
 130+ // URLs with absolute paths like /w/index.php need to be expanded
 131+ // to absolute URLs but otherwise left alone
 132+ if ( $match['file'][0] !== '' && $match['file'][0][0] === '/' ) {
 133+ // Replace the file path with an expanded URL
 134+ $source = substr_replace( $source, wfExpandUrl( $match['file'][0] ),
 135+ $match['file'][1], strlen( $match['file'][0] )
 136+ );
 137+ // Move the offset to the end of the match, leaving it alone
 138+ $offset = $match[0][1] + strlen( $match[0][0] );
 139+ continue;
 140+ }
130141 // Shortcuts
131142 $embed = $match['embed'][0];
132143 $pre = $match['pre'][0];
Index: branches/REL1_17/phase3/includes/specials/SpecialNewpages.php
@@ -366,7 +366,7 @@
367367
368368 $feed->outHeader();
369369 if( $pager->getNumRows() > 0 ) {
370 - foreach ( $pager->mResult->fetchObject() as $row ) {
 370+ foreach ( $pager->mResult as $row ) {
371371 $feed->outItem( $this->feedItem( $row ) );
372372 }
373373 }
Index: branches/REL1_17/phase3/includes/specials/SpecialListfiles.php
@@ -211,10 +211,8 @@
212212 ) );
213213 $s = Html::openElement( 'form', array( 'method' => 'get', 'action' => $wgScript, 'id' => 'mw-listfiles-form' ) ) .
214214 Xml::fieldset( wfMsg( 'listfiles' ) ) .
215 - Html::openElement( 'table', array( 'id' => 'mw-listfiles-table' ) ) .
216215 Xml::buildForm( $inputForm, 'table_pager_limit_submit' ) .
217216 $this->getHiddenFields( array( 'limit', 'ilsearch', 'user' ) ) .
218 - Html::closeElement( 'table' ) .
219217 Html::closeElement( 'fieldset' ) .
220218 Html::closeElement( 'form' ) . "\n";
221219 return $s;
Index: branches/REL1_17/phase3/includes/specials/SpecialContributions.php
@@ -56,7 +56,7 @@
5757 $this->opts['contribs'] = 'newbie';
5858 }
5959
60 - $this->opts['deletedOnly'] = $wgRequest->getCheck( 'deletedOnly' );
 60+ $this->opts['deletedOnly'] = $wgRequest->getBool( 'deletedOnly' );
6161
6262 if( !strlen( $target ) ) {
6363 $wgOut->addHTML( $this->getForm() );
@@ -65,7 +65,7 @@
6666
6767 $this->opts['limit'] = $wgRequest->getInt( 'limit', $wgUser->getOption('rclimit') );
6868 $this->opts['target'] = $target;
69 - $this->opts['topOnly'] = $wgRequest->getCheck( 'topOnly' );
 69+ $this->opts['topOnly'] = $wgRequest->getBool( 'topOnly' );
7070
7171 $nt = Title::makeTitleSafe( NS_USER, $target );
7272 if( !$nt ) {
@@ -616,7 +616,6 @@
617617 $classes = array();
618618
619619 $page = Title::newFromRow( $row );
620 - $page->resetArticleId( $row->rev_page ); // use process cache
621620 $link = $sk->link(
622621 $page,
623622 htmlspecialchars( $page->getPrefixedText() ),
Index: branches/REL1_17/phase3/includes/specials/SpecialEmailuser.php
@@ -90,7 +90,7 @@
9191 $this->outputHeader();
9292
9393 $this->mTarget = is_null( $par )
94 - ? $wgRequest->getVal( 'wpTarget', '' )
 94+ ? $wgRequest->getVal( 'wpTarget', $wgRequest->getVal( 'target', '' ) )
9595 : $par;
9696
9797 $ret = self::getTarget( $this->mTarget );
Index: branches/REL1_17/phase3/includes/Import.php
@@ -662,7 +662,7 @@
663663 return false;
664664 }
665665
666 - return array( $origTitle, $title );
 666+ return array( $title, $origTitle );
667667 }
668668 }
669669
Index: branches/REL1_17/phase3/includes/Pager.php
@@ -899,7 +899,13 @@
900900 * @return Associative array
901901 */
902902 function getRowAttrs( $row ) {
903 - return array( 'class' => $this->getRowClass( $row ) );
 903+ $class = $this->getRowClass( $row );
 904+ if ( $class === '' ) {
 905+ // Return an empty array to avoid clutter in HTML like class=""
 906+ return array();
 907+ } else {
 908+ return array( 'class' => $this->getRowClass( $row ) );
 909+ }
904910 }
905911
906912 /**
Index: branches/REL1_17/phase3/includes/ImageGallery.php
@@ -275,8 +275,12 @@
276276 $thumbhtml = "\n\t\t\t".'<div style="height: '.(30 + $this->mHeights).'px;">'
277277 . htmlspecialchars( $img->getLastError() ) . '</div>';
278278 } else {
279 - $vpad = floor(( 30 + $this->mHeights - $thumb->height ) /2);
 279+ //We get layout problems with the margin, if the image is smaller
 280+ //than the line-height, so we less margin in these cases.
 281+ $minThumbHeight = $thumb->height > 17 ? $thumb->height : 17;
 282+ $vpad = floor(( 30 + $this->mHeights - $minThumbHeight ) /2);
280283
 284+
281285 $imageParameters = array(
282286 'desc-link' => true,
283287 'desc-query' => $descQuery
@@ -288,11 +292,11 @@
289293
290294 # Set both fixed width and min-height.
291295 $thumbhtml = "\n\t\t\t".
292 - '<div class="thumb" style="width: ' .($this->mWidths+30).'px; height: ' .($this->mHeights+30).'px;">'
 296+ '<div class="thumb" style="width: ' .($this->mWidths+30).'px;">'
293297 # Auto-margin centering for block-level elements. Needed now that we have video
294298 # handlers since they may emit block-level elements as opposed to simple <img> tags.
295299 # ref http://css-discuss.incutio.com/?page=CenteringBlockElement
296 - . '<div style="margin:'.$vpad.'px auto 0;">'
 300+ . '<div style="margin:'.$vpad.'px auto;">'
297301 . $thumb->toHtml( $imageParameters ) . '</div></div>';
298302
299303 // Call parser transform hook
Index: branches/REL1_17/phase3/languages/classes/LanguageWa.php
@@ -25,6 +25,7 @@
2626 ## # "<day> d' <monthname>" for months starting with a vowel
2727 ## #
2828 function date( $ts, $adj = false, $format = true, $tc = false ) {
 29+ $ts = wfTimestamp( TS_MW, $ts );
2930 if ( $adj ) { $ts = $this->userAdjust( $ts, $tc ); }
3031 $datePreference = $this->dateFormat( $format );
3132
Index: branches/REL1_17/phase3/RELEASE-NOTES
@@ -510,6 +510,7 @@
511511 * (bug 26781) {{PAGENAME}} and related parser functions escape their output better.
512512 * (bug 26716) Provide link to instructions for external editor related preferences
513513 and add a comment to the ini control file explaining what is going on.
 514+* (bug 27560) Search queries no longer fail in walloon language
514515
515516 === API changes in 1.17 ===
516517 * BREAKING CHANGE: action=patrol now requires POST
@@ -520,6 +521,8 @@
521522 * (bug 27201) Special:WhatLinksHere output no longer contains duplicate IDs
522523 * (bug 26560) On allusers if limit < total number of users, last user gets duplicate
523524 * (bug 27715) imageinfo didn't respect revdelete
 525+* (bug 27479) API error when using both prop=pageprops and
 526+ prop=info&inprop=displaytitle
524527
525528 * (bug 22738) Allow filtering by action type on query=logevent.
526529 * (bug 22764) uselang parameter for action=parse.
Property changes on: branches/REL1_17/phase3/RELEASE-NOTES
___________________________________________________________________
Modified: svn:mergeinfo
527530 Merged /trunk/phase3/RELEASE-NOTES:r82297,82307,82309,82312,82315,82337,82391-82392,82403,82411,82446,82457,82466,82473,82475,82478,82482,82486

Follow-up revisions

RevisionCommit summaryAuthorDate
r85342MFT r82465, r82468, r82474 (second try), followup to r85211demon17:05, 4 April 2011

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r82297Fix the issue where all links on Special:Contributions where marked as stubs ...platonides21:30, 16 February 2011
r82307Add support for namespace prefixed elements in svg. ie. <svg:svg>...hartman22:45, 16 February 2011
r82309followup r82181 and r82215 to fix the FIXME and botched fix for FIXME....mah23:21, 16 February 2011
r82312* (bug 27479) API error when using both prop=pageprops and prop=info&inprop=d...reedy23:38, 16 February 2011
r82315Reverting r76017 per discussion on Bugzilla. Lack of community consensus for ...soxred9300:30, 17 February 2011
r82337Fix broken Special:Newpages Atom feed.vasilievvv16:29, 17 February 2011
r82391Don't clutter the HTML source with useless class=""raymond11:20, 18 February 2011
r82392(bug 27526) B/C in Special:EmailUserhappy-melon11:27, 18 February 2011
r82403Follow-up r82391 per Nikerabbit's CR: Fix it in a better wayraymond15:14, 18 February 2011
r82411Fix invalid HTML introduced in r68096: Xml::buildForm() adds <table></table> tooraymond18:35, 18 February 2011
r82457(bug 27328) Redo r82218 properly, expanding URLs with absolute pathscatrope14:58, 19 February 2011
r82465Fix logic error in r73204 (!) causing ResourceLoaderContext::getHash() to alw...catrope16:48, 19 February 2011
r82466Follow up r82091, which uses the local file constant SERVICES_JSON_LOOSE_TYPE.platonides16:59, 19 February 2011
r82468(bug 27302) Avoid unnecessary requests for user and site modules if the relev...catrope17:07, 19 February 2011
r82473(Bug #27467) preload can leave UNIQ...mah19:18, 19 February 2011
r82474Revert r74387: it may not fix the IE8 jumping bug in all cases, but it defini...catrope19:21, 19 February 2011
r82475Relaxed the allowed format of parser tag attributes as per bug 27539. One sid...sean_colombo19:25, 19 February 2011
r82478* (bug 27560) Search queries no longer fail in walloon languageialex20:06, 19 February 2011
r82480(Bug 27539) Allow attributes beginning with a digit in wiktext tag parameters....platonides20:16, 19 February 2011
r82482All functions of the importer have $title, origTitle, but processTitle() retu...hartman20:35, 19 February 2011
r82486Don't use getCheck, because the opts array is reused to generate the query fo...hartman21:03, 19 February 2011

Comments

#Comment by Catrope (talk | contribs)   10:05, 3 April 2011

r82465 wasn't merged, retagged.

#Comment by Catrope (talk | contribs)   10:12, 3 April 2011

r82468, r82474 weren't merged, retagged.

#Comment by Catrope (talk | contribs)   10:17, 3 April 2011

r82475, r82480 weren't merged, retagged.

#Comment by 😂 (talk | contribs)   17:06, 4 April 2011

Merged the first 3.

The last two look merged to me, The regexes in both trunk and REL1_17 are $attribFirst = '[:A-Z_a-z0-9]';. I didn't merge anything to tests/phpunit since that was dropped in REL1_17.

Status & tagging log