use Friendica\Model\Contact;\r
\r
/**\r
- * Description of GlobalCommunityBlock\r
+ * @brief tool to block an account from the node\r
*\r
+ * With this tool, you can block an account in such a way, that no postings\r
+ * or comments this account writes are accepted to the node.\r
+ *\r
+ * License: AGPLv3 or later, same as Friendica\r
+ *\r
+ * @author Tobias Diekershoff <mrpetovan@gmail.com>\r
* @author Hypolite Petovan <mrpetovan@gmail.com>\r
*/\r
class GlobalCommunityBlock extends \Asika\SimpleConsole\Console\r
protected function getHelp()\r
{\r
$help = <<<HELP\r
-console globalcommunityblock - Silence remote profile from global community page\r
+console globalcommunityblock - Block remote profile from interacting with this node\r
Usage\r
bin/console globalcommunityblock <profile_url> [-h|--help|-?] [-v]\r
\r
Description\r
- bin/console globalcommunityblock <profile_url>\r
- Silences the provided remote profile URL from the global community page\r
+ Blocks an account in such a way that no postings or comments this account writes are accepted to this node.\r
\r
Options\r
-h|--help|-? Show help information\r
throw new \RuntimeException('Unable to connect to database');\r
}\r
\r
- $contact_id = Contact::getIdForURL($argv[1]);\r
+ $contact_id = Contact::getIdForURL($this->getArgument(0));\r
if (!$contact_id) {\r
throw new \RuntimeException(L10n::t('Could not find any contact entry for this URL (%s)', $nurl));\r
}\r
- Contact::block($contact_id);\r
- $this->out(L10n::t('The contact has been blocked from the node'));\r
+ if(Contact::block($contact_id)) {\r
+ $this->out(L10n::t('The contact has been blocked from the node'));\r
+ } else {\r
+ throw new \RuntimeException('The contact block failed.');\r
+ }\r
\r
return 0;\r
}\r
-\r
}\r