X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=src%2FApp%2FPage.php;h=c78d0f9e0c53b5f95a4a34774b62bfdfcf9f52a0;hb=ed350e472fb66e78cd9da066dc8684784bfc6c07;hp=0d7b1643635cff55cab6248a8ff96c464f245fb8;hpb=3d8e82d95d9cc76b45a8db301b22c4111f335e1c;p=friendica.git diff --git a/src/App/Page.php b/src/App/Page.php index 0d7b164363..c78d0f9e0c 100644 --- a/src/App/Page.php +++ b/src/App/Page.php @@ -30,8 +30,11 @@ use Friendica\Core\Config\Capability\IManageConfigValues; use Friendica\Core\PConfig\Capability\IManagePersonalConfigValues; use Friendica\Core\Hook; use Friendica\Core\L10n; +use Friendica\Core\Logger; use Friendica\Core\Renderer; +use Friendica\Core\System; use Friendica\Core\Theme; +use Friendica\Module\Response; use Friendica\Network\HTTPException; use Friendica\Util\Network; use Friendica\Util\Strings; @@ -76,14 +79,37 @@ class Page implements ArrayAccess */ private $basePath; + private $timestamp = 0; + private $command = ''; + private $method = ''; + /** * @param string $basepath The Page basepath */ public function __construct(string $basepath) { + $this->timestamp = microtime(true); $this->basePath = $basepath; } + public function setLogging(string $command, string $method) + { + $this->command = $command; + $this->method = $method; + } + + public function logRuntime(IManageConfigValues $config) + { + if (in_array($this->command, $config->get('system', 'runtime_ignore'))) { + return; + } + + $runtime = number_format(microtime(true) - $this->timestamp, 3); + if ($runtime > $config->get('system', 'runtime_loglimit')) { + Logger::debug('Runtime', ['method' => $this->method, 'command' => $this->command, 'runtime' => $runtime]); + } + } + /** * Whether a offset exists * @@ -229,7 +255,7 @@ class Page implements ArrayAccess $shortcut_icon = $config->get('system', 'shortcut_icon'); if ($shortcut_icon == '') { - $shortcut_icon = 'images/friendica-32.png'; + $shortcut_icon = 'images/friendica.svg'; } $touch_icon = $config->get('system', 'touch_icon'); @@ -419,6 +445,9 @@ class Page implements ArrayAccess { $moduleName = $args->getModuleName(); + $this->command = $moduleName; + $this->method = $args->getMethod(); + /* Create the page content. * Calls all hooks which are including content operations * @@ -503,11 +532,7 @@ class Page implements ArrayAccess } if ($_GET["mode"] == "raw") { - header("Content-type: text/html; charset=utf-8"); - - echo substr($target->saveHTML(), 6, -8); - - exit(); + System::httpExit(substr($target->saveHTML(), 6, -8), Response::TYPE_HTML); } }