]> git.mxchange.org Git - friendica.git/blobdiff - src/App.php
Move isBackend logic to App\Mode
[friendica.git] / src / App.php
index 49721547316880afa852b7691d873a9b4d256a41..1ea5e914cf595f2f8c5619eb119f27adc0a3729f 100644 (file)
@@ -9,7 +9,6 @@ use DOMDocument;
 use DOMXPath;
 use Exception;
 use Friendica\App\Arguments;
-use Friendica\App\Module;
 use Friendica\Core\Config\Cache\ConfigCache;
 use Friendica\Core\Config\Configuration;
 use Friendica\Core\Config\PConfiguration;
@@ -98,11 +97,6 @@ class App
         */
        private $baseURL;
 
-       /**
-        * @var bool true, if the call is from an backend node (f.e. worker)
-        */
-       private $isBackend;
-
        /**
         * @var string The name of the current theme
         */
@@ -148,11 +142,6 @@ class App
         */
        private $args;
 
-       /**
-        * @var App\Module
-        */
-       private $moduleClass;
-
        /**
         * Returns the current config cache of this node
         *
@@ -274,7 +263,7 @@ class App
         *
         * @throws Exception if the Basepath is not usable
         */
-       public function __construct(Database $database, Configuration $config, App\Mode $mode, App\Router $router, BaseURL $baseURL, LoggerInterface $logger, Profiler $profiler, L10n $l10n, Arguments $args, Module $module)
+       public function __construct(Database $database, Configuration $config, App\Mode $mode, App\Router $router, BaseURL $baseURL, LoggerInterface $logger, Profiler $profiler, L10n $l10n, Arguments $args)
        {
                $this->database = $database;
                $this->config   = $config;
@@ -285,7 +274,6 @@ class App
                $this->logger   = $logger;
                $this->l10n     = $l10n;
                $this->args = $args;
-               $this->isBackend = $this->checkBackend($module);
 
                $this->profiler->reset();
 
@@ -573,27 +561,17 @@ class App
                        $this->getBaseURL();
        }
 
-       /**
-        * Checks if the site is called via a backend process
-        *
-        * @param Module $module The pre-loaded module (just name, not class!)
-
-        * @return bool True, if the call is a backend call
-        */
-       private function checkBackend(Module $module)
-       {
-               return basename(($_SERVER['PHP_SELF'] ?? ''), '.php') !== 'index' ||
-                      $module->isBackend();
-       }
-
        /**
         * Returns true, if the call is from a backend node (f.e. from a worker)
         *
         * @return bool Is it a known backend?
+        *
+        * @deprecated 2019.09 - use App\Mode->isBackend() instead
+        * @see App\Mode::isBackend()
         */
        public function isBackend()
        {
-               return $this->isBackend;
+               return $this->mode->isBackend();
        }
 
        /**