- /**
- * 1. make nurl from last parameter
- * 2. check DB (contact) if there is a contact with uid=0 and that nurl, get the ID
- * 3. set the flag hidden=1 for the contact entry with the found ID
- * */
- $net = Probe::uri($this->getArgument(0));
- if (in_array($net['network'], [Protocol::PHANTOM, Protocol::MAIL])) {
- throw new RuntimeException('This account seems not to exist.');
- }
-
- $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');
+ $contact_id = Contact::getIdForURL($this->getArgument(0));
+ if ($contact_id) {
+ Contact::update(['hidden' => true], ['id' => $contact_id]);
+ $this->out('The account has been successfully silenced from the global community page.');