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;
*/
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, string $origin = '')
+ {
+ 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, 'origin' => $origin]);
+ }
+ }
+
/**
* Whether a offset exists
*
* @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]);
$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');
*
* 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")) {
{
$moduleName = $args->getModuleName();
+ $this->command = $moduleName;
+ $this->method = $args->getMethod();
+
/* Create the page content.
* Calls all hooks which are including content operations
*
}
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);
}
}