From 6b48d45114aad7cd152176e146d763dfbbe2b139 Mon Sep 17 00:00:00 2001 From: ischommer Date: Thu, 19 Nov 2009 20:32:20 +0000 Subject: [PATCH] ENHANCEMENT #3123: Use ajax for mod_rewrite testing (from r66906) (from r92228) git-svn-id: svn://svn.silverstripe.com/silverstripe/open/phpinstaller/branches/2.4@92270 467b73ca-7a2a-4603-9d3b-597d59a354a9 --- install.php | 129 ++++++++++++++++++++++++---------------------------- 1 file changed, 60 insertions(+), 69 deletions(-) diff --git a/install.php b/install.php index ec98e40..dea016f 100644 --- a/install.php +++ b/install.php @@ -629,10 +629,32 @@ class Installer extends InstallRequirements { function install($config) { if(isset($_SERVER['HTTP_HOST'])) { ?> -

Installing SilverStripe...

-

I am now running through the installation steps (this should take about 30 seconds)

-

If you receive a fatal error, refresh this page to continue the installation - + + PHP 5 is required + + + + + + + +

+
+ + + +
+ +
+
+

Installing SilverStripe...

+

I am now running through the installation steps (this should take about 30 seconds)

+

If you receive a fatal error, refresh this page to continue the installation

+
    +statusMessage("Checking mod_rewrite works..."); - $modRewriteWorks = $this->checkModRewrite(); - } else { - $modRewriteWorks = true; - } $_SESSION['username'] = $config['admin']['username']; $_SESSION['password'] = $config['admin']['password']; - if($modRewriteWorks && !$this->errors) { + if(!$this->errors) { if(isset($_SERVER['HTTP_HOST'])) { - echo "

    Installed SilverStripe successfully. I will now try and direct you to - home/successfullyinstalled to confirm that the installation was successful.

    - - "; + $this->statusMessage("Checking that friendly URLs work..."); + $this->checkModRewrite(); } else { - echo "\nSilverStripe successfully installed\n"; + echo "\n\nSilverStripe successfully installed\n"; } } @@ -960,65 +973,43 @@ TEXT; } function checkModRewrite() { - if($this->performModRewriteTest() == true) { - return true; - } - - $this->createHtaccessAlternative(); - - if($this->performModRewriteTest() == false) { - echo "
  • ERROR: mod_rewrite not working, redirecting to mod_rewrite test page
  • "; - - $this->restoreHtaccess(); - - echo "I will now try and direct you to rewritetest to troubleshoot mod_rewrite

    - - "; - return false; - } - return true; - } - - function performModRewriteTest() { if(!isset($_SERVER['HTTP_HOST']) || !$_SERVER['HTTP_HOST']) { $this->statusMessage("Installer seems to be called from command-line, we're going to assume that rewriting is working."); return true; } - - $baseURL = dirname($_SERVER['SCRIPT_NAME']); - if($baseURL == "/") { - $baseURL = ""; - } - // Check if mod_rewrite works properly - $location = 'http://' . (isset($_SERVER['PHP_AUTH_USER']) ? "$_SERVER[PHP_AUTH_USER]:$_SERVER[PHP_AUTH_PW]@" : '') . $_SERVER['HTTP_HOST'] . $baseURL . '/InstallerTest/testrewrite'; - echo $location; - @$testrewriting = file_get_contents($location); - - if($testrewriting == 'OK') { - return true; - } - - // Workaround for 'URL file-access is disabled in the server configuration' using curl - if(function_exists('curl_init')) { - $ch = curl_init($location); - $fp = @fopen(dirname(tempnam('adfadsfdas','')) . '/rewritetest', "w"); - - if($fp) { - curl_setopt($ch, CURLOPT_FILE, $fp); - curl_setopt($ch, CURLOPT_HEADER, 0); - curl_exec($ch); - curl_close($ch); - fclose($fp); - $testrewriting = file_get_contents(dirname(tempnam('adfadsfdas','')) . '/rewritetest'); - unlink(dirname(tempnam('adfadsfdas','')) . '/rewritetest'); - if($testrewriting == 'OK') { - return true; + echo <<Testing... + + +HTML; } function var_export_array_nokeys($array) {