3 namespace Friendica\Core\Console;
5 use Friendica\Core\L10n;
6 use Friendica\Core\Config;
9 * @brief tool to block an account from the node
11 * With this tool, you can block an account in such a way, that no postings
12 * or comments this account writes are accepted to the node.
14 * License: AGPLv3 or later, same as Friendica
16 * @author Tobias Diekershoff <mrpetovan@gmail.com>
17 * @author Hypolite Petovan <mrpetovan@gmail.com>
19 class PostUpdate extends \Asika\SimpleConsole\Console
21 protected $helpOptions = ['h', 'help', '?'];
23 protected function getHelp()
26 console postupdate - Performs database post updates
28 bin/console postupdate [-h|--help|-?] [--reset <version>]
31 -h|--help|-? Show help information
32 --reset <version> Reset the post update version
37 protected function doExecute()
41 if ($this->getOption($this->helpOptions)) {
42 $this->out($this->getHelp());
46 $reset_version = $this->getOption('reset');
47 if (is_bool($reset_version)) {
48 $this->out($this->getHelp());
50 } elseif ($reset_version) {
51 Config::set('system', 'post_update_version', $reset_version);
52 echo L10n::t('Post update version number has been set to %s.', $reset_version) . "\n";
56 if ($a->isInstallMode()) {
57 throw new \RuntimeException('Database isn\'t ready or populated yet');
60 echo L10n::t('Execute pending post updates.') . "\n";
62 while (!\Friendica\Database\PostUpdate::update()) {
66 echo "\n" . L10n::t('All pending post updates are done.') . "\n";