]> gitweb.fluxo.info Git - lorea/elgg.git/commitdiff
Fixes #4491. Automatic fallback to JS to test rewrite rules during installation.
authorBrett Profitt <brett.profitt@gmail.com>
Sat, 15 Dec 2012 17:58:55 +0000 (12:58 -0500)
committerBrett Profitt <brett.profitt@gmail.com>
Sat, 15 Dec 2012 17:58:55 +0000 (12:58 -0500)
install/ElggRewriteTester.php
install/js/install.js
install/languages/en.php
views/installation/install/pages/requirements.php

index c01510f601a43886043ca271186fef57522b3873..ab68da2b79b40acd9d1f3fbc601e20c15470c390 100644 (file)
@@ -154,6 +154,8 @@ class ElggRewriteTester {
 
                if ($this->serverSupportsRemoteRead == FALSE) {
                        $msg = elgg_echo('install:warning:rewrite:unknown', array($url));
+                       $msg .= elgg_view('install/js_rewrite_check', array('url' => $url));
+                       
                        return array(
                                'severity' => 'warning',
                                'message' => $msg,
@@ -165,6 +167,8 @@ class ElggRewriteTester {
                        $msg = "$serverString\n\n";
                        if (!isset($this->htaccessIssue)) {
                                $msg .= elgg_echo('install:error:rewrite:allowoverride');
+                               $msg .= elgg_view('install/js_rewrite_check', array('url' => $url));
+                       
                                return array(
                                        'severity' => 'failure',
                                        'message' => $msg,
index 49b2be10c641041e6e70c980a04d2012d55d91a0..37e5b0dc3251fdc0f09ce1dc2109be16a64192cd 100644 (file)
@@ -19,3 +19,24 @@ $(function() {
                }
        });
 });
+
+elgg = {
+       installer: {}
+};
+
+/**
+ * Check the rewrite address for "success" and then allows the installation to proceed.
+ */
+elgg.installer.rewriteTest = function(url, success_msg, nextURL) {
+       $.ajax(url, {
+               success: function(data, status, xhr) {
+                       if (data == 'success') {
+                               $('.elgg-require-rewrite li').attr('class', 'pass');
+                               $('.elgg-require-rewrite li').html('<p>' + success_msg + '</p>');
+                               $('.elgg-install-nav a.elgg-state-disabled')
+                                       .removeClass('elgg-state-disabled')
+                                       .attr('href', nextURL);
+                       }
+               }
+       });
+}
index 3a692e02091d79c1771282d774fc2ff48b64ee81..b2583fbc99961bb9822640ada6ac6d81a85adbec 100644 (file)
@@ -154,7 +154,7 @@ If you are ready to proceed, click the Next button.",
        'install:error:rewrite:htaccess:cannot_copy' => 'A unknown error occurred while creating the .htaccess file. You need to manually copy htaccess_dist to .htaccess in Elgg\'s directory.',
        'install:error:rewrite:altserver' => 'The rewrite rules test failed. You need to configure your web server with Elgg\'s rewrite rules and try again.',
        'install:error:rewrite:unknown' => 'Oof. We couldn\'t figure out what kind of web server is running on your server and it failed the rewrite rules. We cannot offer any specific advice. Please check the troubleshooting link.',
-       'install:warning:rewrite:unknown' => 'Your server does not support automatic testing of the rewrite rules. You can continue the installation, but you may experience problems with your site. You can manually test the rewrite rules by clicking this link: <a href="%s" target="_blank">test</a>. You will see the word success if the rules are working.',
+       'install:warning:rewrite:unknown' => 'Your server does not support automatic testing of the rewrite rules and your browser does not support checking via JavaScript. You can continue the installation, but you may experience problems with your site. You can manually test the rewrite rules by clicking this link: <a href="%s" target="_blank">test</a>. You will see the word success if the rules are working.',
 );
 
 add_translation("en", $english);
index 06f309c909d1e201ca1daf4c34380fa4a99f971c..3f0941c95151c958c04e1a2a73e3879f4853bf7c 100644 (file)
@@ -29,11 +29,11 @@ foreach ($report as $category => $checks) {
        echo "</ul>";
 }
 
-$vars['refresh'] = TRUE;
+$vars['refresh'] = true;
 
 // cannot advance to next step with a failure
 if ($vars['num_failures'] != 0) {
-       $vars['advance'] = FALSE;
+       $vars['advance'] = false;
 }
 
 echo elgg_view('install/nav', $vars);