X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;ds=sidebyside;f=src%2FCore%2FConsole%2FGlobalCommunitySilence.php;h=b0281241e360c003692ef92efeef0933cf543838;hb=e447375cddb847edbc9d4486be3938674ae66b8c;hp=6330d08a12afc3f8055f733aae8673d8e0e18ad7;hpb=4e44b07dfe07dde78fe8a095fbb43d9ec1ffcb53;p=friendica.git diff --git a/src/Core/Console/GlobalCommunitySilence.php b/src/Core/Console/GlobalCommunitySilence.php index 6330d08a12..b0281241e3 100644 --- a/src/Core/Console/GlobalCommunitySilence.php +++ b/src/Core/Console/GlobalCommunitySilence.php @@ -3,13 +3,11 @@ namespace Friendica\Core\Console; use Friendica\Core\Protocol; -use Friendica\Database\dba; -use Friendica\Database\DBM; +use Friendica\Database\DBA; use Friendica\Network\Probe; +use Friendica\Util\Strings; use RuntimeException; -require_once 'include/text.php'; - /** * @brief tool to silence accounts on the global community page * @@ -20,8 +18,8 @@ require_once 'include/text.php'; * * License: AGPLv3 or later, same as Friendica * - * @author Tobias Diekershoff - * @author Hypolite Petovan + * @author Tobias Diekershoff + * @author Hypolite Petovan */ class GlobalCommunitySilence extends \Asika\SimpleConsole\Console { @@ -49,7 +47,7 @@ HELP; protected function doExecute() { - $a = get_app(); + $a = \get_app(); if ($this->getOption('v')) { $this->out('Class: ' . __CLASS__); @@ -66,7 +64,7 @@ HELP; throw new \Asika\SimpleConsole\CommandArgsException('Too many arguments'); } - if ($a->isInstallMode()) { + if ($a->getMode()->isInstall()) { throw new RuntimeException('Database isn\'t ready or populated yet'); } @@ -80,10 +78,10 @@ HELP; throw new RuntimeException('This account seems not to exist.'); } - $nurl = normalise_link($net['url']); - $contact = dba::selectFirst("contact", ["id"], ["nurl" => $nurl, "uid" => 0]); - if (DBM::is_result($contact)) { - dba::update("contact", ["hidden" => true], ["id" => $contact["id"]]); + $nurl = Strings::normaliseLink($net['url']); + $contact = DBA::selectFirst("contact", ["id"], ["nurl" => $nurl, "uid" => 0]); + if (DBA::isResult($contact)) { + DBA::update("contact", ["hidden" => true], ["id" => $contact["id"]]); $this->out('NOTICE: The account should be silenced from the global community page'); } else { throw new RuntimeException('NOTICE: Could not find any entry for this URL (' . $nurl . ')');