From 6c6cfa939da5aacea0b9fc5a936f9bbee7066798 Mon Sep 17 00:00:00 2001 From: Michael Vogel Date: Wed, 16 Sep 2020 20:23:27 +0200 Subject: [PATCH] Apply suggestions from code review Co-authored-by: Hypolite Petovan --- doc/tools.md | 2 +- src/Console/Relay.php | 17 ++++++++++------- 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/doc/tools.md b/doc/tools.md index 86be0b492..1c3b8e119 100644 --- a/doc/tools.md +++ b/doc/tools.md @@ -27,7 +27,7 @@ The console provides the following commands: * typo: Checks for parse errors in Friendica files * postupdate: Execute pending post update scripts (can last days) * storage: Manage storage backend -* relay: Manage ActivityPub relais +* relay: Manage ActivityPub relay servers Please consult *bin/console help* on the command line interface of your server for details about the commands. diff --git a/src/Console/Relay.php b/src/Console/Relay.php index e1da56dba..d23d871f9 100644 --- a/src/Console/Relay.php +++ b/src/Console/Relay.php @@ -69,12 +69,12 @@ Synopsis Description bin/console relay - Lists all active relais + Lists all active relay servers bin/console relay add Add a relay actor - bin/console relay remove + bin/console relay remove Remove a relay actor Options @@ -84,11 +84,14 @@ HELP; return $help; } - public function __construct(App\Mode $appMode, array $argv = null) + /** @var $dba Friendica\Database\Database */ + private $dba; + + public function __construct(Friendica\Database\Database $dba, array $argv = null) { parent::__construct($argv); - $this->appMode = $appMode; + $this->dba = $dba; } protected function doExecute() @@ -109,13 +112,13 @@ HELP; } if (count($this->args) == 0) { - $contacts = DBA::select('apcontact', ['url'], + $contacts = $this->dba->select('apcontact', ['url'], ["`type` = ? AND `url` IN (SELECT `url` FROM `contact` WHERE `uid` = ? AND `rel` IN (?, ?))", 'Application', 0, Contact::FOLLOWER, Contact::FRIEND]); - while ($contact = DBA::fetch($contacts)) { + while ($contact = $this->dba->fetch($contacts)) { $this->out($contact['url']); } - DBA::close($contacts); + $this->dba->close($contacts); } if (count($this->args) == 2) {