Console script to ensure that all post updates are finished
This commit is contained in:
		
					parent
					
						
							
								6b14a2623a
							
						
					
				
			
			
				commit
				
					
						5037f9c460
					
				
			
		
					 3 changed files with 51 additions and 5 deletions
				
			
		| 
						 | 
				
			
			@ -28,6 +28,7 @@ class Console extends \Asika\SimpleConsole\Console
 | 
			
		|||
		'php2po'                 => __NAMESPACE__ . '\Console\PhpToPo',
 | 
			
		||||
		'po2php'                 => __NAMESPACE__ . '\Console\PoToPhp',
 | 
			
		||||
		'typo'                   => __NAMESPACE__ . '\Console\Typo',
 | 
			
		||||
		'postupdate'             => __NAMESPACE__ . '\Console\PostUpdate',
 | 
			
		||||
	];
 | 
			
		||||
 | 
			
		||||
	protected function getHelp()
 | 
			
		||||
| 
						 | 
				
			
			@ -51,6 +52,7 @@ Commands:
 | 
			
		|||
	php2po                 Generate a messages.po file from a strings.php file
 | 
			
		||||
	po2php                 Generate a strings.php file from a messages.po file
 | 
			
		||||
	typo                   Checks for parse errors in Friendica files
 | 
			
		||||
	postupdate             Execute pending post update scripts (can last days)
 | 
			
		||||
 | 
			
		||||
Options:
 | 
			
		||||
	-h|--help|-? Show help information
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
							
								
								
									
										42
									
								
								src/Core/Console/PostUpdate.php
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										42
									
								
								src/Core/Console/PostUpdate.php
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,42 @@
 | 
			
		|||
<?php
 | 
			
		||||
 | 
			
		||||
namespace Friendica\Core\Console;
 | 
			
		||||
 | 
			
		||||
use Friendica\Core\L10n;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * @brief tool to block an account from the node
 | 
			
		||||
 *
 | 
			
		||||
 * With this tool, you can block an account in such a way, that no postings
 | 
			
		||||
 * or comments this account writes are accepted to the node.
 | 
			
		||||
 *
 | 
			
		||||
 * License: AGPLv3 or later, same as Friendica
 | 
			
		||||
 *
 | 
			
		||||
 * @author Tobias Diekershoff <mrpetovan@gmail.com>
 | 
			
		||||
 * @author Hypolite Petovan <mrpetovan@gmail.com>
 | 
			
		||||
 */
 | 
			
		||||
class PostUpdate extends \Asika\SimpleConsole\Console
 | 
			
		||||
{
 | 
			
		||||
	protected function doExecute()
 | 
			
		||||
	{
 | 
			
		||||
		$a = get_app();
 | 
			
		||||
 | 
			
		||||
		if (count($this->args) > 0) {
 | 
			
		||||
			throw new \Asika\SimpleConsole\CommandArgsException('Too many arguments');
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		if ($a->isInstallMode()) {
 | 
			
		||||
			throw new \RuntimeException('Database isn\'t ready or populated yet');
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		echo L10n::t('Execute pending post updates.') . "\n";
 | 
			
		||||
 | 
			
		||||
		while (!\Friendica\Database\PostUpdate::update()) {
 | 
			
		||||
			echo '.';
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		echo "\n" . L10n::t('All pending post updates are done.') . "\n";
 | 
			
		||||
 | 
			
		||||
		return 0;
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue