]> git.mxchange.org Git - friendica.git/blobdiff - src/App.php
Add HTTP method to App\Arguments
[friendica.git] / src / App.php
index d6532c445cc2ecafb6849d0095a5e1a67b1ce7cb..c56222b63f5d7b52bfa9daf98b929b13842c68b7 100644 (file)
@@ -1,6 +1,6 @@
 <?php
 /**
- * @copyright Copyright (C) 2010-2021, the Friendica project
+ * @copyright Copyright (C) 2010-2022, the Friendica project
  *
  * @license GNU AGPL version 3 or any later version
  *
@@ -580,7 +580,7 @@ class App
                try {
                        // Missing DB connection: ERROR
                        if ($this->mode->has(App\Mode::LOCALCONFIGPRESENT) && !$this->mode->has(App\Mode::DBAVAILABLE)) {
-                               throw new HTTPException\InternalServerErrorException('Apologies but the website is unavailable at the moment.');
+                               throw new HTTPException\InternalServerErrorException($this->l10n->t('Apologies but the website is unavailable at the moment.'));
                        }
 
                        if (!$this->mode->isInstall()) {
@@ -707,8 +707,11 @@ class App
                        $input     = array_merge($httpinput['variables'], $httpinput['files'], $request ?? $_REQUEST);
 
                        // Let the module run it's internal process (init, get, post, ...)
+                       $timestamp = microtime(true);
                        $response = $module->run($input);
-                       if ($response->getHeaderLine(ICanCreateResponses::X_HEADER) === ICanCreateResponses::TYPE_HTML) {
+                       $this->profiler->set(microtime(true) - $timestamp, 'content');
+                       if ($response->getHeaderLine(ICanCreateResponses::X_HEADER) === ICanCreateResponses::TYPE_HTML &&
+                               $response->getStatusCode() == 200) {
                                $page->run($this, $this->baseURL, $this->args, $this->mode, $response, $this->l10n, $this->profiler, $this->config, $pconfig);
                        } else {
                                $page->exit($response);