thirtybees / statsmodule

Academic Free License v3.0
0 stars 6 forks source link

Uses $_SERVER['REDIRECT_URL'], which Nginx doesn't provide. #7

Closed Traumflug closed 6 years ago

Traumflug commented 6 years ago

Follow up on https://github.com/thirtybees/thirtybees/issues/474

Usage doesn't appear to be crucial, so simply removing it appears to be the right thing:

diff --git a/stats/pagesnotfound.php b/stats/pagesnotfound.php
index 99f3481..ec5c966 100644
--- a/stats/pagesnotfound.php
+++ b/stats/pagesnotfound.php
@@ -171,9 +171,7 @@ class PagesNotFound extends StatsModule

     public function hookTop($params)
     {
-        if (strstr($_SERVER['REQUEST_URI'], '404.php') && isset($_SERVER['REDIRECT_URL']))
-            $_SERVER['REQUEST_URI'] = $_SERVER['REDIRECT_URL'];
-        if (!Validate::isUrl($request_uri = $_SERVER['REQUEST_URI']) || strstr($_SERVER['REQUEST_URI'], '-admin404'))
+        if (!Validate::isUrl($request_uri = $_SERVER['REQUEST_URI']) || strpos($_SERVER['REQUEST_URI'], '-admin404') !== false)
             return;

         if (get_class(Context::getContext()->controller) == 'PageNotFoundController') {

(this also replaces strstr() with the faster strpos())

Dh42 commented 6 years ago

Works for me. This is pretty old code.

firstred commented 6 years ago

Pure nginx or in proxy mode?

Traumflug commented 6 years ago

Pure nginx or in proxy mode?

@dvershinin should be able to answer this.

dvershinin commented 6 years ago

@firstred pure nginx (as in just nginx with PHP-FPM, fastcgi_pass to PHP, not proxy_pass anywhere).

Traumflug commented 6 years ago

This should be fixed and going into the 2.0.1 release in a minute. Thank you to everybody.