Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

MINOR Simplified discovery of webserver during install (from r108568)

git-svn-id: svn://svn.silverstripe.com/silverstripe/open/phpinstaller/trunk@112408 467b73ca-7a2a-4603-9d3b-597d59a354a9
  • Loading branch information...
commit f9d29bd9d65f8d535911bb956891276ca3d5d61b 1 parent 2a78807
sminnee authored
Showing with 19 additions and 25 deletions.
  1. +19 −25 install.php
44 install.php
View
@@ -288,40 +288,34 @@ function checkAdminConfig($adminConfig) {
* @return boolean
*/
function isIIS() {
- if(isset($_SERVER['SERVER_SOFTWARE'])) {
- if(strpos($_SERVER['SERVER_SOFTWARE'], 'IIS/7') !== false) {
- return true;
- }
+ if(strpos($this->findWebserver(), 'IIS/7') !== false) {
+ return true;
+ } else {
+ return false;
}
- return false;
}
-
+
function isApache() {
- $signature = !empty($_SERVER['SERVER_SIGNATURE'])
- ? $_SERVER['SERVER_SIGNATURE']
- : @$_SERVER['SERVER_SOFTWARE'];
-
- $signature = strip_tags(trim($signature));
- if($signature && strpos($signature, 'Apache') !== false) {
+ if(strpos($this->findWebserver(), 'Apache') !== false) {
return true;
} else {
return false;
}
}
+ /**
+ * Find the webserver software running on the PHP host.
+ * @return string Server software ("Unknown" if not able to find)
+ */
function findWebserver() {
- $webserver = strip_tags(trim(@$_SERVER['SERVER_SIGNATURE']));
- if(!$webserver) {
- if(isset($_SERVER['SERVER_SOFTWARE'])) {
- if(strpos($_SERVER['SERVER_SOFTWARE'], 'IIS/7') !== false ||
- strpos($_SERVER['SERVER_SOFTWARE'], 'Apache') !== false) {
- $webserver = $_SERVER['SERVER_SOFTWARE'];
- }
- } else {
- $webserver = "I can't tell what webserver you are running";
- }
- }
- return $webserver;
+ // Try finding from SERVER_SIGNATURE or SERVER_SOFTWARE
+ $webserver = @$_SERVER['SERVER_SIGNATURE'];
+ if(!$webserver) $webserver = @$_SERVER['SERVER_SOFTWARE'];
+
+ // If we still can't find it, this is a completely unknown server
+ if(!$webserver) $webserver = 'Unknown';
+
+ return strip_tags(trim($webserver));
}
/**
@@ -934,7 +928,7 @@ function install($config) {
if(isset($_SESSION['StatsID']) && $_SESSION['StatsID']) {
$url .= '&ID=' . $_SESSION['StatsID'];
}
-
+
@$_SESSION['StatsID'] = file_get_contents($url);
}
Please sign in to comment.
Something went wrong with that request. Please try again.