(bug 31236) Refactor CSS loading and apply CSSJanus to all CSS files.
authorAmir E. Aharoni <amir.aharoni@mail.huji.ac.il>
Wed, 28 Mar 2012 14:18:38 +0000 (16:18 +0200)
committerBrion Vibber <brion@pobox.com>
Tue, 3 Apr 2012 19:59:05 +0000 (12:59 -0700)
This commit is supposed to fix bug 31236.
Refactored getCSS to load files more generically.
Applied CSSJanus transform to all CSS files.
Updated release notes.

Change-Id: I4418a0dcb40fe181dc62a14a9f65b658e3c0d473

RELEASE-NOTES-1.20
includes/installer/WebInstallerOutput.php

index 3d9d333..668cc75 100644 (file)
@@ -59,6 +59,8 @@ production.
               trying to defer foreign key for externallinks
 * (bug 32748) Printer friendly version of article decode Unicode chars as a pretty IRI in footer.
 * Removed white border around thumbnails in galleries
+* (bug 31236) "Next" and "Previous" buttons are shown incorrectly in
+  an RTL environment
 
 === API changes in 1.20 ===
 * (bug 34316) Add ability to retrieve maximum upload size from MediaWiki API.
index ac97b37..fdc1746 100644 (file)
@@ -94,21 +94,40 @@ class WebInstallerOutput {
         */
        public function getCSS( $dir ) {
                $skinDir = dirname( dirname( dirname( __FILE__ ) ) ) . '/skins';
-               $vectorCssFile = "$skinDir/vector/screen.css";
-               $configCssFile = "$skinDir/common/config.css";
+
+               // All these files will be concatenated in sequence and loaded
+               // as one file.
+               // The string 'images/' in the files' contents will be replaced
+               // by '../skins/$skinName/images/', where $skinName is what appears
+               // before the last '/' in each of the strings.
+               $cssFileNames = array(
+                       "common/shared.css",
+                       "vector/screen.css",
+                       "common/config.css",
+               );
+
                $css = '';
+
                wfSuppressWarnings();
-               $vectorCss = file_get_contents( $vectorCssFile );
-               $configCss = file_get_contents( $configCssFile );
-               wfRestoreWarnings();
-               if( !$vectorCss || !$configCss ) {
-                       $css = "/** Your webserver cannot read $vectorCssFile or $configCssFile, please check file permissions */";
+               foreach ( $cssFileNames as $cssFileName ) {
+                       $fullCssFileName = "$skinDir/$cssFileName";
+                       $cssFileContents = file_get_contents( $fullCssFileName );
+                       if ( $cssFileContents ) {
+                               preg_match( "/^(\w+)\//", $cssFileName, $match );
+                               $skinName = $match[1];
+                               $css .= str_replace( 'images/', "../skins/$skinName/images/", $cssFileContents );
+                       } else {
+                               $css .= "/** Your webserver cannot read $fullCssFileName. Please check file permissions. */";
+                       }
+
+                       $css .= "\n";
                }
+               wfRestoreWarnings();
 
-               $css .= str_replace( 'images/', '../skins/vector/images/', $vectorCss ) . "\n" . str_replace( 'images/', '../skins/common/images/', $configCss );
                if( $dir == 'rtl' ) {
                        $css = CSSJanus::transform( $css, true );
                }
+
                return $css;
        }
 
@@ -197,7 +216,6 @@ class WebInstallerOutput {
        <meta name="robots" content="noindex, nofollow" />
        <meta http-equiv="Content-type" content="text/html; charset=utf-8" />
        <title><?php $this->outputTitle(); ?></title>
-       <?php echo Html::linkedStyle( '../skins/common/shared.css' ) . "\n"; ?>
        <?php echo $this->getCssUrl() . "\n"; ?>
        <?php echo Html::inlineScript(  "var dbTypes = " . Xml::encodeJsVar( $dbTypes ) ) . "\n"; ?>
        <?php echo $this->getJQuery() . "\n"; ?>