X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=src%2FConsole%2FGlobalCommunityBlock.php;h=39ce6d30149e636564c9930c590f93c10f00ee68;hb=77906627c5bb57d404d40702f89c205d1faa9542;hp=12ea63e5d70d4f885d38cd7513daf56893f5a746;hpb=c1f99c70b1c7d62120723f3b142e843ba25ab338;p=friendica.git diff --git a/src/Console/GlobalCommunityBlock.php b/src/Console/GlobalCommunityBlock.php index 12ea63e5d7..39ce6d3014 100644 --- a/src/Console/GlobalCommunityBlock.php +++ b/src/Console/GlobalCommunityBlock.php @@ -1,25 +1,49 @@ . + * + */ namespace Friendica\Console; +use Friendica\App; use Friendica\Core\L10n; use Friendica\Model\Contact; /** - * @brief tool to block an account from the node + * tool to block an account from the node * * With this tool, you can block an account in such a way, that no postings * or comments this account writes are accepted to the node. - * - * License: AGPLv3 or later, same as Friendica - * - * @author Tobias Diekershoff - * @author Hypolite Petovan */ class GlobalCommunityBlock extends \Asika\SimpleConsole\Console { protected $helpOptions = ['h', 'help', '?']; + /** + * @var App\Mode + */ + private $appMode; + /** + * @var \Friendica\Core\L10n + */ + private $l10n; + protected function getHelp() { $help = <<appMode = $appMode; + $this->l10n = $l10n; + } + + protected function doExecute() + { if ($this->getOption('v')) { $this->out('Class: ' . __CLASS__); $this->out('Arguments: ' . var_export($this->args, true)); @@ -57,18 +87,18 @@ HELP; throw new \Asika\SimpleConsole\CommandArgsException('Too many arguments'); } - if ($a->getMode()->isInstall()) { + if ($this->appMode->isInstall()) { throw new \RuntimeException('Database isn\'t ready or populated yet'); } $contact_id = Contact::getIdForURL($this->getArgument(0)); if (!$contact_id) { - throw new \RuntimeException(L10n::t('Could not find any contact entry for this URL (%s)', $this->getArgument(0))); + throw new \RuntimeException($this->l10n->t('Could not find any contact entry for this URL (%s)', $this->getArgument(0))); } $block_reason = $this->getArgument(1); if(Contact::block($contact_id, $block_reason)) { - $this->out(L10n::t('The contact has been blocked from the node')); + $this->out($this->l10n->t('The contact has been blocked from the node')); } else { throw new \RuntimeException('The contact block failed.'); }