mirror of
https://github.com/friendica/friendica
synced 2025-04-25 23:10:12 +00:00
Make BaseModule
a real entity
- Add all dependencies, necessary to run the content (baseUrl, Arguments) - Encapsulate all POST/GET/DELETE/PATCH/PUT methods as protected methods inside the BaseModule - Return Module content ONLY per `BaseModule::run()` (including the Hook logic there as well)
This commit is contained in:
parent
238613fd01
commit
8bdd90066f
252 changed files with 615 additions and 623 deletions
|
@ -21,6 +21,7 @@
|
|||
|
||||
namespace Friendica\Module\Contact;
|
||||
|
||||
use Friendica\App;
|
||||
use Friendica\App\Page;
|
||||
use Friendica\BaseModule;
|
||||
use Friendica\Content\Widget;
|
||||
|
@ -33,6 +34,7 @@ use Friendica\Model;
|
|||
use Friendica\Module\Contact;
|
||||
use Friendica\Network\HTTPException\BadRequestException;
|
||||
use Friendica\Network\HTTPException\ForbiddenException;
|
||||
use Friendica\Util\Profiler;
|
||||
use Friendica\Util\Strings;
|
||||
use Psr\Log\LoggerInterface;
|
||||
|
||||
|
@ -43,25 +45,22 @@ class Advanced extends BaseModule
|
|||
{
|
||||
/** @var Database */
|
||||
protected $dba;
|
||||
/** @var LoggerInterface */
|
||||
protected $logger;
|
||||
/** @var Page */
|
||||
protected $page;
|
||||
|
||||
public function __construct(Database $dba, LoggerInterface $logger, Page $page, L10n $l10n, array $parameters = [])
|
||||
public function __construct(L10n $l10n, App\BaseURL $baseUrl, App\Arguments $args, App\Page $page, LoggerInterface $logger, Profiler $profiler, Database $dba, array $server, array $parameters = [])
|
||||
{
|
||||
parent::__construct($l10n, $parameters);
|
||||
parent::__construct($l10n, $baseUrl, $args, $logger, $profiler, $server, $parameters);
|
||||
|
||||
$this->dba = $dba;
|
||||
$this->logger = $logger;
|
||||
$this->page = $page;
|
||||
$this->dba = $dba;
|
||||
$this->page = $page;
|
||||
|
||||
if (!Session::isAuthenticated()) {
|
||||
throw new ForbiddenException($this->t('Permission denied.'));
|
||||
}
|
||||
}
|
||||
|
||||
public function post()
|
||||
protected function post(array $request = [], array $post = [])
|
||||
{
|
||||
$cid = $this->parameters['id'];
|
||||
|
||||
|
@ -110,7 +109,7 @@ class Advanced extends BaseModule
|
|||
}
|
||||
}
|
||||
|
||||
public function content(): string
|
||||
protected function content(array $request = []): string
|
||||
{
|
||||
$cid = $this->parameters['id'];
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue