r76480 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r76479‎ | r76480 | r76481 >
Date:22:11, 10 November 2010
Author:demon
Status:resolved (Comments)
Tags:
Comment:
Combine config.css with vector.css so it gets flipped too, plus one less request :)
Modified paths:
  • /trunk/phase3/includes/installer/WebInstallerOutput.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/installer/WebInstallerOutput.php
@@ -85,13 +85,14 @@
8686 * @return String
8787 */
8888 public function getCSS( $dir ) {
89 - $vectorCssFile = dirname( dirname( dirname( __FILE__ ) ) ) .
90 - '/skins/vector/screen.css';
 89+ $skinDir = dirname( dirname( dirname( __FILE__ ) ) ) . '/skins';
 90+ $vectorCssFile = "$skinDir/vector/screen.css";
 91+ $configCssFile = "$skinDir/common/config.css";
9192 wfSuppressWarnings();
92 - $css = file_get_contents( $vectorCssFile );
 93+ $css = file_get_contents( $vectorCssFile ) . "\n" . file_get_contents( $configCssFile );
9394 wfRestoreWarnings();
9495 if( !$css ) {
95 - return "/** Your webserver cannot read $vectorCssFile, please check file permissions */";
 96+ return "/** Your webserver cannot read $vectorCssFile or $configCssFile, please check file permissions */";
9697 } elseif( $dir == 'rtl' ) {
9798 $css = CSSJanus::transform( $css, true );
9899 }
@@ -175,7 +176,6 @@
176177 <title><?php $this->outputTitle(); ?></title>
177178 <?php echo Html::linkedStyle( '../skins/common/shared.css' ) . "\n"; ?>
178179 <?php echo Html::linkedStyle( $this->getCssUrl() ) . "\n"; ?>
179 - <?php echo Html::linkedStyle( '../skins/common/config.css' ) . "\n"; ?>
180180 <?php echo Html::inlineScript( "var dbTypes = " . Xml::encodeJsVar( $dbTypes ) ) . "\n"; ?>
181181 <?php echo $this->getJQuery() . "\n"; ?>
182182 <?php echo $this->getJQueryTipsy() . "\n"; ?>
@@ -233,7 +233,6 @@
234234 <meta name="robots" content="noindex, nofollow" />
235235 <title><?php $this->outputTitle(); ?></title>
236236 <?php echo Html::linkedStyle( $this->getCssUrl() ) . "\n"; ?>
237 - <?php echo Html::linkedStyle( '../skins/common/config.css' ) . "\n"; ?>
238237 <?php echo $this->getJQuery(); ?>
239238 <?php echo $this->getJQueryTipsy() . "\n"; ?>
240239 <?php echo Html::linkedScript( '../skins/common/config.js' ); ?>

Follow-up revisions

RevisionCommit summaryAuthorDate
r77650Fix for r76480: !$css was never true, since it always contained \n. This way ...demon13:46, 3 December 2010

Comments

#Comment by Catrope (talk | contribs)   22:28, 2 December 2010
+		$css = file_get_contents( $vectorCssFile ) . "\n" . file_get_contents( $configCssFile );
 		wfRestoreWarnings();
 		if( !$css ) {

$css is always gonna contain a newline, so the !$css branch will never be taken.

#Comment by 😂 (talk | contribs)   13:23, 3 December 2010

Hmm, maybe trim() first?

#Comment by Catrope (talk | contribs)   13:30, 3 December 2010

Or just don't write such clever code and check the return values of the file_get_contents calls individually?

#Comment by 😂 (talk | contribs)   13:31, 3 December 2010
  • blushes* Aww, you called me clever :)

Status & tagging log