]> gitweb.fluxo.info Git - lorea/elgg.git/commitdiff
Closes #2129 - installer now works with web servers besides Apache - tested with...
authorcash <cash@36083f99-b078-4883-b0ff-0f9b5a30f544>
Sat, 2 Oct 2010 15:20:56 +0000 (15:20 +0000)
committercash <cash@36083f99-b078-4883-b0ff-0f9b5a30f544>
Sat, 2 Oct 2010 15:20:56 +0000 (15:20 +0000)
git-svn-id: http://code.elgg.org/elgg/trunk@6998 36083f99-b078-4883-b0ff-0f9b5a30f544

install/ElggInstaller.php
languages/en.php

index 6d155357222cc75ff303ace325449fb4e566b229..359ed8f99d9e651794099c09c1ed63dd57f6c812 100644 (file)
@@ -122,15 +122,15 @@ class ElggInstaller {
                // check PHP parameters and libraries
                $this->checkPHP($report);
 
-               // @todo - rewrite this to handle different web servers
-               // attempt to create .htaccess file
-               $htaccessExists = $this->createHtaccess($report);
-
-               // check rewrite module
-               if ($htaccessExists) {
-                       $this->checkRewriteModule($report);
+               // check rewrite. If failure, create .htaccess and try again. 
+               $rewriteResult = $this->checkRewriteRules($report);
+               if ($rewriteResult == FALSE) {
+                       $htaccessExists = $this->createHtaccess($report);
+                       if ($htaccessExists) {
+                               $this->checkRewriteRules($report);
+                       }
                }
-               
+
                // check for existence of settings file
                if ($this->checkSettingsFile() != TRUE) {
                        // no file, so check permissions on engine directory
@@ -871,11 +871,11 @@ class ElggInstaller {
        }
 
        /**
-        * Confirm that Apache's rewrite module and AllowOverride are set up
+        * Confirm that the rewrite rules are firing
         * @param array $report
         * @return bool
         */
-       protected function checkRewriteModule(&$report) {
+       protected function checkRewriteRules(&$report) {
                global $CONFIG;
 
                $url = "{$CONFIG->wwwroot}modrewrite.php";
@@ -885,13 +885,14 @@ class ElggInstaller {
                        $ch = curl_init();
                        curl_setopt($ch, CURLOPT_URL, $url);
                        curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
+                       curl_setopt($ch, CURLOPT_TIMEOUT, 10);
                        $response = curl_exec($ch);
                        curl_close($ch);
                        $result = $response === 'success';
                } else if (ini_get('allow_url_fopen')) {
                        // use file_get_contents as fallback
-                       $data = file_get_contents($url);
-                       $result = $data === 'success';
+                       $response = file_get_contents($url);
+                       $result = $response === 'success';
                } else {
                        $report['htaccess'] = array(
                                array(
@@ -910,6 +911,9 @@ class ElggInstaller {
                                )
                        );
                } else {
+                       if (strpos($response, 'No input file specified.') !== FALSE) {
+                               // nginx with no or bad rewrite rules
+                       }
                        $report['htaccess'] = array(
                                array(
                                        'severity' => 'failure',
index d92aff61e7aeb9f4ccb817b8c08828827db01631..1083788d0659c206717a0732d571d7735a6e96b5 100644 (file)
@@ -974,6 +974,7 @@ If you are ready to proceed, click the Next button.",
        'install:check:htaccess_exists' => 'There is an .htaccess file in the root directory of Elgg. Please remove it.',
        'install:check:htaccess_fail' => 'Unable to create an .htaccess file in the root directory of Elgg. You will need to copy htaccess_dist to .htaccess',
        'install:check:rewrite:success' => 'The test of the rewrite rules was successful.',
+       'install:check:rewrite:fail' => 'The URL rewrite test failed.',
 
        'install:check:enginedir' => 'Your web server does not have permission to create the settings.php file in the engine directory. You have two choices: