]> git.mxchange.org Git - friendica.git/blobdiff - src/Console/ServerBlock.php
Apply suggestions from code review
[friendica.git] / src / Console / ServerBlock.php
index 46e7b89eb99deb8f48a280768f27c376811f39ad..4d04dcff81e0d23847af76a05fe399728f1ea8b6 100644 (file)
@@ -24,6 +24,7 @@ namespace Friendica\Console;
 use Asika\SimpleConsole\CommandArgsException;
 use Asika\SimpleConsole\Console;
 use Console_Table;
+use Friendica\Core\Worker;
 use Friendica\Moderation\DomainPatternBlocklist;
 
 /**
@@ -106,6 +107,11 @@ HELP;
        {
                $filename = $this->getArgument(1);
 
+               if (empty($filename)) {
+                       $this->out('A file name is required, e.g. ./bin/console serverblock export backup.csv');
+                       return 1;
+               }
+
                $this->blocklist->exportToFile($filename);
 
                // Success
@@ -127,6 +133,7 @@ HELP;
 
                if ($this->blocklist->append($newBlockList)) {
                        $this->out(sprintf("Entries from %s that were not blocked before are now blocked", $filename));
+                       Worker::add(Worker::PRIORITY_LOW, 'UpdateBlockedServers');
                        return 0;
                } else {
                        $this->out("Couldn't save the block list");
@@ -169,6 +176,7 @@ HELP;
                        } else {
                                $this->out(sprintf("The domain pattern '%s' is now blocked. (Reason: '%s')", $pattern, $reason));
                        }
+                       Worker::add(Worker::PRIORITY_LOW, 'UpdateBlockedServers');
                        return 0;
                } else {
                        $this->out(sprintf("Couldn't save '%s' as blocked domain pattern", $pattern));
@@ -193,6 +201,7 @@ HELP;
                if ($result) {
                        if ($result == 2) {
                                $this->out(sprintf("The domain pattern '%s' isn't blocked anymore", $pattern));
+                               Worker::add(Worker::PRIORITY_LOW, 'UpdateBlockedServers');
                                return 0;
                        } else {
                                $this->out(sprintf("The domain pattern '%s' wasn't blocked.", $pattern));