]> git.mxchange.org Git - friendica.git/blobdiff - src/App/Page.php
update FR translations THX kalon33
[friendica.git] / src / App / Page.php
index 8986d4aa91c11c6c7668998c4d88e03702966ddb..475681054a1254d1ea664df2102ddeb814a67260 100644 (file)
@@ -79,9 +79,9 @@ class Page implements ArrayAccess
         */
        private $basePath;
 
-       private $timestamp  = 0;
-       private $moduleName = '';
-       private $method     = '';
+       private $timestamp = 0;
+       private $command   = '';
+       private $method    = '';
 
        /**
         * @param string $basepath The Page basepath
@@ -92,16 +92,22 @@ class Page implements ArrayAccess
                $this->basePath = $basepath;
        }
 
-       public function setLogging(string $moduleName, string $method)
+       public function setLogging(string $command, string $method)
        {
-               $this->moduleName = $moduleName;
-               $this->method     = $method;
+               $this->command = $command;
+               $this->method  = $method;
        }
 
-       public function logRuntime()
+       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);
-               Logger::debug('Runtime', ['method' => $this->method, 'module' => $this->moduleName, 'runtime' => $runtime]);
+               if ($runtime > $config->get('system', 'runtime_loglimit')) {
+                       Logger::debug('Runtime', ['method' => $this->method, 'command' => $this->command, 'runtime' => $runtime, 'origin' => $origin]);
+               }
        }
 
        /**
@@ -189,7 +195,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 +288,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")) {
@@ -419,7 +425,6 @@ class Page implements ArrayAccess
                }
 
                echo $response->getBody();
-               $this->logRuntime();
        }
 
        /**
@@ -440,8 +445,8 @@ class Page implements ArrayAccess
        {
                $moduleName = $args->getModuleName();
 
-               $this->moduleName = $moduleName;
-               $this->method     = $args->getMethod();
+               $this->command = $moduleName;
+               $this->method  = $args->getMethod();
 
                /* Create the page content.
                 * Calls all hooks which are including content operations