diff --git a/app/class/Config.php b/app/class/Config.php index ce71abb..dde7f03 100644 --- a/app/class/Config.php +++ b/app/class/Config.php @@ -28,6 +28,7 @@ abstract class Config protected static bool $externallinkblank = true; protected static bool $internallinkblank = false; protected static bool $urllinker = true; + protected static bool $urlchecker = true; protected static bool $deletelinktocache = true; protected static int $defaultprivacy = 0; protected static string $homepage = 'default'; @@ -297,6 +298,11 @@ public static function urllinker(): bool return self::$urllinker; } + public static function urlchecker(): bool + { + return self::$urlchecker; + } + public static function deletelinktocache(): bool { return self::$deletelinktocache; @@ -536,6 +542,11 @@ public static function seturllinker($urllinker) self::$urllinker = boolval($urllinker); } + public static function seturlchecker($urlchecker) + { + self::$urlchecker = boolval($urlchecker); + } + public static function setdeletelinktocache($deletelinktocache) { self::$deletelinktocache = boolval($deletelinktocache); diff --git a/app/class/Controllerhome.php b/app/class/Controllerhome.php index c0513f1..20ae34d 100644 --- a/app/class/Controllerhome.php +++ b/app/class/Controllerhome.php @@ -94,6 +94,7 @@ public function desktop() $vars['deepsearch'] = $deepsearch['regex']; $vars['searchopt'] = $deepsearch['searchopt']; $vars['display'] = $display; + $vars['urlchecker'] = Config::urlchecker(); if ($display === 'graph') { $vars['layout'] = $_GET['layout'] ?? 'cose-bilkent'; @@ -327,7 +328,7 @@ public function multiedit() public function multirender(): void { $pagelist = $_POST['pagesid'] ?? []; - $checkurl = boolval($_POST['checkurl']); + $checkurl = Config::urlchecker() && boolval($_POST['checkurl']); $total = count($pagelist); $pagelist = $this->pagemanager->pagelistbyid($pagelist); $count = 0; diff --git a/app/class/Controllerpage.php b/app/class/Controllerpage.php index 7a889f6..c48bc67 100644 --- a/app/class/Controllerpage.php +++ b/app/class/Controllerpage.php @@ -75,7 +75,8 @@ public function render(string $page): void if ($this->importpage() && $this->user->iseditor()) { try { - $this->page = $this->pagemanager->renderpage($this->page, $this->router, new Serviceurlchecker(8)); + $urlchecker = Config::urlchecker() ? new Serviceurlchecker(8) : null; + $this->page = $this->pagemanager->renderpage($this->page, $this->router, $urlchecker); } catch (RuntimeException $e) { Logger::errorex($e); } @@ -186,7 +187,8 @@ public function read(string $page): void $oldlinkto = $this->page->linkto(); } try { - $this->page = $this->pagemanager->renderpage($this->page, $this->router, new Serviceurlchecker(3)); + $urlchecker = Config::urlchecker() ? new Serviceurlchecker(8) : null; + $this->page = $this->pagemanager->renderpage($this->page, $this->router, $urlchecker); } catch (RuntimeException $e) { Logger::errorex($e); } diff --git a/app/view/templates/admin.php b/app/view/templates/admin.php index 3affe76..254f7a2 100644 --- a/app/view/templates/admin.php +++ b/app/view/templates/admin.php @@ -287,6 +287,17 @@ form="admin">

+

+ + + form="admin"> +

+ +

+ URL checker try to reach URLs online to see if they are alives. + This may cause longer render time if recently activated. +

+

Markdown Parser

diff --git a/app/view/templates/home.php b/app/view/templates/home.php index db26fa3..140d225 100644 --- a/app/view/templates/home.php +++ b/app/view/templates/home.php @@ -32,7 +32,8 @@ 'colors' => $colors, 'queryaddress' => $queryaddress, 'matchedbookmarks' => $matchedbookmarks, - 'editablebookmarks' => $editablebookmarks + 'editablebookmarks' => $editablebookmarks, + 'urlchecker' => $urlchecker, ]); ?>