r98759 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r98758‎ | r98759 | r98760 >
Date:13:31, 3 October 2011
Author:reedy
Status:resolved
Tags:
Comment:
Modified paths:
  • /branches/REL1_18/extensions/Cite/SpecialCite.php (modified) (history)
  • /branches/REL1_18/extensions/FlaggedRevs/dataclasses/FlaggedRevs.class.php (modified) (history)
  • /branches/REL1_18/extensions/TitleBlacklist/TitleBlacklist.hooks.php (modified) (history)
  • /branches/REL1_18/extensions/TitleBlacklist/TitleBlacklist.list.php (modified) (history)
  • /branches/REL1_18/extensions/UploadWizard/resources/mw.UploadWizard.js (modified) (history)
  • /branches/REL1_18/extensions/WikiEditor/WikiEditor.php (modified) (history)
  • /branches/REL1_18/extensions/WikimediaMessages/WikimediaMessages.php (modified) (history)

Diff [purge]

Index: branches/REL1_18/extensions/UploadWizard/resources/mw.UploadWizard.js
@@ -358,11 +358,20 @@
359359 this.imageinfo.metadata.orientation = meta.tiff.Orientation.value;
360360 }
361361 if ( meta.general ) {
 362+ var pixelHeightDim = 'height';
 363+ var pixelWidthDim = 'width';
 364+ // this must be called after orientation is set above. If no orientation set, defaults to 0
 365+ var degrees = this.getOrientationDegrees();
 366+ // jpegmeta reports pixelHeight & width
 367+ if ( degrees == 90 || degrees == 270 ) {
 368+ pixelHeightDim = 'width';
 369+ pixelWidthDim = 'height';
 370+ }
362371 if ( meta.general.pixelHeight ) {
363 - this.imageinfo.height = meta.general.pixelHeight.value;
 372+ this.imageinfo[pixelHeightDim] = meta.general.pixelHeight.value;
364373 }
365374 if ( meta.general.pixelWidth ) {
366 - this.imageinfo.width = meta.general.pixelWidth.value;
 375+ this.imageinfo[pixelWidthDim] = meta.general.pixelWidth.value;
367376 }
368377 }
369378 }
Index: branches/REL1_18/extensions/WikimediaMessages/WikimediaMessages.php
@@ -37,7 +37,7 @@
3838 }
3939
4040 function efWikimediaEditPageCopyrightWarning( $title, &$msg ) {
41 - $msg = 'wikimedia-copyrightwarning';
 41+ $msg = array( 'wikimedia-copyrightwarning' );
4242 return true;
4343 }
4444
Index: branches/REL1_18/extensions/TitleBlacklist/TitleBlacklist.hooks.php
@@ -80,11 +80,10 @@
8181 *
8282 * @return bool Acceptable
8383 */
84 - private static function acceptNewUserName( $userName, &$err, $override = true ) {
85 - global $wgTitleBlacklist, $wgUser;
86 - efInitTitleBlacklist();
 84+ private static function acceptNewUserName( $userName, $permissionsUser, &$err, $override = true ) {
8785 $title = Title::makeTitleSafe( NS_USER, $userName );
88 - $blacklisted = $wgTitleBlacklist->userCannot( $title, $wgUser, 'new-account', $override );
 86+ $blacklisted = TitleBlacklist::singleton()->userCannot( $title, $permissionsUser,
 87+ 'new-account', $override );
8988 if( $blacklisted instanceof TitleBlacklistEntry ) {
9089 $message = $blacklisted->getErrorMessage( 'new-account' );
9190 $err = wfMsgWikiHtml( $message, $blacklisted->getRaw(), $userName );
@@ -101,13 +100,15 @@
102101 public static function abortNewAccount( $user, &$message ) {
103102 global $wgUser, $wgRequest;
104103 $override = $wgRequest->getCheck( 'wpIgnoreTitleBlacklist' );
105 - return self::acceptNewUserName( $user->getName(), $message, $override );
 104+ return self::acceptNewUserName( $user->getName(), $wgUser, $message, $override );
106105 }
107106
108107 /** CentralAuthAutoCreate hook */
109108 public static function centralAuthAutoCreate( $user, $userName ) {
110109 $message = ''; # Will be ignored
111 - return self::acceptNewUserName( $userName, $message );
 110+ $anon = new User;
 111+ global $wgUser;
 112+ return self::acceptNewUserName( $userName, $anon, $message );
112113 }
113114
114115 /** EditFilter hook
@@ -176,9 +177,9 @@
177178
178179 /** UserCreateForm hook based on the one from AntiSpoof extension */
179180 public static function addOverrideCheckbox( &$template ) {
180 - global $wgRequest;
 181+ global $wgRequest, $wgUser;
181182
182 - if ( TitleBlacklist::userCanOverride( 'new-account' ) ) {
 183+ if ( TitleBlacklist::userCanOverride( $wgUser, 'new-account' ) ) {
183184 $template->addInputItem( 'wpIgnoreTitleBlacklist',
184185 $wgRequest->getCheck( 'wpIgnoreTitleBlacklist' ),
185186 'checkbox', 'titleblacklist-override' );
Index: branches/REL1_18/extensions/TitleBlacklist/TitleBlacklist.list.php
@@ -138,7 +138,7 @@
139139 * otherwise FALSE
140140 */
141141 public function userCannot( $title, $user, $action = 'edit', $override = true ) {
142 - if( $override && self::userCanOverride( $action ) )
 142+ if( $override && self::userCanOverride( $user, $action ) ) {
143143 return false;
144144 else
145145 return $this->isBlacklisted( $title, $action );
@@ -266,10 +266,9 @@
267267 *
268268 * @param $action Action
269269 */
270 - public static function userCanOverride( $action ) {
271 - global $wgUser;
272 - return $wgUser->isAllowed( 'tboverride' ) ||
273 - ( $action == 'new-account' && $wgUser->isAllowed( 'tboverride-account' ) );
 270+ public static function userCanOverride( $user, $action ) {
 271+ return $user->isAllowed( 'tboverride' ) ||
 272+ ( $action == 'new-account' && $user->isAllowed( 'tboverride-account' ) );
274273 }
275274 }
276275
Index: branches/REL1_18/extensions/FlaggedRevs/dataclasses/FlaggedRevs.class.php
@@ -963,10 +963,10 @@
964964 # If this is an image page, store corresponding file info
965965 $fileData = array( 'name' => null, 'timestamp' => null, 'sha1' => null );
966966 if ( $title->getNamespace() == NS_FILE ) {
967 - # We must use ImagePage process cache on upload or get bitten by slave lag
968 - $file = $article instanceof ImagePage
969 - ? $article->getFile()
970 - : wfFindFile( $title );
 967+ # We must use WikiFilePage process cache on upload or get bitten by slave lag
 968+ $file = ( $article instanceof WikiFilePage || $article instanceof ImagePage )
 969+ ? $article->getFile() // uses up-to-date process cache on new uploads
 970+ : wfFindFile( $title, array( 'bypassCache' => true ) ); // skip cache; bug 31056
971971 if ( is_object( $file ) && $file->exists() ) {
972972 $fileData['name'] = $title->getDBkey();
973973 $fileData['timestamp'] = $file->getTimestamp();
Index: branches/REL1_18/extensions/WikiEditor/WikiEditor.php
@@ -506,7 +506,6 @@
507507 'scripts' => 'ext.wikiEditor.toolbar.hideSig.js',
508508 'dependencies' => array(
509509 'ext.wikiEditor',
510 - 'ext.wikiEditor.toolbar',
511510 )
512511 ),
513512 );
Index: branches/REL1_18/extensions/Cite/SpecialCite.php
@@ -59,17 +59,15 @@
6060 * @return bool
6161 */
6262 function wfSpecialCiteToolbox( &$skin ) {
63 - global $wgUser;
64 -
6563 if ( isset( $skin->data['nav_urls']['cite'] ) ) {
6664 echo Html::rawElement(
6765 'li',
6866 array( 'id' => 't-cite' ),
69 - $skin->skin->link(
 67+ Linker::link(
7068 SpecialPage::getTitleFor( 'Cite' ),
7169 wfMsg( 'cite_article_link' ),
7270 # Used message keys: 'tooltip-cite-article', 'accesskey-cite-article'
73 - $wgUser->getSkin()->tooltipAndAccessKeyAttribs( 'cite-article' ),
 71+ Linker::tooltipAndAccessKeyAttribs( 'cite-article' ),
7472 $skin->data['nav_urls']['cite']['args']
7573 )
7674 );

Follow-up revisions

RevisionCommit summaryAuthorDate
r98763Missed part of r98759, seems it didn't save till afterreedy13:58, 3 October 2011

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r92930fix problem with php 5.3 -- $msg is ultimately used in call_user_func_array, ...neilk02:54, 23 July 2011
r96665Use static Linker, fixes Fatal error: Call to a member function link() on a n...robin14:49, 9 September 2011
r97650swap reported width and height for jpegmeta, if rotated 90 or 270 degreesneilk19:13, 20 September 2011
r97701* Fixed bug causing new uploads to give "template/file changes need review" m...aaron07:13, 21 September 2011
r97702Removed debugging code from r97701aaron07:15, 21 September 2011
r97733(bug 31069) WikiEditor toolbar cannot be disabled. Was caused by hideSig (a m...catrope13:54, 21 September 2011
r97794Fix for r76344: you can't access $wgUser during the CentralAuthAutoCreate hoo...tstarling06:10, 22 September 2011
r97892FU r97886: fixed function callaaron07:17, 23 September 2011

Status & tagging log