mirror of
https://github.com/getformwork/formwork.git
synced 2025-01-17 21:49:04 +01:00
Avoid tracking visit to maintenance, unpublished and not routable pages
This commit is contained in:
parent
ee1be699fc
commit
834bcfc870
@ -28,9 +28,13 @@ class PageController extends AbstractController
|
|||||||
|
|
||||||
public function load(RouteParams $routeParams, Statistics $statistics): Response
|
public function load(RouteParams $routeParams, Statistics $statistics): Response
|
||||||
{
|
{
|
||||||
|
$trackable = $this->config->get('system.statistics.enabled');
|
||||||
|
|
||||||
if ($this->site->get('maintenance.enabled') && !$this->app->panel()?->isLoggedIn()) {
|
if ($this->site->get('maintenance.enabled') && !$this->app->panel()?->isLoggedIn()) {
|
||||||
if ($this->site->get('maintenance.page') !== null) {
|
$trackable = false;
|
||||||
$route = $this->site->get('maintenance.page')->route();
|
|
||||||
|
if (($maintenancePage = $this->site->get('maintenance.page')) instanceof Page) {
|
||||||
|
$route = $maintenancePage->route();
|
||||||
} else {
|
} else {
|
||||||
$status = ResponseStatus::ServiceUnavailable;
|
$status = ResponseStatus::ServiceUnavailable;
|
||||||
return new Response($this->view('errors.maintenance', ['status' => $status->code(), 'message' => $status->message()]), $status);
|
return new Response($this->view('errors.maintenance', ['status' => $status->code(), 'message' => $status->message()]), $status);
|
||||||
@ -70,11 +74,10 @@ class PageController extends AbstractController
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($this->config->get('system.statistics.enabled')) {
|
|
||||||
$statistics->trackVisit();
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($page->isPublished() && $page->routable()) {
|
if ($page->isPublished() && $page->routable()) {
|
||||||
|
if ($trackable) {
|
||||||
|
$statistics->trackVisit();
|
||||||
|
}
|
||||||
return $this->getPageResponse($page);
|
return $this->getPageResponse($page);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user