r80526 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r80525‎ | r80526 | r80527 >
Date:22:19, 18 January 2011
Author:catrope
Status:ok
Tags:
Comment:
Modified paths:
  • /branches/REL1_17/extensions/CentralAuth/ApiQueryGlobalUserInfo.php (modified) (history)
  • /branches/REL1_17/extensions/LiquidThreads/classes/Thread.php (modified) (history)
  • /branches/REL1_17/extensions/LiquidThreads/lqt.js (modified) (history)
  • /branches/REL1_17/phase3/img_auth.php (modified) (history)
  • /branches/REL1_17/phase3/includes/MessageBlobStore.php (modified) (history)
  • /branches/REL1_17/phase3/includes/OutputPage.php (modified) (history)
  • /branches/REL1_17/phase3/includes/SkinTemplate.php (modified) (history)
  • /branches/REL1_17/phase3/includes/WatchlistEditor.php (modified) (history)
  • /branches/REL1_17/phase3/includes/parser/Parser.php (modified) (history)
  • /branches/REL1_17/phase3/includes/resourceloader/ResourceLoader.php (modified) (history)
  • /branches/REL1_17/phase3/includes/resourceloader/ResourceLoaderFileModule.php (modified) (history)
  • /branches/REL1_17/phase3/skins/common/shared.css (modified) (history)

Diff [purge]

Index: branches/REL1_17/extensions/LiquidThreads/classes/Thread.php
@@ -1543,14 +1543,7 @@
15441544 }
15451545 }
15461546
1547 - $testTitle = Title::makeTitleSafe( NS_LQT_THREAD, 'test' );
1548 - if ( ! $testTitle->userCan( 'create' ) ||
1549 - ! $testTitle->userCan( 'edit' ) )
1550 - {
1551 - return false;
1552 - }
1553 -
1554 - return true;
 1547+ return self::canUserCreateThreads( $user );
15551548 }
15561549
15571550 public static function canUserPost( $user, $talkpage ) {
@@ -1562,14 +1555,20 @@
15631556 }
15641557 }
15651558
1566 - $testTitle = Title::makeTitleSafe( NS_LQT_THREAD, 'test' );
1567 - if ( ! $testTitle->userCan( 'create' ) ||
1568 - ! $testTitle->userCan( 'edit' ) )
1569 - {
1570 - return false;
 1559+ return self::canUserCreateThreads( $user );
 1560+ }
 1561+
 1562+ // Generally, not some specific page
 1563+ public static function canUserCreateThreads( $user ) {
 1564+ $userText = $user->getName();
 1565+
 1566+ static $canCreateNew = null;
 1567+ if ( !isset( $canCreateNew[$userText] ) ) {
 1568+ $title = Title::makeTitleSafe( NS_LQT_THREAD, 'Test title for LQT thread creation check' );
 1569+ $canCreateNew[$userText] = $title->userCan( 'create' ) && $title->userCan( 'edit' );
15711570 }
15721571
1573 - return true;
 1572+ return $canCreateNew[$userText];
15741573 }
15751574
15761575 public function signature() {
Index: branches/REL1_17/extensions/LiquidThreads/lqt.js
@@ -102,7 +102,8 @@
103103 var talkpage = $j(this).attr('lqt_talkpage');
104104 var params = {'talkpage' : talkpage, 'method' : 'talkpage_new_thread' };
105105
106 - var container = $j('.lqt-new-thread' ).data('lqt-talkpage', talkpage);
 106+ var container = $j('.lqt-new-thread' );
 107+ container.data('lqt-talkpage', talkpage);
107108
108109 liquidThreads.injectEditForm( params, container );
109110 liquidThreads.currentReplyThread = 0;
Property changes on: branches/REL1_17/extensions/LiquidThreads/lqt.js
___________________________________________________________________
Added: svn:mergeinfo
110111 Merged /trunk/extensions/LiquidThreads/lqt.js:r57390,79817,80008
Index: branches/REL1_17/extensions/CentralAuth/ApiQueryGlobalUserInfo.php
@@ -141,6 +141,7 @@
142142 'prop' => array(
143143 'Which properties to get:',
144144 ' groups - Get a list of global groups this user belongs to',
 145+ ' rights - Get a list of global rights this user has',
145146 ' merged - Get a list of merged accounts',
146147 ' unattached - Get a list of unattached accounts'
147148 ),
Index: branches/REL1_17/phase3/skins/common/shared.css
@@ -794,6 +794,13 @@
795795 border: solid 2px white;
796796 display: -moz-inline-box;
797797 }
 798+
 799+ul.gallery, li.gallerybox {
 800+ display: inline-block;
 801+ zoom: 1;
 802+ *display: inline;
 803+}
 804+
798805 ul.gallery {
799806 margin: 2px;
800807 padding: 2px;
@@ -801,12 +808,6 @@
802809 display: block;
803810 }
804811
805 -ul.gallery, li.gallerybox {
806 - display: inline-block;
807 - zoom: 1;
808 - *display: inline;
809 -}
810 -
811812 li.gallerycaption {
812813 font-weight: bold;
813814 text-align: center;
Property changes on: branches/REL1_17/phase3/skins/common/shared.css
___________________________________________________________________
Added: svn:mergeinfo
814815 Merged /branches/sqlite/skins/common/shared.css:r58211-58321
815816 Merged /trunk/phase3/skins/common/shared.css:r78232
816817 Merged /branches/new-installer/phase3/skins/common/shared.css:r43664-66004
817818 Merged /branches/REL1_15/phase3/skins/common/shared.css:r51646
Index: branches/REL1_17/phase3/includes/parser/Parser.php
@@ -317,18 +317,11 @@
318318 }
319319
320320 /**
321 - * A page get its title converted except:
322 - * a) Language conversion is globally disabled
323 - * b) Title convert is globally disabled
324 - * c) The page is a redirect page
325 - * d) User request with a "linkconvert" set to "no"
326 - * e) A "nocontentconvert" magic word has been set
327 - * f) A "notitleconvert" magic word has been set
328 - * g) User sets "noconvertlink" in his/her preference
329 - *
330 - * Note that if a user tries to set a title in a conversion
331 - * rule but content conversion was not done, then the parser
332 - * won't pick it up. This is probably expected behavior.
 321+ * 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
 324+ * {{DISPLAYTITLE:...}} is present. DISPLAYTITLE takes precedence over
 325+ * automatic link conversion.
333326 */
334327 if ( !( $wgDisableLangConversion
335328 || $wgDisableTitleConversion
Property changes on: branches/REL1_17/phase3/includes/parser/Parser.php
___________________________________________________________________
Added: svn:mergeinfo
336329 Merged /branches/new-installer/phase3/includes/parser/Parser.php:r43664-66004
337330 Merged /branches/wmf-deployment/includes/parser/Parser.php:r53381
338331 Merged /branches/REL1_15/phase3/includes/parser/Parser.php:r51646
339332 Merged /branches/sqlite/includes/parser/Parser.php:r58211-58321
340333 Merged /trunk/phase3/includes/parser/Parser.php:r79732,79785
Index: branches/REL1_17/phase3/includes/WatchlistEditor.php
@@ -213,7 +213,7 @@
214214 FROM {$watchlist} LEFT JOIN {$page} ON ( wl_namespace = page_namespace
215215 AND wl_title = page_title ) WHERE wl_user = {$uid}";
216216 if ( ! $dbr->implicitOrderby() ) {
217 - $sql .= " ORDER BY wl_title";
 217+ $sql .= " ORDER BY wl_namespace, wl_title";
218218 }
219219 $res = $dbr->query( $sql, __METHOD__ );
220220 if( $res && $dbr->numRows( $res ) > 0 ) {
Property changes on: branches/REL1_17/phase3/includes/WatchlistEditor.php
___________________________________________________________________
Added: svn:mergeinfo
221221 Merged /branches/new-installer/phase3/includes/WatchlistEditor.php:r43664-66004
222222 Merged /branches/wmf-deployment/includes/WatchlistEditor.php:r53381
223223 Merged /branches/REL1_15/phase3/includes/WatchlistEditor.php:r51646
224224 Merged /branches/sqlite/includes/WatchlistEditor.php:r58211-58321
225225 Merged /trunk/phase3/includes/WatchlistEditor.php:r79732,79864
Index: branches/REL1_17/phase3/includes/OutputPage.php
@@ -23,7 +23,7 @@
2424 var $mLastModified = '', $mETag = false;
2525 var $mCategoryLinks = array(), $mCategories = array(), $mLanguageLinks = array();
2626
27 - var $mScripts = '', $mLinkColours, $mPageLinkTitle = '', $mHeadItems = array();
 27+ var $mScripts = '', $mInlineStyles = '', $mLinkColours, $mPageLinkTitle = '', $mHeadItems = array();
2828 var $mModules = array(), $mModuleScripts = array(), $mModuleStyles = array(), $mModuleMessages = array();
2929 var $mResourceLoader;
3030 var $mInlineMsg = array();
@@ -2274,12 +2274,9 @@
22752275
22762276 $ret .= implode( "\n", array(
22772277 $this->getHeadLinks( $sk ),
2278 - $this->buildCssLinks(),
2279 - $this->getHeadItems(),
 2278+ $this->buildCssLinks( $sk ),
 2279+ $this->getHeadItems()
22802280 ) );
2281 - if ( $sk->usercss ) {
2282 - $ret .= Html::inlineStyle( $sk->usercss );
2283 - }
22842281
22852282 if ( $wgUseTrackbacks && $this->isArticleRelated() ) {
22862283 $ret .= $this->getTitle()->trackbackRDF();
@@ -2630,28 +2627,6 @@
26312628 }
26322629 }
26332630
2634 - // Split the styles into three groups
2635 - $styles = array( 'other' => array(), 'user' => array(), 'site' => array() );
2636 - $resourceLoader = $this->getResourceLoader();
2637 - foreach ( $this->getModuleStyles() as $name ) {
2638 - $group = $resourceLoader->getModule( $name )->getGroup();
2639 - // Modules in groups named "other" or anything different than "user" or "site" will
2640 - // be placed in the "other" group
2641 - $styles[isset( $style[$group] ) ? $group : 'other'][] = $name;
2642 - }
2643 -
2644 - // We want site and user styles to override dynamically added styles from modules, but we want
2645 - // dynamically added styles to override statically added styles from other modules. So the order
2646 - // has to be other, dynamic, site, user
2647 - // Add statically added styles for other modules
2648 - $tags[] = $this->makeResourceLoaderLink( $sk, $styles['other'], 'styles' );
2649 - // Add marker tag to mark the place where the client-side loader should inject dynamic styles
2650 - // We use a <meta> tag with a made-up name for this because that's valid HTML
2651 - $tags[] = Html::element( 'meta', array( 'name' => 'ResourceLoaderDynamicStyles', 'content' => '' ) );
2652 - // Add site and user styles
2653 - $tags[] = $this->makeResourceLoaderLink(
2654 - $sk, array_merge( $styles['site'], $styles['user'] ), 'styles'
2655 - );
26562631 return implode( "\n", $tags );
26572632 }
26582633
@@ -2702,15 +2677,42 @@
27032678 * @param $style_css Mixed: inline CSS
27042679 */
27052680 public function addInlineStyle( $style_css ){
2706 - $this->mScripts .= Html::inlineStyle( $style_css );
 2681+ $this->mInlineStyles .= Html::inlineStyle( $style_css );
27072682 }
27082683
27092684 /**
27102685 * Build a set of <link>s for the stylesheets specified in the $this->styles array.
27112686 * These will be applied to various media & IE conditionals.
 2687+ * @param $sk Skin object
27122688 */
2713 - public function buildCssLinks() {
2714 - return implode( "\n", $this->buildCssLinksArray() );
 2689+ public function buildCssLinks( $sk ) {
 2690+ $ret = '';
 2691+ // Add ResourceLoader styles
 2692+ // Split the styles into three groups
 2693+ $styles = array( 'other' => array(), 'user' => array(), 'site' => array() );
 2694+ $resourceLoader = $this->getResourceLoader();
 2695+ foreach ( $this->getModuleStyles() as $name ) {
 2696+ $group = $resourceLoader->getModule( $name )->getGroup();
 2697+ // Modules in groups named "other" or anything different than "user" or "site" will
 2698+ // be placed in the "other" group
 2699+ $styles[isset( $styles[$group] ) ? $group : 'other'][] = $name;
 2700+ }
 2701+
 2702+ // We want site and user styles to override dynamically added styles from modules, but we want
 2703+ // dynamically added styles to override statically added styles from other modules. So the order
 2704+ // has to be other, dynamic, site, user
 2705+ // Add statically added styles for other modules
 2706+ $ret .= $this->makeResourceLoaderLink( $sk, $styles['other'], 'styles' );
 2707+ // Add normal styles added through addStyle()/addInlineStyle() here
 2708+ $ret .= implode( "\n", $this->buildCssLinksArray() ) . $this->mInlineStyles;
 2709+ // Add marker tag to mark the place where the client-side loader should inject dynamic styles
 2710+ // We use a <meta> tag with a made-up name for this because that's valid HTML
 2711+ $ret .= Html::element( 'meta', array( 'name' => 'ResourceLoaderDynamicStyles', 'content' => '' ) );
 2712+ // Add site and user styles
 2713+ $ret .= $this->makeResourceLoaderLink(
 2714+ $sk, array_merge( $styles['site'], $styles['user'] ), 'styles'
 2715+ );
 2716+ return $ret;
27152717 }
27162718
27172719 public function buildCssLinksArray() {
Property changes on: branches/REL1_17/phase3/includes/OutputPage.php
___________________________________________________________________
Modified: svn:mergeinfo
27182720 Merged /trunk/phase3/includes/OutputPage.php:r79732
Index: branches/REL1_17/phase3/includes/resourceloader/ResourceLoader.php
@@ -155,7 +155,7 @@
156156 $cache->set( $key, $result );
157157 } catch ( Exception $exception ) {
158158 // Return exception as a comment
159 - $result = "/*\n{$exception->__toString()}\n*/";
 159+ $result = "/*\n{$exception->__toString()}\n*/\n";
160160 }
161161
162162 wfProfileOut( __METHOD__ );
@@ -293,7 +293,7 @@
294294 ob_start();
295295
296296 wfProfileIn( __METHOD__ );
297 - $response = '';
 297+ $exceptions = '';
298298
299299 // Split requested modules into two groups, modules and missing
300300 $modules = array();
@@ -324,7 +324,7 @@
325325 $this->preloadModuleInfo( array_keys( $modules ), $context );
326326 } catch( Exception $e ) {
327327 // Add exception to the output as a comment
328 - $response .= "/*\n{$e->__toString()}\n*/";
 328+ $exceptions .= "/*\n{$e->__toString()}\n*/\n";
329329 }
330330
331331 wfProfileIn( __METHOD__.'-getModifiedTime' );
@@ -342,7 +342,7 @@
343343 $mtime = max( $mtime, $module->getModifiedTime( $context ) );
344344 } catch ( Exception $e ) {
345345 // Add exception to the output as a comment
346 - $response .= "/*\n{$e->__toString()}\n*/";
 346+ $exceptions .= "/*\n{$e->__toString()}\n*/\n";
347347 }
348348 }
349349
@@ -389,12 +389,15 @@
390390 }
391391
392392 // Generate a response
393 - $response .= $this->makeModuleResponse( $context, $modules, $missing );
 393+ $response = $this->makeModuleResponse( $context, $modules, $missing );
 394+
 395+ // Prepend comments indicating exceptions
 396+ $response = $exceptions . $response;
394397
395398 // Capture any PHP warnings from the output buffer and append them to the
396399 // response in a comment if we're in debug mode.
397400 if ( $context->getDebug() && strlen( $warnings = ob_get_contents() ) ) {
398 - $response .= "/*\n$warnings\n*/";
 401+ $response = "/*\n$warnings\n*/\n" . $response;
399402 }
400403
401404 // Remove the output buffer and output the response
@@ -416,18 +419,19 @@
417420 array $modules, $missing = array() )
418421 {
419422 $out = '';
 423+ $exceptions = '';
420424 if ( $modules === array() && $missing === array() ) {
421425 return '/* No modules requested. Max made me put this here */';
422426 }
423427
424428 // Pre-fetch blobs
425429 if ( $context->shouldIncludeMessages() ) {
426 - //try {
 430+ try {
427431 $blobs = MessageBlobStore::get( $this, $modules, $context->getLanguage() );
428 - //} catch ( Exception $e ) {
 432+ } catch ( Exception $e ) {
429433 // Add exception to the output as a comment
430 - // $out .= "/*\n{$e->__toString()}\n*/";
431 - //}
 434+ $exceptions .= "/*\n{$e->__toString()}\n*/\n";
 435+ }
432436 } else {
433437 $blobs = array();
434438 }
@@ -476,7 +480,7 @@
477481 }
478482 } catch ( Exception $e ) {
479483 // Add exception to the output as a comment
480 - $out .= "/*\n{$e->__toString()}\n*/";
 484+ $exceptions .= "/*\n{$e->__toString()}\n*/\n";
481485
482486 // Register module as missing
483487 $missing[] = $name;
@@ -501,12 +505,12 @@
502506 }
503507
504508 if ( $context->getDebug() ) {
505 - return $out;
 509+ return $exceptions . $out;
506510 } else {
507511 if ( $context->getOnly() === 'styles' ) {
508 - return $this->filter( 'minify-css', $out );
 512+ return $exceptions . $this->filter( 'minify-css', $out );
509513 } else {
510 - return $this->filter( 'minify-js', $out );
 514+ return $exceptions . $this->filter( 'minify-js', $out );
511515 }
512516 }
513517 }
Property changes on: branches/REL1_17/phase3/includes/resourceloader/ResourceLoader.php
___________________________________________________________________
Modified: svn:mergeinfo
514518 Merged /trunk/phase3/includes/resourceloader/ResourceLoader.php:r79732,79891,79900
Index: branches/REL1_17/phase3/includes/resourceloader/ResourceLoaderFileModule.php
@@ -464,12 +464,13 @@
465465 }
466466 $styles = self::collateFilePathListByOption( $styles, 'media', 'all' );
467467 foreach ( $styles as $media => $files ) {
 468+ $uniqueFiles = array_unique( $files );
468469 $styles[$media] = implode(
469470 "\n",
470471 array_map(
471472 array( $this, 'readStyleFile' ),
472 - array_unique( $files ),
473 - array( $flip )
 473+ $uniqueFiles,
 474+ array_fill( 0, count( $uniqueFiles ), $flip )
474475 )
475476 );
476477 }
Index: branches/REL1_17/phase3/includes/SkinTemplate.php
@@ -218,7 +218,7 @@
219219 $tpl->set( 'xhtmlnamespaces', $wgXhtmlNamespaces );
220220 $tpl->set( 'html5version', $wgHtml5Version );
221221 $tpl->set( 'headlinks', $out->getHeadLinks( $this ) );
222 - $tpl->set( 'csslinks', $out->buildCssLinks() );
 222+ $tpl->set( 'csslinks', $out->buildCssLinks( $this ) );
223223
224224 if( $wgUseTrackbacks && $out->isArticleRelated() ) {
225225 $tpl->set( 'trackbackhtml', $out->getTitle()->trackbackRDF() );
Index: branches/REL1_17/phase3/includes/MessageBlobStore.php
@@ -210,7 +210,7 @@
211211 do {
212212 $updates = self::getUpdatesForMessage( $key, $updates );
213213
214 - foreach ( $updates as $key => $update ) {
 214+ foreach ( $updates as $k => $update ) {
215215 // Update the row on the condition that it
216216 // didn't change since we fetched it by putting
217217 // the timestamp in the WHERE clause.
@@ -230,7 +230,7 @@
231231 // fear of getting into an infinite loop
232232 if ( !( $success && $dbw->affectedRows() == 0 ) ) {
233233 // Not conflicted
234 - unset( $updates[$key] );
 234+ unset( $updates[$k] );
235235 }
236236 }
237237 } while ( count( $updates ) );
Property changes on: branches/REL1_17/phase3/includes/MessageBlobStore.php
___________________________________________________________________
Added: svn:mergeinfo
238238 Merged /branches/sqlite/includes/MessageBlobStore.php:r58211-58321
239239 Merged /trunk/phase3/includes/MessageBlobStore.php:r79722,79732
240240 Merged /branches/new-installer/phase3/includes/MessageBlobStore.php:r43664-66004
241241 Merged /branches/wmf-deployment/includes/MessageBlobStore.php:r53381
242242 Merged /branches/REL1_15/phase3/includes/MessageBlobStore.php:r51646
Index: branches/REL1_17/phase3/img_auth.php
@@ -43,11 +43,12 @@
4444 if( !$path ) {
4545 wfForbidden( 'img-auth-accessdenied', 'img-auth-nopathinfo' );
4646 }
 47+ $path = "/$path";
4748 } else {
4849 $path = $_SERVER['PATH_INFO'];
4950 }
5051
51 -$filename = realpath( $wgUploadDirectory . '/' . $path );
 52+$filename = realpath( $wgUploadDirectory . $path );
5253 $realUpload = realpath( $wgUploadDirectory );
5354
5455 // Basic directory traversal check
Property changes on: branches/REL1_17/phase3/img_auth.php
___________________________________________________________________
Added: svn:mergeinfo
5556 Merged /branches/REL1_15/phase3/img_auth.php:r51646
5657 Merged /branches/sqlite/img_auth.php:r58211-58321
5758 Merged /trunk/phase3/img_auth.php:r78253
5859 Merged /branches/new-installer/phase3/img_auth.php:r43664-66004

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r78232Make ul.gallery block, not inline-block...simetrical00:30, 12 December 2010
r78253Follow-up r65652: Do not double-slash the path if it came from PATH_INFObtongminh15:50, 12 December 2010
r79722(bug 26535) Variable naming collision in MessageBlobStore::updateMessage() ca...catrope15:13, 6 January 2011
r79732Fix bug 26570 (user CSS preview broken) and bug 26555 (styles added with $out...catrope16:58, 6 January 2011
r79785Update comment for r64876tstarling01:38, 7 January 2011
r79817LiquidThreads: Fix JS error in lqt.js. It's important to understand that $foo...catrope14:04, 7 January 2011
r79864Followup r74298: add ORDER BY wl_namespace, wl_title to the query in Watchlis...catrope16:01, 8 January 2011
r79891Followup r78924: keep track of exception/warning comments separately, to prev...catrope12:29, 9 January 2011
r79900Fix bug in ResourceLoader causing LTR->RTL flipping to only be applied to the...catrope16:24, 9 January 2011
r80008Attack on query bloat. The permissions checks were doing few hundred queries ...nikerabbit14:17, 11 January 2011
r80027Fixup fixme on r61717, document rights property (currently undocumented)reedy18:49, 11 January 2011

Status & tagging log