Installer: fix images in CSS
[lhc/web/wiklou.git] / includes / installer / WebInstaller.php
index 68c2ebe..156606a 100644 (file)
@@ -667,7 +667,7 @@ class WebInstaller extends Installer {
         * Get HTML for an info box with an icon.
         *
         * @param string $text Wikitext, get this with wfMessage()->plain()
-        * @param string|bool $icon Icon name, file in skins/common/images. Default: false
+        * @param string|bool $icon Icon name, file in mw-config/images. Default: false
         * @param string|bool $class Additional class name to add to the wrapper div. Default: false.
         *
         * @return string
@@ -675,11 +675,11 @@ class WebInstaller extends Installer {
        public function getInfoBox( $text, $icon = false, $class = false ) {
                $text = $this->parse( $text, true );
                $icon = ( $icon == false ) ?
-                       '../skins/common/images/info-32.png' :
-                       '../skins/common/images/' . $icon;
+                       'images/info-32.png' :
+                       'images/' . $icon;
                $alt = wfMessage( 'config-information' )->text();
 
-               return Html::infoBox( $text, $icon, $alt, $class, false );
+               return Html::infoBox( $text, $icon, $alt, $class );
        }
 
        /**
@@ -1154,6 +1154,25 @@ class WebInstaller extends Installer {
         * @return bool
         */
        public function envCheckPath() {
+               // PHP_SELF isn't available sometimes, such as when PHP is CGI but
+               // cgi.fix_pathinfo is disabled. In that case, fall back to SCRIPT_NAME
+               // to get the path to the current script... hopefully it's reliable. SIGH
+               $path = false;
+               if ( !empty( $_SERVER['PHP_SELF'] ) ) {
+                       $path = $_SERVER['PHP_SELF'];
+               } elseif ( !empty( $_SERVER['SCRIPT_NAME'] ) ) {
+                       $path = $_SERVER['SCRIPT_NAME'];
+               }
+               if ( $path === false ) {
+                       $this->showError( 'config-no-uri' );
+                       return false;
+               }
+
+               return parent::envCheckPath();
+       }
+
+       public function envPrepPath() {
+               parent::envPrepPath();
                // PHP_SELF isn't available sometimes, such as when PHP is CGI but
                // cgi.fix_pathinfo is disabled. In that case, fall back to SCRIPT_NAME
                // to get the path to the current script... hopefully it's reliable. SIGH
@@ -1175,14 +1194,8 @@ class WebInstaller extends Installer {
                        $this->setVar( 'wgLocalStylePath', "$scriptPath/skins" );
                        $this->setVar( 'wgExtensionAssetsPath', "$scriptPath/extensions" );
                        $this->setVar( 'wgUploadPath', "$scriptPath/images" );
-
-               } else {
-                       $this->showError( 'config-no-uri' );
-
-                       return false;
+                       $this->setVar( 'wgResourceBasePath', "$scriptPath" );
                }
-
-               return parent::envCheckPath();
        }
 
        /**