X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=src%2FApp%2FPage.php;h=63314561191a672b9ed8aced03a99bb3382e62b5;hb=4deee0932c0b6a0d6443438c29dfc5f7781dda79;hp=305b2962b9c70e856ba31c67ab28394e82d1c457;hpb=23e5ae15e3a1b73cd89f65687db5acca122c5124;p=friendica.git diff --git a/src/App/Page.php b/src/App/Page.php index 305b2962b9..6331456119 100644 --- a/src/App/Page.php +++ b/src/App/Page.php @@ -80,8 +80,9 @@ class Page implements ArrayAccess private $basePath; private $timestamp = 0; - private $command = ''; private $method = ''; + private $module = ''; + private $command = ''; /** * @param string $basepath The Page basepath @@ -92,16 +93,26 @@ class Page implements ArrayAccess $this->basePath = $basepath; } - public function setLogging(string $command, string $method) + public function setLogging(string $method, string $module, string $command) { - $this->command = $command; $this->method = $method; + $this->module = $module; + $this->command = $command; } - public function logRuntime() + public function logRuntime(IManageConfigValues $config, string $origin = '') { - $runtime = number_format(microtime(true) - $this->timestamp, 3); - Logger::debug('Runtime', ['method' => $this->method, 'command' => $this->command, 'runtime' => $runtime]); + $ignore = $config->get('system', 'runtime_ignore'); + if (in_array($this->module, $ignore) || in_array($this->command, $ignore)) { + return; + } + + $signature = !empty($_SERVER['HTTP_SIGNATURE']); + $load = number_format(System::currentLoad(), 2); + $runtime = number_format(microtime(true) - $this->timestamp, 3); + if ($runtime > $config->get('system', 'runtime_loglimit')) { + Logger::debug('Runtime', ['method' => $this->method, 'module' => $this->module, 'runtime' => $runtime, 'load' => $load, 'origin' => $origin, 'signature' => $signature, 'request' => $_SERVER['REQUEST_URI'] ?? '']); + } } /** @@ -189,7 +200,7 @@ class Page implements ArrayAccess * @param string $media * @see Page::initHead() */ - public function registerStylesheet($path, string $media = 'screen') + public function registerStylesheet(string $path, string $media = 'screen') { $path = Network::appendQueryParam($path, ['v' => FRIENDICA_VERSION]); @@ -282,7 +293,7 @@ class Page implements ArrayAccess * * Taken from http://webcheatsheet.com/php/get_current_page_url.php */ - private function curPageURL() + private function curPageURL(): string { $pageURL = 'http'; if (!empty($_SERVER["HTTPS"]) && ($_SERVER["HTTPS"] == "on")) {