From 590b7a0f54be6708318f11928b01fe4d9ea1a616 Mon Sep 17 00:00:00 2001 From: Chad Horohoe Date: Mon, 12 Dec 2011 15:11:08 +0000 Subject: [PATCH] Separate Cli/Web logic for envCheckServer() per CR on r104576 --- includes/installer/CliInstaller.php | 7 ++----- includes/installer/Installer.php | 15 ++++++++------- includes/installer/WebInstaller.php | 4 ++++ 3 files changed, 14 insertions(+), 12 deletions(-) diff --git a/includes/installer/CliInstaller.php b/includes/installer/CliInstaller.php index 2dbeefe3f0..f9afbb20fb 100644 --- a/includes/installer/CliInstaller.php +++ b/includes/installer/CliInstaller.php @@ -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 ) { diff --git a/includes/installer/Installer.php b/includes/installer/Installer.php index 20429b7564..d7d71389a2 100644 --- a/includes/installer/Installer.php +++ b/includes/installer/Installer.php @@ -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 diff --git a/includes/installer/WebInstaller.php b/includes/installer/WebInstaller.php index bf2c18ccb2..519233e59f 100644 --- a/includes/installer/WebInstaller.php +++ b/includes/installer/WebInstaller.php @@ -1089,4 +1089,8 @@ class WebInstaller extends Installer { } return parent::envCheckPath(); } + + protected function envGetDefaultServer() { + return WebRequest::detectServer(); + } } -- 2.20.1