]> git.mxchange.org Git - friendica.git/blob - src/Core/Console/PostUpdate.php
Console script to ensure that all post updates are finished
[friendica.git] / src / Core / Console / PostUpdate.php
1 <?php
2
3 namespace Friendica\Core\Console;
4
5 use Friendica\Core\L10n;
6
7 /**
8  * @brief tool to block an account from the node
9  *
10  * With this tool, you can block an account in such a way, that no postings
11  * or comments this account writes are accepted to the node.
12  *
13  * License: AGPLv3 or later, same as Friendica
14  *
15  * @author Tobias Diekershoff <mrpetovan@gmail.com>
16  * @author Hypolite Petovan <mrpetovan@gmail.com>
17  */
18 class PostUpdate extends \Asika\SimpleConsole\Console
19 {
20         protected function doExecute()
21         {
22                 $a = get_app();
23
24                 if (count($this->args) > 0) {
25                         throw new \Asika\SimpleConsole\CommandArgsException('Too many arguments');
26                 }
27
28                 if ($a->isInstallMode()) {
29                         throw new \RuntimeException('Database isn\'t ready or populated yet');
30                 }
31
32                 echo L10n::t('Execute pending post updates.') . "\n";
33
34                 while (!\Friendica\Database\PostUpdate::update()) {
35                         echo '.';
36                 }
37
38                 echo "\n" . L10n::t('All pending post updates are done.') . "\n";
39
40                 return 0;
41         }
42 }