Better error message

This commit is contained in:
markseu 2017-12-13 13:51:28 +01:00
parent 3fe70c58d4
commit 6ffcc8ad3b
2 changed files with 9 additions and 3 deletions

View file

@ -641,7 +641,11 @@ class YellowPage
{
$this->error(500, "Folder '".dirname($this->fileName)."' may not contain subfolders!");
}
if($this->yellow->toolbox->isRequestSelf()) $this->error(500, "Rewrite module not enabled on this server!");
if($this->yellow->toolbox->isRequestSelf())
{
$serverVersion = $this->yellow->toolbox->getServerVersion(true);
$this->error(500, "Rewrite module not working on $serverVersion web server!");
}
if($this->yellow->getRequestHandler()=="core" && $this->isExisting("redirect") && $this->statusCode==200)
{
$location = $this->yellow->lookup->normaliseLocation($this->get("redirect"), $this->location);
@ -2635,10 +2639,11 @@ class YellowLookup
class YellowToolbox
{
// Return server version from current HTTP request
function getServerVersion()
function getServerVersion($shortFormat = false)
{
$serverVersion = strtoupperu(PHP_SAPI)." ".PHP_OS;
if(preg_match("/^(\S+)/", $_SERVER["SERVER_SOFTWARE"], $matches)) $serverVersion = $matches[1]." ".PHP_OS;
if($shortFormat && preg_match("/^(\pL+)/u", $serverVersion, $matches)) $serverVersion = $matches[1];
return $serverVersion;
}

View file

@ -598,8 +598,9 @@ class YellowUpdate
$status = trim($_REQUEST["status"]);
if($status=="install")
{
$serverVersion = $this->yellow->toolbox->getServerVersion(true);
$status = $this->checkServerRewrite($scheme, $address, $base, $location, $fileName) ? "ok" : "error";
if($status=="error") $this->yellow->page->error(500, "Rewrite module not working on this server!");
if($status=="error") $this->yellow->page->error(500, "Rewrite module not working on $serverVersion web server!");
}
if($status=="ok")
{