Separate Cli/Web logic for envCheckServer() per CR on r104576
authorChad Horohoe <demon@users.mediawiki.org>
Mon, 12 Dec 2011 15:11:08 +0000 (15:11 +0000)
committerChad Horohoe <demon@users.mediawiki.org>
Mon, 12 Dec 2011 15:11:08 +0000 (15:11 +0000)
includes/installer/CliInstaller.php
includes/installer/Installer.php
includes/installer/WebInstaller.php

index 2dbeefe..f9afbb2 100644 (file)
@@ -183,11 +183,8 @@ class CliInstaller extends Installer {
                return parent::envCheckPath();
        }
 
-       protected function envCheckServer( $srv = null ) {
-               if ( $this->getVar( 'wgServer' ) ) {
-                       $srv = $this->getVar( 'wgServer' );
-               }
-               return parent::envCheckServer( $srv );
+       protected function envGetDefaultServer() {
+               return $this->getVar( 'wgServer' );
        }
 
        public function dirIsExecutable( $dir, $url ) {
index 20429b7..d7d7138 100644 (file)
@@ -855,17 +855,18 @@ abstract class Installer {
        /**
         * Environment check for the server hostname.
         */
-       protected function envCheckServer( $srv = null ) {
-               if ( $srv ) {
-                       // wgServer was pre-defined, perhaps by the cli installer
-                       $server = $srv;
-               } else {
-                       $server = WebRequest::detectServer();
-               }
+       protected abstract function envCheckServer() {
+               $server = $this->envGetDefaultServer();
                $this->showMessage( 'config-using-server', $server );
                $this->setVar( 'wgServer', $server );
        }
 
+       /**
+        * Helper function to be called from envCheckServer()
+        * @return String
+        */
+       protected abstract function envGetDefaultServer();
+
        /**
         * Environment check for setting $IP and $wgScriptPath.
         * @return bool
index bf2c18c..519233e 100644 (file)
@@ -1089,4 +1089,8 @@ class WebInstaller extends Installer {
                }
                return parent::envCheckPath();
        }
+
+       protected function envGetDefaultServer() {
+               return WebRequest::detectServer();
+       }
 }