<?php
/**
- * @copyright Copyright (C) 2020, Friendica
+ * @copyright Copyright (C) 2010-2021, the Friendica project
*
* @license GNU AGPL version 3 or any later version
*
use Friendica\Module\HTTPException\PageNotFound;
use Friendica\Network\HTTPException\MethodNotAllowedException;
use Friendica\Network\HTTPException\NotFoundException;
+use Friendica\Util\Profiler;
use Psr\Log\LoggerInterface;
/**
*
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
*/
- public function run(Core\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) {
notice($l10n->t("You must be logged in to use addons. "));
$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);
- if ($server['REQUEST_METHOD'] === 'POST') {
+ $profiler->set(microtime(true) - $timestamp, 'init');
+
+ if ($server['REQUEST_METHOD'] === Router::DELETE) {
+ call_user_func([$this->module_class, 'delete'], $this->module_parameters);
+ }
+
+ if ($server['REQUEST_METHOD'] === Router::PATCH) {
+ call_user_func([$this->module_class, 'patch'], $this->module_parameters);
+ }
+
+ if ($server['REQUEST_METHOD'] === Router::POST) {
Core\Hook::callAll($this->module . '_mod_post', $post);
call_user_func([$this->module_class, 'post'], $this->module_parameters);
}
+ if ($server['REQUEST_METHOD'] === Router::PUT) {
+ call_user_func([$this->module_class, 'put'], $this->module_parameters);
+ }
+
Core\Hook::callAll($this->module . '_mod_afterpost', $placeholder);
call_user_func([$this->module_class, 'afterpost'], $this->module_parameters);