r84420 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r84419‎ | r84420 | r84421 >
Date:21:04, 20 March 2011
Author:catrope
Status:ok
Tags:
Comment:
Modified paths:
  • /branches/wmf/1.17wmf1/RELEASE-NOTES (modified) (history)
  • /branches/wmf/1.17wmf1/extensions/LiquidThreads/classes/Dispatch.php (modified) (history)
  • /branches/wmf/1.17wmf1/extensions/LiquidThreads/classes/Hooks.php (modified) (history)
  • /branches/wmf/1.17wmf1/extensions/Renameuser/Renameuser_body.php (modified) (history)
  • /branches/wmf/1.17wmf1/extensions/Vector/Vector.hooks.php (modified) (history)
  • /branches/wmf/1.17wmf1/extensions/Vector/Vector.php (modified) (history)
  • /branches/wmf/1.17wmf1/extensions/Vector/modules/ext.vector.simpleSearch.js (modified) (history)
  • /branches/wmf/1.17wmf1/extensions/WikiEditor/WikiEditor.hooks.php (modified) (history)
  • /branches/wmf/1.17wmf1/extensions/WikiEditor/WikiEditor.php (modified) (history)
  • /branches/wmf/1.17wmf1/includes/PrefixSearch.php (modified) (history)
  • /branches/wmf/1.17wmf1/includes/job/JobQueue.php (modified) (history)
  • /branches/wmf/1.17wmf1/includes/specials/SpecialListfiles.php (modified) (history)
  • /branches/wmf/1.17wmf1/includes/specials/SpecialUpload.php (modified) (history)
  • /branches/wmf/1.17wmf1/includes/upload/UploadBase.php (modified) (history)
  • /branches/wmf/1.17wmf1/resources/jquery/jquery.placeholder.js (modified) (history)
  • /branches/wmf/1.17wmf1/skins/common/shared.css (modified) (history)

Diff [purge]

Property changes on: branches/wmf/1.17wmf1/skins/common/shared.css
___________________________________________________________________
Modified: svn:mergeinfo
11 Merged /trunk/phase3/skins/common/shared.css:r83586-83587,83817,83876,83979,84118,84228
Index: branches/wmf/1.17wmf1/extensions/LiquidThreads/classes/Dispatch.php
@@ -74,7 +74,7 @@
7575 $viewname = 'ThreadHistoricalRevisionView';
7676 } else if ( $action == 'watch' || $action == 'unwatch' ) {
7777 $viewname = 'ThreadWatchView';
78 - } elseif ( $action == 'delete' ) {
 78+ } elseif ( $action == 'delete' || $action == 'rollback' || $action == 'markpatrolled' ) {
7979 return true;
8080 } else {
8181 $viewname = 'ThreadPermalinkView';
Index: branches/wmf/1.17wmf1/extensions/LiquidThreads/classes/Hooks.php
@@ -452,16 +452,13 @@
453453 return true;
454454 }
455455
456 - LqtView::postEditUpdates(
457 - 'editExisting',
458 - null,
459 - $article,
460 - $thread->article(),
461 - $thread->article(),
462 - $summary,
463 - $thread,
464 - $text
465 - );
 456+ LqtView::editMetadataUpdates(
 457+ array(
 458+ 'root' => $article,
 459+ 'thread' => $thread,
 460+ 'summary' => $summary,
 461+ 'text' => $text,
 462+ ) );
466463
467464 return true;
468465 }
Index: branches/wmf/1.17wmf1/extensions/WikiEditor/WikiEditor.php
@@ -60,6 +60,7 @@
6161 $wgHooks['EditPage::showEditForm:initial'][] = 'WikiEditorHooks::editPageShowEditFormInitial';
6262 $wgHooks['GetPreferences'][] = 'WikiEditorHooks::getPreferences';
6363 $wgHooks['MakeGlobalVariablesScript'][] = 'WikiEditorHooks::makeGlobalVariablesScript';
 64+$wgHooks['MakeGlobalVariablesScript'][] = 'WikiEditorHooks::makeGlobalVariablesScript';
6465
6566 $wikiEditorTpl = array(
6667 'localBasePath' => dirname( __FILE__ ) . '/modules',
Index: branches/wmf/1.17wmf1/extensions/WikiEditor/WikiEditor.hooks.php
@@ -253,4 +253,17 @@
254254 }
255255 return true;
256256 }
 257+
 258+ public static function makeGlobalVariablesScript( &$vars ) {
 259+ global $wgWikiEditorFeatures;
 260+
 261+ // Build and export old-style wgWikiEditorEnabledModules object for back compat
 262+ $enabledModules = array();
 263+ foreach ( self::$features as $name => $feature ) {
 264+ $enabledModules[$name] = self::isEnabled( $name );
 265+ }
 266+
 267+ $vars['wgWikiEditorEnabledModules'] = $enabledModules;
 268+ return true;
 269+ }
257270 }
Property changes on: branches/wmf/1.17wmf1/extensions/WikiEditor/WikiEditor.hooks.php
___________________________________________________________________
Modified: svn:mergeinfo
258271 Merged /trunk/phase3/extensions/WikiEditor/WikiEditor.hooks.php:r83586-83587,83817,83876,83979,84118,84228
259272 Merged /trunk/extensions/WikiEditor/WikiEditor.hooks.php:r76372,76377,82181,83586-83587,83817,83876,83979,84118,84228
Index: branches/wmf/1.17wmf1/extensions/Vector/Vector.php
@@ -59,6 +59,7 @@
6060 $wgHooks['BeforePageDisplay'][] = 'VectorHooks::beforePageDisplay';
6161 $wgHooks['GetPreferences'][] = 'VectorHooks::getPreferences';
6262 $wgHooks['ResourceLoaderGetConfigVars'][] = 'VectorHooks::resourceLoaderGetConfigVars';
 63+$wgHooks['MakeGlobalVariablesScript'][] = 'VectorHooks::makeGlobalVariablesScript';
6364
6465 $vectorResourceTemplate = array(
6566 'localBasePath' => dirname( __FILE__ ) . '/modules',
Property changes on: branches/wmf/1.17wmf1/extensions/Vector/Vector.php
___________________________________________________________________
Modified: svn:mergeinfo
6667 Merged /trunk/extensions/Vector/Vector.php:r76372,76377,82181,83586-83587,83817,83876,83979,84118,84228
6768 Merged /trunk/phase3/extensions/Vector/Vector.php:r83586-83587,83817,83876,83979,84118,84228
Index: branches/wmf/1.17wmf1/extensions/Vector/modules/ext.vector.simpleSearch.js
@@ -78,8 +78,9 @@
7979 positionFromLeft: $( 'body' ).is( '.rtl' ),
8080 highlightInput: true
8181 } )
82 - .bind( 'paste cut', function( e ) {
83 - // make sure paste and cut events from the mouse trigger the keypress handler and cause the suggestions to update
 82+ .bind( 'paste cut drop', function( e ) {
 83+ // make sure paste and cut events from the mouse and drag&drop events
 84+ // trigger the keypress handler and cause the suggestions to update
8485 $( this ).trigger( 'keypress' );
8586 } );
8687 // Special suggestions functionality for skin-provided search box
Property changes on: branches/wmf/1.17wmf1/extensions/Vector/modules/ext.vector.simpleSearch.js
___________________________________________________________________
Modified: svn:mergeinfo
8788 Merged /trunk/extensions/Vector/modules/ext.vector.simpleSearch.js:r76372,76377,82181,83586-83587,83817,83876,83979,84118,84228
Index: branches/wmf/1.17wmf1/extensions/Vector/Vector.hooks.php
@@ -174,4 +174,17 @@
175175 }
176176 return true;
177177 }
 178+
 179+ public static function makeGlobalVariablesScript( &$vars ) {
 180+ global $wgVectorFeatures;
 181+
 182+ // Build and export old-style wgVectorEnabledModules object for back compat
 183+ $enabledModules = array();
 184+ foreach ( self::$features as $name => $feature ) {
 185+ $enabledModules[$name] = self::isEnabled( $name );
 186+ }
 187+
 188+ $vars['wgVectorEnabledModules'] = $enabledModules;
 189+ return true;
 190+ }
178191 }
Index: branches/wmf/1.17wmf1/extensions/Renameuser/Renameuser_body.php
@@ -544,13 +544,12 @@
545545 }
546546 $dbw->freeResult( $res );
547547 }
548 - // @FIXME: batchInsert() commits per 50 jobs,
549 - // which sucks if the DB is rolled-back...
 548+
550549 if ( count( $jobs ) > 0 ) {
551 - Job::batchInsert( $jobs );
 550+ Job::safeBatchInsert( $jobs ); // don't commit yet
552551 }
553552
554 - // Commit the transaction (though batchInsert() above commits)
 553+ // Commit the transaction
555554 $dbw->commit();
556555
557556 // Delete from memcached again to make sure
Index: branches/wmf/1.17wmf1/includes/upload/UploadBase.php
@@ -415,7 +415,7 @@
416416
417417 $overwriteError = $this->checkOverwrite( $user );
418418 if ( $overwriteError !== true ) {
419 - return array( array( $overwriteError ) );
 419+ return array( $overwriteError );
420420 }
421421
422422 return true;
@@ -1016,14 +1016,14 @@
10171017 * Check if there's an overwrite conflict and, if so, if restrictions
10181018 * forbid this user from performing the upload.
10191019 *
1020 - * @return mixed true on success, error string on failure
 1020+ * @return mixed true on success, array on failure
10211021 */
10221022 private function checkOverwrite( $user ) {
10231023 // First check whether the local file can be overwritten
10241024 $file = $this->getLocalFile();
10251025 if( $file->exists() ) {
10261026 if( !self::userCanReUpload( $user, $file ) ) {
1027 - return 'fileexists-forbidden';
 1027+ return array( 'fileexists-forbidden', $file->getName() );
10281028 } else {
10291029 return true;
10301030 }
@@ -1034,7 +1034,7 @@
10351035 */
10361036 $file = wfFindFile( $this->getTitle() );
10371037 if ( $file && !$user->isAllowed( 'reupload-shared' ) ) {
1038 - return 'fileexists-shared-forbidden';
 1038+ return array( 'fileexists-shared-forbidden', $file->getName() );
10391039 }
10401040
10411041 return true;
Property changes on: branches/wmf/1.17wmf1/includes/upload/UploadBase.php
___________________________________________________________________
Modified: svn:mergeinfo
10421042 Merged /trunk/phase3/includes/upload/UploadBase.php:r83586-83587,83817,83876,83979,84118,84228
Index: branches/wmf/1.17wmf1/includes/PrefixSearch.php
@@ -107,7 +107,11 @@
108108 foreach( $keys as $pageKey => $page ) {
109109 if( $searchKey === '' || strpos( $pageKey, $searchKey ) === 0 ) {
110110 wfSuppressWarnings();
111 - $srchres[] = SpecialPage::getTitleFor( $page )->getPrefixedText();
 111+ // bug 27671: Don't use SpecialPage::getTitleFor() here because it
 112+ // localizes its input leading to searches for e.g. Special:All
 113+ // returning Spezial:MediaWiki-Systemnachrichten and returning
 114+ // Spezial:Alle_Seiten twice when $wgLanguageCode == 'de'
 115+ $srchres[] = Title::makeTitleSafe( NS_SPECIAL, $page )->getPrefixedText();
112116 wfRestoreWarnings();
113117 }
114118
Index: branches/wmf/1.17wmf1/includes/job/JobQueue.php
@@ -216,12 +216,12 @@
217217 * @param $jobs array of Job objects
218218 */
219219 static function batchInsert( $jobs ) {
220 - if( !count( $jobs ) ) {
 220+ if ( !count( $jobs ) ) {
221221 return;
222222 }
223223 $dbw = wfGetDB( DB_MASTER );
224224 $rows = array();
225 - foreach( $jobs as $job ) {
 225+ foreach ( $jobs as $job ) {
226226 $rows[] = $job->insertFields();
227227 if ( count( $rows ) >= 50 ) {
228228 # Do a small transaction to avoid slave lag
@@ -231,14 +231,42 @@
232232 $rows = array();
233233 }
234234 }
235 - if ( $rows ) {
236 - wfIncrStats( 'job-insert', count( $rows ) );
 235+ if ( $rows ) { // last chunk
237236 $dbw->begin();
238237 $dbw->insert( 'job', $rows, __METHOD__, 'IGNORE' );
239238 $dbw->commit();
240239 }
 240+ wfIncrStats( 'job-insert', count( $jobs ) );
241241 }
242242
 243+ /**
 244+ * Insert a group of jobs into the queue.
 245+ *
 246+ * Same as batchInsert() but does not commit and can thus
 247+ * be rolled-back as part of a larger transaction. However,
 248+ * large batches of jobs can cause slave lag.
 249+ *
 250+ * @param $jobs array of Job objects
 251+ */
 252+ static function safeBatchInsert( $jobs ) {
 253+ if ( !count( $jobs ) ) {
 254+ return;
 255+ }
 256+ $dbw = wfGetDB( DB_MASTER );
 257+ $rows = array();
 258+ foreach ( $jobs as $job ) {
 259+ $rows[] = $job->insertFields();
 260+ if ( count( $rows ) >= 500 ) {
 261+ $dbw->insert( 'job', $rows, __METHOD__, 'IGNORE' );
 262+ $rows = array();
 263+ }
 264+ }
 265+ if ( $rows ) { // last chunk
 266+ $dbw->insert( 'job', $rows, __METHOD__, 'IGNORE' );
 267+ }
 268+ wfIncrStats( 'job-insert', count( $jobs ) );
 269+ }
 270+
243271 /*-------------------------------------------------------------------------
244272 * Non-static functions
245273 *------------------------------------------------------------------------*/
Property changes on: branches/wmf/1.17wmf1/includes/job/JobQueue.php
___________________________________________________________________
Modified: svn:mergeinfo
246274 Merged /trunk/phase3/includes/job/JobQueue.php:r83586-83587,83817,83876,83979,84118,84228
Index: branches/wmf/1.17wmf1/includes/specials/SpecialListfiles.php
@@ -235,9 +235,19 @@
236236 if ( !is_null( $this->mUserName ) ) {
237237 # Append the username to the query string
238238 foreach ( $queries as &$query ) {
239 - $query['username'] = $this->mUserName;
 239+ $query['user'] = $this->mUserName;
240240 }
241241 }
242242 return $queries;
243243 }
 244+
 245+ function getDefaultQuery() {
 246+ $queries = parent::getDefaultQuery();
 247+ if ( !isset( $queries['user'] )
 248+ && !is_null( $this->mUserName ) )
 249+ {
 250+ $queries['user'] = $this->mUserName;
 251+ }
 252+ return $queries;
 253+ }
244254 }
Index: branches/wmf/1.17wmf1/includes/specials/SpecialUpload.php
@@ -448,8 +448,8 @@
449449 $permErrors = $this->mUpload->verifyPermissions( $wgUser );
450450 if( $permErrors !== true ) {
451451 $code = array_shift( $permErrors[0] );
452 - $this->showRecoverableUploadError( wfMsgExt( $code,
453 - 'parseinline', $permErrors[0] ) );
 452+ $this->showRecoverableUploadError( wfMsgExt( $code[0],
 453+ 'parseinline', $code[1] ) );
454454 return;
455455 }
456456
Property changes on: branches/wmf/1.17wmf1/includes/specials/SpecialUpload.php
___________________________________________________________________
Modified: svn:mergeinfo
457457 Merged /trunk/phase3/includes/specials/SpecialUpload.php:r83586-83587,83817,83876,83979,84118,84228
Index: branches/wmf/1.17wmf1/RELEASE-NOTES
@@ -493,7 +493,9 @@
494494 * (bug 27560) Search queries no longer fail in walloon language
495495 * (bug 27700) The upload protection can now also be set for files that do not
496496 exist.
497 -
 497+* (bug 28034) uploading file to local wiki when file exists on shared repository
 498+ (commons) gives spurious info in the warning message
 499+
498500 === API changes in 1.17 ===
499501 * BREAKING CHANGE: action=patrol now requires POST
500502 * BREAKING CHANGE: patrol token is no longer the same as edit token
Property changes on: branches/wmf/1.17wmf1/RELEASE-NOTES
___________________________________________________________________
Modified: svn:mergeinfo
501503 Merged /trunk/phase3/RELEASE-NOTES:r83586-83587,83817,83876,83979,84118,84228
Index: branches/wmf/1.17wmf1/resources/jquery/jquery.placeholder.js
@@ -37,9 +37,33 @@
3838 } )
3939
4040 // Hide on focus
41 - .focus( function() {
 41+ // Also listen for other events in case $input was
 42+ // already focused when the events were bound
 43+ .bind( 'focus drop keydown paste', function( e ) {
4244 if ($input.hasClass('placeholder')) {
43 - this.value = '';
 45+ if ( e.type == 'drop' && e.originalEvent.dataTransfer ) {
 46+ // Support for drag&drop. Instead of inserting the dropped
 47+ // text somewhere in the middle of the placeholder string,
 48+ // we want to set the contents of the search box to the
 49+ // dropped text.
 50+
 51+ // IE wants getData( 'text' ) but Firefox wants getData( 'text/plain' )
 52+ // Firefox fails gracefully with an empty string, IE barfs with an error
 53+ try {
 54+ // Try the Firefox way
 55+ this.value = e.originalEvent.dataTransfer.getData( 'text/plain' );
 56+ } catch ( exception ) {
 57+ // Got an exception, so use the IE way
 58+ this.value = e.originalEvent.dataTransfer.getData( 'text' );
 59+ }
 60+
 61+ // On Firefox, drop fires after the dropped text has been inserted,
 62+ // but on IE it fires before. If we don't prevent the default action,
 63+ // IE will insert the dropped text twice.
 64+ e.preventDefault();
 65+ } else {
 66+ this.value = '';
 67+ }
4468 $input.removeClass( 'placeholder' );
4569 }
4670 } );

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r76372Bug 23716: Fix Rollback and Mark Patrolled on LiquidThreads *comments*. Patch...werdna03:49, 9 November 2010
r76377Fix bug in r76372 (== versus =)werdna05:08, 9 November 2010
r83586(bug 27944) Search placeholder was inserted even when the search box was alre...catrope13:54, 9 March 2011
r83587Fix r83586 (drag and drop support for placeholder plugin) to work in IE, whos...catrope14:27, 9 March 2011
r83817(bug 27515) Reintroduce JS variables wgVectorEnabledModules and wgWikiEditorE...catrope10:55, 13 March 2011
r83876Revert r67661 (change Title::makeTitle(NS_SPECIAL, $foo) to SpecialPage::getT...catrope10:03, 14 March 2011
r83979* (bug 28034) uploading file to local wiki when file exists on shared reposit...reedy23:33, 14 March 2011
r84118(follow-up r65035/r65013) The username parameter wasn't preserved when clicki...bawolff18:23, 16 March 2011
r84228* Fixed wfIncrStats calls from r83617 (I assume this wants the # of jobs added)...aaron07:06, 18 March 2011

Status & tagging log