1
0

and more selftest fixes...

This commit is contained in:
Mike Schwörer 2020-01-20 18:36:33 +01:00
parent d390250351
commit 438fcc101a
Signed by: Mikescher
GPG Key ID: D3C7172E0A70F8CF
3 changed files with 27 additions and 27 deletions

View File

@ -7,31 +7,31 @@ $site->init();
$URL_RULES = $URL_RULES =
[ [
[ 'url' => [], 'target' => 'main.php', 'options' => [ 'http' ], 'parameter' => [ ], ], [ 'url' => [], 'target' => 'main.php', 'options' => [ ], 'parameter' => [ ], ],
[ 'url' => ['index'], 'target' => 'main.php', 'options' => [ 'http' ], 'parameter' => [ ], ], [ 'url' => ['index'], 'target' => 'main.php', 'options' => [ ], 'parameter' => [ ], ],
[ 'url' => ['index.php'], 'target' => 'main.php', 'options' => [ 'http' ], 'parameter' => [ ], ], [ 'url' => ['index.php'], 'target' => 'main.php', 'options' => [ ], 'parameter' => [ ], ],
[ 'url' => ['msmain', 'index'], 'target' => 'main.php', 'options' => [ 'http' ], 'parameter' => [ ], ], [ 'url' => ['msmain', 'index'], 'target' => 'main.php', 'options' => [ ], 'parameter' => [ ], ],
[ 'url' => ['about'], 'target' => 'about.php', 'options' => [ 'http' ], 'parameter' => [ ], ], [ 'url' => ['about'], 'target' => 'about.php', 'options' => [ ], 'parameter' => [ ], ],
[ 'url' => ['msmain', 'about'], 'target' => 'about.php', 'options' => [ 'http' ], 'parameter' => [ ], ], [ 'url' => ['msmain', 'about'], 'target' => 'about.php', 'options' => [ ], 'parameter' => [ ], ],
[ 'url' => ['login'], 'target' => 'login.php', 'options' => [ 'http' ], 'parameter' => [ 'login_target' => '/' ], ], [ 'url' => ['login'], 'target' => 'login.php', 'options' => [ ], 'parameter' => [ 'login_target' => '/' ], ],
[ 'url' => ['logout'], 'target' => 'logout.php', 'options' => [ 'http' ], 'parameter' => [ 'logout_target' => '/' ], ], [ 'url' => ['logout'], 'target' => 'logout.php', 'options' => [ ], 'parameter' => [ 'logout_target' => '/' ], ],
[ 'url' => ['programs'], 'target' => 'programs_list.php', 'options' => [ 'http' ], 'parameter' => [ 'categoryfilter' => '' ], ], [ 'url' => ['programs'], 'target' => 'programs_list.php', 'options' => [ ], 'parameter' => [ 'categoryfilter' => '' ], ],
[ 'url' => ['programs', 'index'], 'target' => 'programs_list.php', 'options' => [ 'http' ], 'parameter' => [ 'categoryfilter' => '%GET%' ], ], [ 'url' => ['programs', 'index'], 'target' => 'programs_list.php', 'options' => [ ], 'parameter' => [ 'categoryfilter' => '%GET%' ], ],
[ 'url' => ['programs', 'index'], 'target' => 'programs_list.php', 'options' => [ 'http' ], 'parameter' => [ 'categoryfilter' => '' ], ], [ 'url' => ['programs', 'index'], 'target' => 'programs_list.php', 'options' => [ ], 'parameter' => [ 'categoryfilter' => '' ], ],
[ 'url' => ['programs', 'cat', '?{categoryfilter}'], 'target' => 'programs_list.php', 'options' => [ 'http' ], 'parameter' => [ 'categoryfilter' => '%URL%' ], ], [ 'url' => ['programs', 'cat', '?{categoryfilter}'], 'target' => 'programs_list.php', 'options' => [ ], 'parameter' => [ 'categoryfilter' => '%URL%' ], ],
[ 'url' => ['downloads', 'details.php'], 'target' => 'programs_list.php', 'options' => [ 'http' ], 'parameter' => [ 'categoryfilter' => '' ], ], [ 'url' => ['downloads', 'details.php'], 'target' => 'programs_list.php', 'options' => [ ], 'parameter' => [ 'categoryfilter' => '' ], ],
[ 'url' => ['downloads', 'downloads.php'], 'target' => 'programs_list.php', 'options' => [ 'http' ], 'parameter' => [ 'categoryfilter' => '' ], ], [ 'url' => ['downloads', 'downloads.php'], 'target' => 'programs_list.php', 'options' => [ ], 'parameter' => [ 'categoryfilter' => '' ], ],
[ 'url' => ['programs', 'view', '?{id}'], 'target' => 'programs_view.php', 'options' => [ 'http' ], 'parameter' => [ 'id' => '%URL%' ], ], [ 'url' => ['programs', 'view', '?{id}'], 'target' => 'programs_view.php', 'options' => [ ], 'parameter' => [ 'id' => '%URL%' ], ],
[ 'url' => ['programs', 'view'], 'target' => 'programs_view.php', 'options' => [ 'http' ], 'parameter' => [ 'id' => '%GET%' ], ], [ 'url' => ['programs', 'view'], 'target' => 'programs_view.php', 'options' => [ ], 'parameter' => [ 'id' => '%GET%' ], ],
[ 'url' => ['downloads', '?{id}'], 'target' => 'programs_download.php', 'options' => [ 'http' ], 'parameter' => [ 'id' => '%URL%' ], ], [ 'url' => ['downloads', '?{id}'], 'target' => 'programs_download.php', 'options' => [ ], 'parameter' => [ 'id' => '%URL%' ], ],
[ 'url' => ['programs', 'download', '?{id}'], 'target' => 'programs_download.php', 'options' => [ 'http' ], 'parameter' => [ 'id' => '%URL%' ], ], [ 'url' => ['programs', 'download', '?{id}'], 'target' => 'programs_download.php', 'options' => [ ], 'parameter' => [ 'id' => '%URL%' ], ],
[ 'url' => ['programs', 'download'], 'target' => 'programs_download.php', 'options' => [ 'http' ], 'parameter' => [ 'id' => '%GET%' ], ], [ 'url' => ['programs', 'download'], 'target' => 'programs_download.php', 'options' => [ ], 'parameter' => [ 'id' => '%GET%' ], ],
[ 'url' => ['books'], 'target' => 'books_list.php', 'options' => [ 'http' ], 'parameter' => [ ], ], [ 'url' => ['books'], 'target' => 'books_list.php', 'options' => [ ], 'parameter' => [ ], ],
[ 'url' => ['books', 'list'], 'target' => 'books_list.php', 'options' => [ 'http' ], 'parameter' => [ ], ], [ 'url' => ['books', 'list'], 'target' => 'books_list.php', 'options' => [ ], 'parameter' => [ ], ],
[ 'url' => ['books', 'view', '?{id}'], 'target' => 'books_view.php', 'options' => [ 'http' ], 'parameter' => [ 'id' => '%URL%' ], ], [ 'url' => ['books', 'view', '?{id}'], 'target' => 'books_view.php', 'options' => [ ], 'parameter' => [ 'id' => '%URL%' ], ],
[ 'url' => ['books', 'view', '?{id}', '*'], 'target' => 'books_view.php', 'options' => [ 'http' ], 'parameter' => [ 'id' => '%URL%' ], ], [ 'url' => ['books', 'view', '?{id}', '*'], 'target' => 'books_view.php', 'options' => [ ], 'parameter' => [ 'id' => '%URL%' ], ],
[ 'url' => ['update.php'], 'target' => 'api.php', 'options' => [ 'http', 'api' ], 'parameter' => [ 'cmd' => 'progs::updatecheck' ], ], [ 'url' => ['update.php'], 'target' => 'api.php', 'options' => [ 'http', 'api' ], 'parameter' => [ 'cmd' => 'progs::updatecheck' ], ],
[ 'url' => ['update.php', '?{Name}'], 'target' => 'api.php', 'options' => [ 'http', 'api' ], 'parameter' => [ 'cmd' => 'progs::updatecheck' ], ], [ 'url' => ['update.php', '?{Name}'], 'target' => 'api.php', 'options' => [ 'http', 'api' ], 'parameter' => [ 'cmd' => 'progs::updatecheck' ], ],

View File

@ -49,7 +49,7 @@ class AdventOfCode implements IWebsiteModule
{ {
$r = []; $r = [];
foreach ($this->staticData as $year => $yeardata) foreach ($yeardata as $daydata) $r []= $daydata; foreach ($this->staticData as $year => $yeardata) foreach ($yeardata as $daydata) $r []= $daydata;
return $this->staticData; return $r;
} }
public function listSingleYear($year) public function listSingleYear($year)

View File

@ -364,7 +364,7 @@ class SelfTest implements IWebsiteModule
'exception' => null, 'exception' => null,
]; ];
$url = $_SERVER['HTTP_HOST'] . $path; $url = 'https://' . $_SERVER['HTTP_HOST'] . $path;
$r = curl_http_request($url); $r = curl_http_request($url);
if ($r['statuscode'] !== $status) if ($r['statuscode'] !== $status)
@ -512,14 +512,14 @@ class SelfTest implements IWebsiteModule
$r = curl_http_request($url); $r = curl_http_request($url);
$count++; $count++;
if ($r['statuscode'] === 200) { $message .= "[".$prog['name']."] Request to '$url' succeeded" . "\n"; continue; } if ($r['statuscode'] === 200 || $r['statuscode'] === 301 || $r['statuscode'] === 302) { $message .= "[".$prog['name']."] Request to '$url' succeeded" . "\n"; continue; }
return return
[ [
'result' => self::STATUS_ERROR, 'result' => self::STATUS_ERROR,
'message' => '['.$prog['name'].'] failed: Request to returned wrong statuscode', 'message' => '['.$prog['name'].'] failed: Request to returned wrong statuscode',
'long' => 'Wrong HTTP Statuscode from "'.$url.'"' . "\n". 'long' => 'Wrong HTTP Statuscode from "'.$url.'"' . "\n".
"Expected: [200]\n". "Expected: [200|301|302]\n".
"Found: [".$r['statuscode'].']' . "\n" . "Found: [".$r['statuscode'].']' . "\n" .
"Response:\n" . $r['output'] . "\n". "Response:\n" . $r['output'] . "\n".
"Error [" . $r['errnum'] . "]:\n" . $r['errstr'], "Error [" . $r['errnum'] . "]:\n" . $r['errstr'],