r81413 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r81412‎ | r81413 | r81414 >
Date:20:45, 2 February 2011
Author:catrope
Status:ok
Tags:
Comment:
1.17: MFT r78395, r79968, r81311, r81313, r81349, r81352, r81376, r81389, r81397, r81399, r81412 (which is really a merge of r80947)
Modified paths:
  • /branches/REL1_17/extensions/ClickTracking/ApiClickTracking.php (modified) (history)
  • /branches/REL1_17/extensions/ClickTracking/ClickTracking.hooks.php (modified) (history)
  • /branches/REL1_17/extensions/CodeReview/ui/CodeRevisionListView.php (modified) (history)
  • /branches/REL1_17/extensions/FlvHandler/FlvHandler.i18n.php (modified) (history)
  • /branches/REL1_17/extensions/OggHandler/OggHandler.i18n.php (modified) (history)
  • /branches/REL1_17/extensions/PagedTiffHandler/PagedTiffHandler.i18n.php (modified) (history)
  • /branches/REL1_17/extensions/TimedMediaHandler/TimedMediaHandler.i18n.php (modified) (history)
  • /branches/REL1_17/extensions/UserDailyContribs/UserDailyContribs.php (modified) (history)
  • /branches/REL1_17/extensions/WikiAtHome/WikiAtHome.i18n.php (modified) (history)
  • /branches/REL1_17/phase3/includes/DefaultSettings.php (modified) (history)
  • /branches/REL1_17/phase3/includes/HTMLForm.php (modified) (history)
  • /branches/REL1_17/phase3/includes/ImagePage.php (modified) (history)
  • /branches/REL1_17/phase3/includes/Pager.php (modified) (history)
  • /branches/REL1_17/phase3/includes/Revision.php (modified) (history)
  • /branches/REL1_17/phase3/includes/installer/MysqlUpdater.php (modified) (history)
  • /branches/REL1_17/phase3/includes/specials/SpecialSearch.php (modified) (history)
  • /branches/REL1_17/phase3/maintenance/archives/patch-langlinks-ll_lang-20.sql (added) (history)

Diff [purge]

Index: branches/REL1_17/extensions/WikiAtHome/WikiAtHome.i18n.php
@@ -20,11 +20,11 @@
2121 'wah-short-video' => '$1 video file, $2',
2222 'wah-short-general' => '$1 media file, $2',
2323
24 - 'wah-long-audio' => '($1 sound file, length $2, $3)',
25 - 'wah-long-video' => '($1 video file, length $2, $4×$5 pixels, $3)',
26 - 'wah-long-multiplexed' => '(multiplexed audio/video file, $1, length $2, $4×$5 pixels, $3 overall)',
27 - 'wah-long-general' => '(media file, length $2, $3)',
28 - 'wah-long-error' => '(ffmpeg could not read this file: $1)',
 24+ 'wah-long-audio' => '$1 sound file, length $2, $3',
 25+ 'wah-long-video' => '$1 video file, length $2, $4×$5 pixels, $3',
 26+ 'wah-long-multiplexed' => 'multiplexed audio/video file, $1, length $2, $4×$5 pixels, $3 overall',
 27+ 'wah-long-general' => 'media file, length $2, $3',
 28+ 'wah-long-error' => 'ffmpeg could not read this file: $1',
2929
3030 'wah-transcode-working' => 'This video is being processed, please try again later',
3131 'wah-transcode-helpout' => 'You can help transcode this video by visiting [[Special:WikiAtHome|Wiki@Home]].',
Index: branches/REL1_17/extensions/CodeReview/ui/CodeRevisionListView.php
@@ -31,13 +31,13 @@
3232
3333 // Check for batch change requests.
3434 $editToken = $wgRequest->getVal( 'wpBatchChangeEditToken' );
35 - if ( $wgRequest->wasPosted() && $wgUser->matchEditToken( $editToken ) ) {
 35+ $revisions = $wgRequest->getArray( 'wpRevisionSelected' );
 36+ if ( $wgRequest->wasPosted() && count( $revisions ) && $wgUser->matchEditToken( $editToken ) ) {
3637 $this->doBatchChange();
3738 return;
3839 }
3940
4041 $pathForm = $this->showForm();
41 - $wgOut->addHTML( $pathForm );
4242
4343 // Get the total count across all pages
4444 $dbr = wfGetDB( DB_SLAVE );
@@ -50,20 +50,23 @@
5151 $wgUser->isAllowed( 'codereview-add-tag' );
5252
5353 $navBar = $pager->getNavigationBar();
54 - $limitForm = $pager->getLimitForm();
5554
 55+ $wgOut->addHTML( $pathForm );
 56+
5657 $wgOut->addHTML(
5758 $navBar .
58 - '<table><tr><td>' . $limitForm . '</td>' .
 59+ '<table><tr><td>' . $pager->getLimitForm() . '</td>' .
5960 '<td>&#160;<strong>' . wfMsgHtml( 'code-rev-total', $wgLang->formatNum( $revCount ) ) . '</strong></td>' .
6061 '</tr></table>' .
6162 Xml::openElement( 'form',
6263 array( 'action' => $pager->getTitle()->getLocalURL(), 'method' => 'post' )
6364 ) .
6465 $pager->getBody() .
65 - $limitForm .
 66+ //$pager->getLimitDropdown() .
6667 $navBar .
67 - ( $this->batchForm ? $this->buildBatchInterface( $pager ) : "" ) .
 68+ ( $this->batchForm ?
 69+ $this->buildBatchInterface( $pager )
 70+ : "" ) .
6871 Xml::closeElement( 'form' )
6972 );
7073
@@ -175,7 +178,7 @@
176179 } else {
177180 $ret .= Html::hidden( 'title', $special->getPrefixedDBKey() ) ;
178181 }
179 - $ret .= "</tr></table></fieldset>" ;
 182+ $ret .= "</tr></table></fieldset></form>" ;
180183
181184 return $ret;
182185 }
@@ -358,4 +361,3 @@
359362 return SpecialPage::getTitleFor( 'Code', $this->mRepo->getName() );
360363 }
361364 }
362 -
Index: branches/REL1_17/extensions/OggHandler/OggHandler.i18n.php
@@ -13,11 +13,11 @@
1414 'ogg-short-audio' => 'Ogg $1 sound file, $2',
1515 'ogg-short-video' => 'Ogg $1 video file, $2',
1616 'ogg-short-general' => 'Ogg $1 media file, $2',
17 - 'ogg-long-audio' => '(Ogg $1 sound file, length $2, $3)',
18 - 'ogg-long-video' => '(Ogg $1 video file, length $2, $4×$5 pixels, $3)',
19 - 'ogg-long-multiplexed' => '(Ogg multiplexed audio/video file, $1, length $2, $4×$5 pixels, $3 overall)',
20 - 'ogg-long-general' => '(Ogg media file, length $2, $3)',
21 - 'ogg-long-error' => '(Invalid ogg file: $1)',
 17+ 'ogg-long-audio' => 'Ogg $1 sound file, length $2, $3',
 18+ 'ogg-long-video' => 'Ogg $1 video file, length $2, $4×$5 pixels, $3',
 19+ 'ogg-long-multiplexed' => 'Ogg multiplexed audio/video file, $1, length $2, $4×$5 pixels, $3 overall',
 20+ 'ogg-long-general' => 'Ogg media file, length $2, $3',
 21+ 'ogg-long-error' => 'Invalid ogg file: $1',
2222 'ogg-play' => 'Play',
2323 'ogg-pause' => 'Pause',
2424 'ogg-stop' => 'Stop',
Index: branches/REL1_17/extensions/FlvHandler/FlvHandler.i18n.php
@@ -13,7 +13,7 @@
1414 */
1515 $messages['en'] = array(
1616 'flvhandler_desc' => 'Allow Flash Video (.flv) files to be added as standard files (e.g. <nowiki>[[</nowiki>{{ns:file}}:Movie.flv<nowiki>]]</nowiki>)',
17 - 'flv-long-desc' => '(Flash Video, $1 × $2 pixels, file size: $3)'
 17+ 'flv-long-desc' => 'Flash Video, $1 × $2 pixels, file size: $3'
1818 );
1919
2020 /** Message documentation (Message documentation)
Index: branches/REL1_17/extensions/ClickTracking/ClickTracking.hooks.php
@@ -87,28 +87,6 @@
8888 }
8989
9090 /**
91 - * Get the number of revisions a user has made since a given time
92 - *
93 - * @param $ts beginning timestamp
94 - * @return number of revsions this user has made
95 - */
96 - public static function getEditCountSince( $ts ) {
97 - global $wgUser;
98 -
99 - // Convert to just the day
100 - $time = gmdate( 'Y-m-d', wfTimestamp( TS_UNIX, $ts ) );
101 - $dbr = wfGetDB( DB_SLAVE );
102 - $edits = $dbr->selectField(
103 - 'user_daily_contribs',
104 - 'SUM(contribs)',
105 - array( 'user_id' => $wgUser->getId(), 'day >= ' . $dbr->addQuotes( $time ) ),
106 - __METHOD__
107 - );
108 - // User hasn't made any edits in whatever amount of time
109 - return $edits == null ? 0 : $edits;
110 - }
111 -
112 - /**
11391 * Get event ID from name
11492 *
11593 * @param $event_name String: name of the event to get
Index: branches/REL1_17/extensions/ClickTracking/ApiClickTracking.php
@@ -39,13 +39,13 @@
4040 $isLoggedIn = $wgUser->isLoggedIn();
4141 $now = time();
4242 $granularity1 = $isLoggedIn ?
43 - ClickTrackingHooks::getEditCountSince( $now - $wgClickTrackContribGranularity1 ) : 0;
 43+ getUserEditCountSince( $now - $wgClickTrackContribGranularity1 ) : 0;
4444
4545 $granularity2 = $isLoggedIn ?
46 - ClickTrackingHooks::getEditCountSince( $now - $wgClickTrackContribGranularity2 ) : 0;
 46+ getUserEditCountSince( $now - $wgClickTrackContribGranularity2 ) : 0;
4747
4848 $granularity3 = $isLoggedIn ?
49 - ClickTrackingHooks::getEditCountSince( $now - $wgClickTrackContribGranularity3 ) : 0;
 49+ getUserEditCountSince( $now - $wgClickTrackContribGranularity3 ) : 0;
5050
5151 ClickTrackingHooks::trackEvent(
5252 $sessionId, // randomly generated session ID
Index: branches/REL1_17/extensions/PagedTiffHandler/PagedTiffHandler.i18n.php
@@ -28,7 +28,7 @@
2929 'tiff_size_error' => 'The reported file size does not match the actual file size.',
3030 'tiff_script_detected' => 'The uploaded file contains scripts.',
3131 'tiff_bad_file' => 'The uploaded file contains errors: $1',
32 - 'tiff-file-info-size' => '(page $5, $1 × $2 pixel, file size: $3, MIME type: $4)',
 32+ 'tiff-file-info-size' => 'page $5, $1 × $2 pixel, file size: $3, MIME type: $4',
3333 );
3434
3535 /** Message documentation (Message documentation)
Index: branches/REL1_17/extensions/UserDailyContribs/UserDailyContribs.php
@@ -28,3 +28,30 @@
2929 $wgHooks['LoadExtensionSchemaUpdates'][] = 'UserDailyContribsHooks::loadExtensionSchemaUpdates';
3030 $wgHooks['ArticleSaveComplete'][] = 'UserDailyContribsHooks::articleSaveComplete';
3131 $wgHooks['ParserTestTables'][] = 'UserDailyContribsHooks::parserTestTables';
 32+
 33+/**
 34+ * Get the number of revisions a user has made since a given time
 35+ *
 36+ * @param $time beginning timestamp
 37+ * @return number of revsions this user has made
 38+ */
 39+function getUserEditCountSince( $time = null, User $user = null ) {
 40+ global $wgUser;
 41+
 42+ // Fallback on current user
 43+ if ( is_null( $user ) ) {
 44+ $user = $wgUser;
 45+ }
 46+ // Round time down to a whole day
 47+ $time = gmdate( 'Y-m-d', wfTimestamp( TS_UNIX, $time ) );
 48+ // Query the user contribs table
 49+ $dbr = wfGetDB( DB_SLAVE );
 50+ $edits = $dbr->selectField(
 51+ 'user_daily_contribs',
 52+ 'SUM(contribs)',
 53+ array( 'user_id' => $user->getId(), 'day >= ' . $dbr->addQuotes( $time ) ),
 54+ __METHOD__
 55+ );
 56+ // Return edit count as an integer
 57+ return is_null( $edits ) ? 0 : (integer) $edits;
 58+}
Index: branches/REL1_17/extensions/TimedMediaHandler/TimedMediaHandler.i18n.php
@@ -13,11 +13,11 @@
1414 'timedmedia-short-audio' => 'Ogg $1 sound file, $2',
1515 'timedmedia-short-video' => 'Ogg $1 video file, $2',
1616 'timedmedia-short-general' => 'Ogg $1 media file, $2',
17 - 'timedmedia-long-audio' => '(Ogg $1 sound file, length $2, $3)',
18 - 'timedmedia-long-video' => '(Ogg $1 video file, length $2, $4×$5 pixels, $3)',
19 - 'timedmedia-long-multiplexed' => '(Ogg multiplexed audio/video file, $1, length $2, $4×$5 pixels, $3 overall)',
20 - 'timedmedia-long-general' => '(Ogg media file, length $2, $3)',
21 - 'timedmedia-long-error' => '(Invalid Ogg file: $1)',
 17+ 'timedmedia-long-audio' => 'Ogg $1 sound file, length $2, $3',
 18+ 'timedmedia-long-video' => 'Ogg $1 video file, length $2, $4×$5 pixels, $3',
 19+ 'timedmedia-long-multiplexed' => 'Ogg multiplexed audio/video file, $1, length $2, $4×$5 pixels, $3 overall',
 20+ 'timedmedia-long-general' => 'Ogg media file, length $2, $3',
 21+ 'timedmedia-long-error' => 'Invalid Ogg file: $1',
2222 'timedmedia-no-player-js' => 'Sorry, your browser either has JavaScript disabled or does not have any supported player.<br />
2323 You can <a href="$1">download the clip</a> or <a href="http://www.mediawiki.org/wiki/Extension:OggHandler/Client_download">download a player</a> to play the clip in your browser.',
2424
Index: branches/REL1_17/phase3/maintenance/archives/patch-langlinks-ll_lang-20.sql
@@ -0,0 +1,3 @@
 2+ALTER TABLE /*$wgDBprefix*/langlinks
 3+ MODIFY `ll_lang`
 4+ VARBINARY(20) NOT NULL DEFAULT '';
\ No newline at end of file
Property changes on: branches/REL1_17/phase3/maintenance/archives/patch-langlinks-ll_lang-20.sql
___________________________________________________________________
Added: svn:eol-style
15 + native
Index: branches/REL1_17/phase3/includes/ImagePage.php
@@ -330,7 +330,7 @@
331331 $height_orig = $this->displayImg->getHeight( $page );
332332 $height = $height_orig;
333333
334 - $longDesc = wfMsgExt( 'parentheses', 'parseinline', $this->displayImg->getLongDesc() );
 334+ $longDesc = wfMsg( 'parentheses', $this->displayImg->getLongDesc() );
335335
336336 wfRunHooks( 'ImageOpenShowImageInlineBefore', array( &$this, &$wgOut ) );
337337
Index: branches/REL1_17/phase3/includes/HTMLForm.php
@@ -471,7 +471,11 @@
472472 function getErrors( $errors ) {
473473 if ( $errors instanceof Status ) {
474474 global $wgOut;
475 - $errorstr = $wgOut->parse( $errors->getWikiText() );
 475+ if ( $errors->isOK() ) {
 476+ $errorstr = '';
 477+ } else {
 478+ $errorstr = $wgOut->parse( $errors->getWikiText() );
 479+ }
476480 } elseif ( is_array( $errors ) ) {
477481 $errorstr = $this->formatErrors( $errors );
478482 } else {
Property changes on: branches/REL1_17/phase3/includes/HTMLForm.php
___________________________________________________________________
Modified: svn:mergeinfo
479483 Merged /trunk/phase3/includes/HTMLForm.php:r78395,79968,81311,81313,81349,81352,81376,81389,81397,81399,81412
Index: branches/REL1_17/phase3/includes/installer/MysqlUpdater.php
@@ -173,6 +173,7 @@
174174 array( 'addTable', 'module_deps', 'patch-module_deps.sql' ),
175175 array( 'dropIndex', 'archive', 'ar_page_revid', 'patch-archive_kill_ar_page_revid.sql' ),
176176 array( 'addIndex', 'archive', 'ar_revid', 'patch-archive_ar_revid.sql' ),
 177+ array( 'doLangLinksLengthUpdate' ),
177178 );
178179 }
179180
@@ -815,4 +816,18 @@
816817 $this->applyPatch( 'patch-categorylinks-better-collation2.sql' );
817818 $this->output( "done.\n" );
818819 }
 820+
 821+ protected function doLangLinksLengthUpdate() {
 822+ $langlinks = $this->db->tableName( 'langlinks' );
 823+ $res = $this->db->query( "SHOW COLUMNS FROM $langlinks LIKE 'll_lang'" );
 824+ $row = $this->db->fetchObject( $res );
 825+
 826+ if ( $row && $row->Type == "varbinary(10)" ) {
 827+ $this->output( 'Updating length of ll_lang in langlinks...' );
 828+ $this->applyPatch( 'patch-langlinks-ll_lang-20.sql' );
 829+ $this->output( "done.\n" );
 830+ } else {
 831+ $this->output( "...ll_lang is up-to-date.\n" );
 832+ }
 833+ }
819834 }
Property changes on: branches/REL1_17/phase3/includes/installer/MysqlUpdater.php
___________________________________________________________________
Modified: svn:mergeinfo
820835 Merged /trunk/phase3/includes/installer/MysqlUpdater.php:r78395,79968,81311,81313,81349,81352,81376,81389,81397,81399,81412
Index: branches/REL1_17/phase3/includes/Revision.php
@@ -82,6 +82,9 @@
8383 if ( isset( $row->ar_text ) && !$row->ar_text_id ) {
8484 // Pre-1.5 ar_text row
8585 $attribs['text'] = self::getRevisionText( $row, 'ar_' );
 86+ if ( $attribs['text'] === false ) {
 87+ throw new MWException( 'Unable to load text from archive row (possibly bug 22624)' );
 88+ }
8689 }
8790 return new self( $attribs );
8891 }
Property changes on: branches/REL1_17/phase3/includes/Revision.php
___________________________________________________________________
Added: svn:mergeinfo
8992 Merged /branches/sqlite/includes/Revision.php:r58211-58321
9093 Merged /trunk/phase3/includes/Revision.php:r78395,79968,81311,81313,81349,81352,81376,81389,81397,81399,81412
9194 Merged /branches/new-installer/phase3/includes/Revision.php:r43664-66004
9295 Merged /branches/wmf-deployment/includes/Revision.php:r53381
9396 Merged /branches/REL1_15/phase3/includes/Revision.php:r51646
9497 Merged /branches/wmf/1.16wmf4/includes/Revision.php:r80947
Index: branches/REL1_17/phase3/includes/DefaultSettings.php
@@ -539,9 +539,16 @@
540540 # A ZIP file may be a valid Java archive containing an applet which exploits the
541541 # same-origin policy to steal cookies
542542 'application/zip',
 543+
543544 # MS Office OpenXML and other Open Package Conventions files are zip files
544 - # and thus blacklisted just as other zip files
 545+ # and thus blacklisted just as other zip files. If you remove these entries
 546+ # from the blacklist in your local configuration, a malicious file upload
 547+ # will be able to compromise the wiki's user accounts, and the user
 548+ # accounts of any other website in the same cookie domain.
545549 'application/x-opc+zip',
 550+ 'application/msword',
 551+ 'application/vnd.ms-powerpoint',
 552+ 'application/vnd.msexcel',
546553 );
547554
548555 /**
Property changes on: branches/REL1_17/phase3/includes/DefaultSettings.php
___________________________________________________________________
Modified: svn:mergeinfo
549556 Merged /trunk/phase3/includes/DefaultSettings.php:r78395,79968,81311,81313,81349,81352,81376,81389,81397,81399,81412
Index: branches/REL1_17/phase3/includes/specials/SpecialSearch.php
@@ -587,7 +587,7 @@
588588 if( $img ) {
589589 $thumb = $img->transform( array( 'width' => 120, 'height' => 120 ) );
590590 if( $thumb ) {
591 - $desc = wfMsgExt( 'parentheses', 'parseinline', $img->getShortDesc() );
 591+ $desc = wfMsg( 'parentheses', $img->getShortDesc() );
592592 wfProfileOut( __METHOD__ );
593593 // Float doesn't seem to interact well with the bullets.
594594 // Table messes up vertical alignment of the bullets.
Property changes on: branches/REL1_17/phase3/includes/specials/SpecialSearch.php
___________________________________________________________________
Modified: svn:mergeinfo
595595 Merged /trunk/phase3/includes/specials/SpecialSearch.php:r78395,79968,81311,81313,81349,81352,81376,81389,81397,81399,81412
Index: branches/REL1_17/phase3/includes/Pager.php
@@ -1047,20 +1047,26 @@
10481048 function getLimitForm() {
10491049 global $wgScript;
10501050
 1051+ return Xml::openElement(
 1052+ 'form',
 1053+ array(
 1054+ 'method' => 'get',
 1055+ 'action' => $wgScript
 1056+ ) ) . "\n" . $this->getLimitDropdown() . "</form>\n";
 1057+ }
 1058+
 1059+ /**
 1060+ * Gets a limit selection dropdown
 1061+ *
 1062+ * @return string
 1063+ */
 1064+ function getLimitDropdown() {
10511065 # Make the select with some explanatory text
10521066 $msgSubmit = wfMsgHtml( 'table_pager_limit_submit' );
1053 - return
1054 - Xml::openElement(
1055 - 'form',
1056 - array(
1057 - 'method' => 'get',
1058 - 'action' => $wgScript
1059 - )
1060 - ) . "\n" .
1061 - wfMsgHtml( 'table_pager_limit', $this->getLimitSelect() ) .
 1067+
 1068+ return wfMsgHtml( 'table_pager_limit', $this->getLimitSelect() ) .
10621069 "\n<input type=\"submit\" value=\"$msgSubmit\"/>\n" .
1063 - $this->getHiddenFields( array( 'limit' ) ) .
1064 - "</form>\n";
 1070+ $this->getHiddenFields( array( 'limit' ) );
10651071 }
10661072
10671073 /**

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r78395Fixup fixme on r76844...reedy18:17, 14 December 2010
r79968Update extensions to use the new style getLongDesc() of r79964hartman22:30, 10 January 2011
r809471.16wmf4: Commit live hack: throw exception when text couldn't be loaded from...catrope00:27, 25 January 2011
r81311For bug 24129 and a followup to r23239, there was never a patch to transfer f...reedy18:35, 1 February 2011
r81313Followup r81311, add MysqlUpdater function to update ll_lang length if it's s...reedy18:58, 1 February 2011
r81349Added global getUserEditCountSince function so extensions don't have to copy-...tparscal23:22, 1 February 2011
r81352Made use of new getUserEditCountSince function introduced in r81349.tparscal23:23, 1 February 2011
r81376Blacklist ZIP subtypes added in r68873, to avoid GIFAR.tstarling05:35, 2 February 2011
r81389Follow-up r79964: Fix double parsing of file infobtongminh14:07, 2 February 2011
r81397Follow-up r77640: Check whether there are errors before asking Status to tran...btongminh15:44, 2 February 2011
r81399Followup r81313, fix 210 typoreedy15:48, 2 February 2011
r81412Merge r80947 from 1.16wmf4 to trunk: throw exception when text couldn't be lo...catrope20:25, 2 February 2011

Status & tagging log