X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=src%2FApp%2FModule.php;h=fff7641b76059113bd194fa5ba9cbabeb9866a67;hb=a6423031eba1236127160ced3028e36401f40536;hp=7c81b6a7eaac2a9797b6e4baf11367f8463313b0;hpb=c1dbb256561ecdb19fe0541628b1ec0f06d95dfa;p=friendica.git diff --git a/src/App/Module.php b/src/App/Module.php index 7c81b6a7ea..fff7641b76 100644 --- a/src/App/Module.php +++ b/src/App/Module.php @@ -1,4 +1,23 @@ . + * + */ namespace Friendica\App; @@ -11,6 +30,7 @@ use Friendica\Module\HTTPException\MethodNotAllowed; use Friendica\Module\HTTPException\PageNotFound; use Friendica\Network\HTTPException\MethodNotAllowedException; use Friendica\Network\HTTPException\NotFoundException; +use Friendica\Util\Profiler; use Psr\Log\LoggerInterface; /** @@ -149,15 +169,15 @@ class Module /** * Determine the class of the current module * - * @param Arguments $args The Friendica execution arguments - * @param Router $router The Friendica routing instance - * @param Core\Config\IConfiguration $config The Friendica Configuration + * @param Arguments $args The Friendica execution arguments + * @param Router $router The Friendica routing instance + * @param Core\Config\IConfig $config The Friendica Configuration * * @return Module The determined module of this call * * @throws \Exception */ - public function determineClass(Arguments $args, Router $router, Core\Config\IConfiguration $config) + public function determineClass(Arguments $args, Router $router, Core\Config\IConfig $config) { $printNotAllowedAddon = false; @@ -207,18 +227,18 @@ class Module /** * Run the determined module class and calls all hooks applied to * - * @param Core\L10n\L10n $l10n The L10n instance - * @param App\BaseURL $baseUrl The Friendica Base URL - * @param LoggerInterface $logger The Friendica logger - * @param array $server The $_SERVER variable - * @param array $post The $_POST variables + * @param \Friendica\Core\L10n $l10n The L10n instance + * @param App\BaseURL $baseUrl The Friendica Base URL + * @param LoggerInterface $logger The Friendica logger + * @param array $server The $_SERVER variable + * @param array $post The $_POST variables * * @throws \Friendica\Network\HTTPException\InternalServerErrorException */ - public function run(Core\L10n\L10n $l10n, App\BaseURL $baseUrl, LoggerInterface $logger, array $server, array $post) + public function run(Core\L10n $l10n, App\BaseURL $baseUrl, LoggerInterface $logger, Profiler $profiler, array $server, array $post) { if ($this->printNotAllowedAddon) { - info($l10n->t("You must be logged in to use addons. ")); + notice($l10n->t("You must be logged in to use addons. ")); } /* The URL provided does not resolve to a valid module. @@ -247,10 +267,15 @@ class Module $placeholder = ''; + $profiler->set(microtime(true), 'ready'); + $timestamp = microtime(true); + Core\Hook::callAll($this->module . '_mod_init', $placeholder); call_user_func([$this->module_class, 'init'], $this->module_parameters); + $profiler->set(microtime(true) - $timestamp, 'init'); + if ($server['REQUEST_METHOD'] === 'POST') { Core\Hook::callAll($this->module . '_mod_post', $post); call_user_func([$this->module_class, 'post'], $this->module_parameters);