r114015 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r114014‎ | r114015 | r114016 >
Date:15:18, 16 March 2012
Author:reedy
Status:ok
Tags:
Comment:
Modified paths:
  • /branches/REL1_19/phase3 (modified) (history)
  • /branches/REL1_19/phase3/RELEASE-NOTES-1.19 (modified) (history)
  • /branches/REL1_19/phase3/includes (modified) (history)
  • /branches/REL1_19/phase3/includes/OutputPage.php (modified) (history)
  • /branches/REL1_19/phase3/includes/filerepo/file/LocalFile.php (modified) (history)
  • /branches/REL1_19/phase3/includes/resourceloader/ResourceLoaderModule.php (modified) (history)
  • /branches/REL1_19/phase3/includes/resourceloader/ResourceLoaderWikiModule.php (modified) (history)
  • /branches/REL1_19/phase3/includes/specials (modified) (history)
  • /branches/REL1_19/phase3/includes/specials/SpecialCategories.php (modified) (history)
  • /branches/REL1_19/phase3/includes/specials/SpecialNewpages.php (modified) (history)
  • /branches/REL1_19/phase3/includes/specials/SpecialUndelete.php (modified) (history)
  • /branches/REL1_19/phase3/languages (modified) (history)
  • /branches/REL1_19/phase3/languages/messages/MessagesEn.php (modified) (history)
  • /branches/REL1_19/phase3/languages/messages/MessagesQqq.php (modified) (history)
  • /branches/REL1_19/phase3/resources/jquery/jquery.textSelection.js (modified) (history)
  • /branches/REL1_19/phase3/resources/mediawiki.action/mediawiki.action.watch.ajax.js (modified) (history)
  • /branches/REL1_19/phase3/resources/mediawiki/mediawiki.util.js (modified) (history)

Diff [purge]

Index: branches/REL1_19/phase3/RELEASE-NOTES-1.19
@@ -271,8 +271,13 @@
272272 * (bug 28936, bug 5280) Broken or invalid titles can't be removed from watchlist.
273273 * (bug 34600) Older skins using useHeadElement=false were broken in 1.18.
274274 * (bug 34604) [mw.config] wgActionPaths should be an object instead of a numeral
275 - array.
276 -* (bug 12262) Indents and lists are now aligned
 275+ array.* (bug 12262) Indents and lists are now aligned
 276+* (bug 29753) mw.util.tooltipAccessKeyPrefix should be alt-shift for Chrome
 277+ on Windows
 278+* (bug 25095) Special:Categories should also include the first relevant item
 279+ when "from" is filled.
 280+* (bug 34972) An error occurred while changing your watchlist settings for
 281+ [[Special:WhatLinksHere/Example]]
277282
278283 === API changes in 1.19 ===
279284 * Made action=edit less likely to return "unknownerror", by returning the actual error
@@ -309,6 +314,8 @@
310315 calling action=purge&forcelinkupdate.
311316 * (bug 34377) action=watch now parses messages using the correct title instead
312317 of "API".
 318+* (bug 35036) WikiLove messages were not automatically updated in JavaScript
 319+ after having been changed on-wiki due to a bug in core
313320
314321 === Languages updated in 1.19 ===
315322
Index: branches/REL1_19/phase3/includes/filerepo/file/LocalFile.php
@@ -907,7 +907,10 @@
908908 $this->lock(); // begin
909909 $status = $this->publish( $srcPath, $flags );
910910
911 - if ( $status->ok ) {
 911+ if ( $status->successCount > 0 ) {
 912+ # Essentially we are displacing any existing current file and saving
 913+ # a new current file at the old location. If just the first succeeded,
 914+ # we still need to displace the current DB entry and put in a new one.
912915 if ( !$this->recordUpload2( $status->value, $comment, $pageText, $props, $timestamp, $user ) ) {
913916 $status->fatal( 'filenotfound', $srcPath );
914917 }
@@ -1004,8 +1007,12 @@
10051008 );
10061009
10071010 if ( $dbw->affectedRows() == 0 ) {
1008 - if ( $oldver == '' ) {
1009 - throw new MWException( "Empty oi_archive_name. Database and storage out of sync?" );
 1011+ if ( $oldver == '' ) { // XXX
 1012+ # (bug 34993) publish() can displace the current file and yet fail to save
 1013+ # a new one. The next publish attempt will treat the file as a brand new file
 1014+ # and pass an empty $oldver. Allow this bogus value so we can displace the
 1015+ # `image` row to `oldimage`, leaving room for the new current file `image` row.
 1016+ #throw new MWException( "Empty oi_archive_name. Database and storage out of sync?" );
10101017 }
10111018 $reupload = true;
10121019 # Collision, this is an update of a file
Index: branches/REL1_19/phase3/includes/OutputPage.php
@@ -2839,6 +2839,10 @@
28402840 $ns = $title->getNamespace();
28412841 $nsname = MWNamespace::exists( $ns ) ? MWNamespace::getCanonicalName( $ns ) : $title->getNsText();
28422842
 2843+ // Get the relevant title so that AJAX features can use the correct page name
 2844+ // when making API requests from certain special pages (bug 34972).
 2845+ $relevantTitle = $this->getSkin()->getRelevantTitle();
 2846+
28432847 if ( $ns == NS_SPECIAL ) {
28442848 list( $canonicalName, /*...*/ ) = SpecialPageFactory::resolveAlias( $title->getDBkey() );
28452849 } elseif ( $this->canUseWikiPage() ) {
@@ -2880,6 +2884,7 @@
28812885 'wgPageContentLanguage' => $lang->getCode(),
28822886 'wgSeparatorTransformTable' => $compactSeparatorTransTable,
28832887 'wgDigitTransformTable' => $compactDigitTransTable,
 2888+ 'wgRelevantPageName' => $relevantTitle->getPrefixedDBKey(),
28842889 );
28852890 if ( $lang->hasVariants() ) {
28862891 $vars['wgUserVariant'] = $lang->getPreferredVariant();
Property changes on: branches/REL1_19/phase3/includes/OutputPage.php
___________________________________________________________________
Modified: svn:mergeinfo
28872892 Merged /trunk/phase3/includes/OutputPage.php:r113737,113758
Index: branches/REL1_19/phase3/includes/resourceloader/ResourceLoaderModule.php
@@ -357,6 +357,10 @@
358358 * timestamps. Whenever anything happens that changes the module's
359359 * contents for these parameters, the mtime should increase.
360360 *
 361+ * NOTE: The mtime of the module's messages is NOT automatically included.
 362+ * If you want this to happen, you'll need to call getMsgBlobMtime()
 363+ * yourself and take its result into consideration.
 364+ *
361365 * @param $context ResourceLoaderContext: Context object
362366 * @return Integer: UNIX timestamp
363367 */
Index: branches/REL1_19/phase3/includes/resourceloader/ResourceLoaderWikiModule.php
@@ -157,6 +157,7 @@
158158 if ( count( $mtimes ) ) {
159159 $modifiedTime = max( $modifiedTime, max( $mtimes ) );
160160 }
 161+ $modifiedTime = max( $modifiedTime, $this->getMsgBlobMtime( $context->getLanguage() ) );
161162 return $modifiedTime;
162163 }
163164
Index: branches/REL1_19/phase3/includes/specials/SpecialUndelete.php
@@ -405,13 +405,12 @@
406406 $article->loadPageData( 'fromdbmaster' );
407407 $oldcountable = $article->isCountable();
408408
409 - $options = 'FOR UPDATE'; // lock page
410409 $page = $dbw->selectRow( 'page',
411410 array( 'page_id', 'page_latest' ),
412411 array( 'page_namespace' => $this->title->getNamespace(),
413412 'page_title' => $this->title->getDBkey() ),
414413 __METHOD__,
415 - $options
 414+ array( 'FOR UPDATE' ) // lock page
416415 );
417416 if( $page ) {
418417 $makepage = false;
Index: branches/REL1_19/phase3/includes/specials/SpecialNewpages.php
@@ -356,7 +356,14 @@
357357
358358 $css = count( $classes ) ? ' class="' . implode( ' ', $classes ) . '"' : '';
359359
360 - return "<li{$css}>{$time} {$dm}{$plink} {$hist} {$dm}{$length} {$dm}{$ulink} {$comment} {$tagDisplay}</li>\n";
 360+ # Display the old title if the namespace has been changed
 361+ $oldTitleText = '';
 362+ if ( $result->page_namespace !== $result->rc_namespace ) {
 363+ $oldTitleText = wfMessage( 'rc-old-title' )->params( Title::makeTitle( $result->rc_namespace, $result->rc_title )
 364+ ->getPrefixedText() )->escaped();
 365+ }
 366+
 367+ return "<li{$css}>{$time} {$dm}{$plink} {$hist} {$dm}{$length} {$dm}{$ulink} {$comment} {$tagDisplay} {$oldTitleText}</li>\n";
361368 }
362369
363370 /**
Index: branches/REL1_19/phase3/includes/specials/SpecialCategories.php
@@ -59,12 +59,16 @@
6060 * @ingroup SpecialPage Pager
6161 */
6262 class CategoryPager extends AlphabeticPager {
 63+ private $conds = array( 'cat_pages > 0' );
 64+
6365 function __construct( IContextSource $context, $from ) {
6466 parent::__construct( $context );
6567 $from = str_replace( ' ', '_', $from );
6668 if( $from !== '' ) {
6769 $from = Title::capitalize( $from, NS_CATEGORY );
68 - $this->mOffset = $from;
 70+ $dbr = wfGetDB( DB_SLAVE );
 71+ $this->conds[] = 'cat_title >= ' . $dbr->addQuotes( $from );
 72+ $this->setOffset( '' );
6973 }
7074 }
7175
@@ -72,7 +76,7 @@
7377 return array(
7478 'tables' => array( 'category' ),
7579 'fields' => array( 'cat_title','cat_pages' ),
76 - 'conds' => array( 'cat_pages > 0' ),
 80+ 'conds' => $this->conds,
7781 'options' => array( 'USE INDEX' => 'cat_title' ),
7882 );
7983 }
Property changes on: branches/REL1_19/phase3/includes/specials
___________________________________________________________________
Modified: svn:mergeinfo
8084 Merged /trunk/phase3/includes/specials:r112918,113214,113268,113277,113312,113415,113454,113737,113758,113892
Property changes on: branches/REL1_19/phase3/includes
___________________________________________________________________
Modified: svn:mergeinfo
8185 Merged /trunk/phase3/includes:r112918,113214,113268,113277,113312,113415,113454,113737,113758,113892
Index: branches/REL1_19/phase3/languages/messages/MessagesQqq.php
@@ -1790,6 +1790,7 @@
17911791 Does not work under $wgMiserMode ([[mwr:48986|r48986]]).',
17921792 'rc-change-size-new' => 'Tooltip when hovering a change list diff size. The tooltip shows the resulting new size in bytes.',
17931793 'newsectionsummary' => 'Default summary when adding a new section to a page.',
 1794+'rc-old-title' => 'Text that shows the original title of a page, $1 is the original title text',
17941795
17951796 # Recent changes linked
17961797 'recentchangeslinked' => 'Title of [[Special:RecentChangesLinked]] and display name of page on [[Special:SpecialPages]].',
Index: branches/REL1_19/phase3/languages/messages/MessagesEn.php
@@ -2066,6 +2066,7 @@
20672067 'newsectionsummary' => '/* $1 */ new section',
20682068 'rc-enhanced-expand' => 'Show details (requires JavaScript)',
20692069 'rc-enhanced-hide' => 'Hide details',
 2070+'rc-old-title' => 'originally created as "$1"',
20702071
20712072 # Recent changes linked
20722073 'recentchangeslinked' => 'Related changes',
Property changes on: branches/REL1_19/phase3/languages
___________________________________________________________________
Modified: svn:mergeinfo
20732074 Merged /trunk/phase3/languages:r112918,113214,113268,113277,113312,113415,113454,113737,113758
Index: branches/REL1_19/phase3/resources/jquery/jquery.textSelection.js
@@ -131,8 +131,58 @@
132132 var isSample = false;
133133 if ( this.style.display == 'none' ) {
134134 // Do nothing
 135+ } else if ( document.selection && document.selection.createRange ) {
 136+ // IE
 137+
 138+ // Note that IE9 will trigger the next section unless we check this first.
 139+ // See bug 35201.
 140+
 141+ activateElementOnIE( this );
 142+ if ( context ) {
 143+ context.fn.restoreCursorAndScrollTop();
 144+ }
 145+ if ( options.selectionStart !== undefined ) {
 146+ $(this).textSelection( 'setSelection', { 'start': options.selectionStart, 'end': options.selectionEnd } );
 147+ }
 148+
 149+ var selText = $(this).textSelection( 'getSelection' );
 150+ var scrollTop = this.scrollTop;
 151+ var range = document.selection.createRange();
 152+
 153+ checkSelectedText();
 154+ var insertText = pre + selText + post;
 155+ if ( options.splitlines ) {
 156+ insertText = doSplitLines( selText, pre, post );
 157+ }
 158+ if ( options.ownline && range.moveStart ) {
 159+ var range2 = document.selection.createRange();
 160+ range2.collapse();
 161+ range2.moveStart( 'character', -1 );
 162+ // FIXME: Which check is correct?
 163+ if ( range2.text != "\r" && range2.text != "\n" && range2.text != "" ) {
 164+ insertText = "\n" + insertText;
 165+ pre += "\n";
 166+ }
 167+ var range3 = document.selection.createRange();
 168+ range3.collapse( false );
 169+ range3.moveEnd( 'character', 1 );
 170+ if ( range3.text != "\r" && range3.text != "\n" && range3.text != "" ) {
 171+ insertText += "\n";
 172+ post += "\n";
 173+ }
 174+ }
 175+
 176+ range.text = insertText;
 177+ if ( isSample && options.selectPeri && range.moveStart ) {
 178+ range.moveStart( 'character', - post.length - selText.length );
 179+ range.moveEnd( 'character', - post.length );
 180+ }
 181+ range.select();
 182+ // Restore the scroll position
 183+ this.scrollTop = scrollTop;
135184 } else if ( this.selectionStart || this.selectionStart == '0' ) {
136185 // Mozilla/Opera
 186+
137187 $(this).focus();
138188 if ( options.selectionStart !== undefined ) {
139189 $(this).textSelection( 'setSelection', { 'start': options.selectionStart, 'end': options.selectionEnd } );
@@ -182,51 +232,6 @@
183233 this.selectionStart = startPos + insertText.length;
184234 this.selectionEnd = this.selectionStart;
185235 }
186 - } else if ( document.selection && document.selection.createRange ) {
187 - // IE
188 - activateElementOnIE( this );
189 - if ( context ) {
190 - context.fn.restoreCursorAndScrollTop();
191 - }
192 - if ( options.selectionStart !== undefined ) {
193 - $(this).textSelection( 'setSelection', { 'start': options.selectionStart, 'end': options.selectionEnd } );
194 - }
195 -
196 - var selText = $(this).textSelection( 'getSelection' );
197 - var scrollTop = this.scrollTop;
198 - var range = document.selection.createRange();
199 -
200 - checkSelectedText();
201 - var insertText = pre + selText + post;
202 - if ( options.splitlines ) {
203 - insertText = doSplitLines( selText, pre, post );
204 - }
205 - if ( options.ownline && range.moveStart ) {
206 - var range2 = document.selection.createRange();
207 - range2.collapse();
208 - range2.moveStart( 'character', -1 );
209 - // FIXME: Which check is correct?
210 - if ( range2.text != "\r" && range2.text != "\n" && range2.text != "" ) {
211 - insertText = "\n" + insertText;
212 - pre += "\n";
213 - }
214 - var range3 = document.selection.createRange();
215 - range3.collapse( false );
216 - range3.moveEnd( 'character', 1 );
217 - if ( range3.text != "\r" && range3.text != "\n" && range3.text != "" ) {
218 - insertText += "\n";
219 - post += "\n";
220 - }
221 - }
222 -
223 - range.text = insertText;
224 - if ( isSample && options.selectPeri && range.moveStart ) {
225 - range.moveStart( 'character', - post.length - selText.length );
226 - range.moveEnd( 'character', - post.length );
227 - }
228 - range.select();
229 - // Restore the scroll position
230 - this.scrollTop = scrollTop;
231236 }
232237 $(this).trigger( 'encapsulateSelection', [ options.pre, options.peri, options.post, options.ownline,
233238 options.replace, options.spitlines ] );
Index: branches/REL1_19/phase3/resources/mediawiki.action/mediawiki.action.watch.ajax.js
@@ -5,6 +5,11 @@
66 ( function ( $, mw, undefined ) {
77
88 /**
 9+ * The name of the page to watch or unwatch.
 10+ */
 11+var title = mw.config.get( 'wgRelevantPageName', mw.config.get( 'wgPageName' ) );
 12+
 13+/**
914 * Update the link text, link href attribute and (if applicable)
1015 * "loading" class.
1116 *
@@ -24,7 +29,7 @@
2530 ( accesskeyTip ? ' ' + accesskeyTip[0] : '' )
2631 )
2732 .attr( 'href', mw.util.wikiScript() + '?' + $.param({
28 - title: mw.config.get( 'wgPageName' ),
 33+ title: title,
2934 action: action
3035 })
3136 );
@@ -98,7 +103,7 @@
99104
100105 api = new mw.Api();
101106 api[action](
102 - mw.config.get( 'wgPageName' ),
 107+ title,
103108 // Success
104109 function( watchResponse ) {
105110 var otherAction = action === 'watch' ? 'unwatch' : 'watch',
@@ -129,10 +134,10 @@
130135 updateWatchLink( $link, action );
131136
132137 // Format error message
133 - var cleanTitle = mw.config.get( 'wgPageName' ).replace( /_/g, ' ' );
 138+ var cleanTitle = title.replace( /_/g, ' ' );
134139 var link = mw.html.element(
135140 'a', {
136 - 'href': mw.util.wikiGetlink( mw.config.get( 'wgPageName' ) ),
 141+ 'href': mw.util.wikiGetlink( title ),
137142 'title': cleanTitle
138143 }, cleanTitle
139144 );
Index: branches/REL1_19/phase3/resources/mediawiki/mediawiki.util.js
@@ -29,10 +29,20 @@
3030
3131 // Chrome on any platform
3232 } else if ( profile.name === 'chrome' ) {
33 - // Chrome on Mac or Chrome on other platform ?
34 - util.tooltipAccessKeyPrefix = ( profile.platform === 'mac'
35 - ? 'ctrl-option-' : 'alt-' );
3633
 34+ util.tooltipAccessKeyPrefix = (
 35+ profile.platform === 'mac'
 36+ // Chrome on Mac
 37+ ? 'ctrl-option-'
 38+ : profile.platform === 'win'
 39+ // Chrome on Windows
 40+ // (both alt- and alt-shift work, but alt-f triggers Chrome wrench menu
 41+ // which alt-shift-f does not)
 42+ ? 'alt-shift-'
 43+ // Chrome on other (Ubuntu?)
 44+ : 'alt-'
 45+ );
 46+
3747 // Non-Windows Safari with webkit_version > 526
3848 } else if ( profile.platform !== 'win'
3949 && profile.name === 'safari'
Property changes on: branches/REL1_19/phase3
___________________________________________________________________
Modified: svn:mergeinfo
4050 Merged /trunk/phase3:r112918,113214,113268,113277,113312,113415,113454,113737,113758,113775,113892

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r112918fix for bug34781 - display old title text if the namespace has been changedbsitu20:58, 2 March 2012
r113214[mw.util.tooltipAccessKeyPrefix] alt-shift for Chrome on Windows...krinkle02:58, 7 March 2012
r113268Follows-up r113214: span ternary operator over multiple lines for readabilitykrinkle19:00, 7 March 2012
r113277(bug 35036) Wikipage-based ResourceLoader modules were not automatically purg...catrope19:33, 7 March 2012
r113312[FileRepo]...aaron22:46, 7 March 2012
r113415(bug 25095) Special:Categories doesn't show first relevant item when "from" i...maxsem22:51, 8 March 2012
r113454release-notes (rr113415)krinkle05:40, 9 March 2012
r113737User:PleaseStand patch fixes bug 34972rmoen17:57, 13 March 2012
r113758moved release notes for r113737 to 1.19 (a 1.19-regression fix)...krinkle20:22, 13 March 2012
r113775* (bug 35201) Edit buttons no longer cause jump in IE 9...brion22:38, 13 March 2012
r113892Fixed 'Illegal string offset 'LIMIT' in <b>C:\wamp\www\MediaWiki\includes\db\...aaron04:34, 15 March 2012

Status & tagging log