]> git.mxchange.org Git - friendica.git/blobdiff - src/App.php
Merge pull request #6531 from Ixiter/develop-theme-frio
[friendica.git] / src / App.php
index 793590bae43205ef14f88e6c25b8d37540ebeb20..0015405c46bea5892cc634282f50c6c87d62d3f8 100644 (file)
@@ -8,10 +8,9 @@ use Detection\MobileDetect;
 use DOMDocument;
 use DOMXPath;
 use Exception;
-use Friendica\Core\Logger;
 use Friendica\Database\DBA;
 use Friendica\Network\HTTPException\InternalServerErrorException;
-use Monolog;
+use Psr\Log\LoggerInterface;
 
 /**
  *
@@ -109,7 +108,7 @@ class App
        public $mobileDetect;
 
        /**
-        * @var Monolog\Logger The current logger of this App
+        * @var LoggerInterface The current logger of this App
         */
        private $logger;
 
@@ -121,6 +120,7 @@ class App
         * @see initHead()
         *
         * @param string $path
+        * @throws InternalServerErrorException
         */
        public function registerStylesheet($path)
        {
@@ -137,6 +137,7 @@ class App
         * @see initFooter()
         *
         * @param string $path
+        * @throws InternalServerErrorException
         */
        public function registerFooterScript($path)
        {
@@ -153,13 +154,13 @@ class App
        /**
         * @brief App constructor.
         *
-        * @param string $basePath  Path to the app base folder
-        * @param Monolog\Logger    Logger of this application
-        * @param bool   $isBackend Whether it is used for backend or frontend (Default true=backend)
+        * @param string           $basePath  Path to the app base folder
+        * @param LoggerInterface  $logger    Logger of this application
+        * @param bool             $isBackend Whether it is used for backend or frontend (Default true=backend)
         *
         * @throws Exception if the Basepath is not usable
         */
-       public function __construct($basePath, $logger, $isBackend = true)
+       public function __construct($basePath, LoggerInterface $logger, $isBackend = true)
        {
                $this->logger = $logger;
 
@@ -314,7 +315,7 @@ class App
        /**
         * Returns the Logger of the Application
         *
-        * @return Monolog\Logger The Logger
+        * @return LoggerInterface The Logger
         * @throws InternalServerErrorException when the logger isn't created
         */
        public function getLogger()
@@ -354,7 +355,7 @@ class App
 
                $this->process_id = Core\System::processID('log');
 
-               Logger::loadDefaultHandler($this->logger, $this);
+               Core\Logger::setLogger($this->logger);
        }
 
        /**
@@ -617,6 +618,7 @@ class App
         * finally for PWD
         *
         * @return string
+        * @throws InternalServerErrorException
         */
        public function getBasePath()
        {
@@ -676,6 +678,7 @@ class App
         *
         * @param bool $ssl Whether to append http or https under SSL_POLICY_SELFSIGN
         * @return string Friendica server base URL
+        * @throws InternalServerErrorException
         */
        public function getBaseURL($ssl = false)
        {
@@ -709,6 +712,7 @@ class App
         * Clears the baseurl cache to prevent inconsistencies
         *
         * @param string $url
+        * @throws InternalServerErrorException
         */
        public function setBaseURL($url)
        {
@@ -882,6 +886,7 @@ class App
         * @param string $origURL
         *
         * @return string The cleaned url
+        * @throws InternalServerErrorException
         */
        public function removeBaseURL($origURL)
        {
@@ -935,6 +940,7 @@ class App
         * Returns the current UserAgent as a String
         *
         * @return string the UserAgent as a String
+        * @throws InternalServerErrorException
         */
        public function getUserAgent()
        {
@@ -1058,6 +1064,7 @@ class App
         * @brief Checks if the minimal memory is reached
         *
         * @return bool Is the memory limit reached?
+        * @throws InternalServerErrorException
         */
        public function isMinMemoryReached()
        {
@@ -1102,6 +1109,7 @@ class App
         * @brief Checks if the maximum load is reached
         *
         * @return bool Is the load reached?
+        * @throws InternalServerErrorException
         */
        public function isMaxLoadReached()
        {
@@ -1134,6 +1142,7 @@ class App
         *
         * @param string $command The command to execute
         * @param array  $args    Arguments to pass to the command ( [ 'key' => value, 'key2' => value2, ... ]
+        * @throws InternalServerErrorException
         */
        public function proc_run($command, $args)
        {
@@ -1190,7 +1199,10 @@ class App
        /**
         * @brief Checks if a given directory is usable for the system
         *
+        * @param      $directory
+        * @param bool $check_writable
         * @return boolean the directory is usable
+        * @throws Exception
         */
        public static function isDirectoryUsable($directory, $check_writable = true)
        {
@@ -1368,6 +1380,7 @@ class App
         * Generates the site's default sender email address
         *
         * @return string
+        * @throws InternalServerErrorException
         */
        public function getSenderEmailAddress()
        {
@@ -1388,6 +1401,7 @@ class App
         * Returns the current theme name.
         *
         * @return string the name of the current theme
+        * @throws InternalServerErrorException
         */
        public function getCurrentTheme()
        {
@@ -1469,6 +1483,7 @@ class App
         * Provide a sane default if nothing is chosen or the specified theme does not exist.
         *
         * @return string
+        * @throws InternalServerErrorException
         */
        public function getCurrentThemeStylesheetPath()
        {
@@ -1854,14 +1869,14 @@ class App
                                // And then append it to the target
                                $target->documentElement->appendChild($item);
                        }
-               }
 
-               if (isset($_GET["mode"]) && ($_GET["mode"] == "raw")) {
-                       header("Content-type: text/html; charset=utf-8");
+                       if ($_GET["mode"] == "raw") {
+                               header("Content-type: text/html; charset=utf-8");
 
-                       echo substr($target->saveHTML(), 6, -8);
+                               echo substr($target->saveHTML(), 6, -8);
 
-                       exit();
+                               exit();
+                       }
                }
 
                $page    = $this->page;
@@ -1930,7 +1945,7 @@ class App
         * Should only be used if it isn't clear if the URL is either internal or external
         *
         * @param string $toUrl The target URL
-        *
+        * @throws InternalServerErrorException
         */
        public function redirect($toUrl)
        {