mirror of
https://github.com/friendica/friendica
synced 2025-01-27 12:19:46 +00:00
Centralize deprecated check
This commit is contained in:
parent
77c9f54f5c
commit
b9dde78466
4 changed files with 15 additions and 9 deletions
|
@ -23,4 +23,16 @@ abstract class AbstractConsole extends Console
|
||||||
* @var string
|
* @var string
|
||||||
*/
|
*/
|
||||||
public const LOG_CHANNEL = LogChannel::CONSOLE;
|
public const LOG_CHANNEL = LogChannel::CONSOLE;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Checks, if the Console command was executed outside of`bin/console.php` and prints the correct execution
|
||||||
|
*
|
||||||
|
* @param string $command the current command
|
||||||
|
*/
|
||||||
|
protected function checkDeprecated(string $command): void
|
||||||
|
{
|
||||||
|
if (substr($this->executable, -strlen('bin/console.php')) !== 'bin/console.php') {
|
||||||
|
$this->out(sprintf("'%s' is deprecated and will removed. Please use 'bin/console.php %s' instead", $this->executable, $command));
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -93,9 +93,7 @@ HELP;
|
||||||
|
|
||||||
protected function doExecute()
|
protected function doExecute()
|
||||||
{
|
{
|
||||||
if (substr($this->executable, -strlen('bin/console.php')) !== 'bin/console.php') {
|
$this->checkDeprecated('daemon');
|
||||||
$this->out(sprintf("'%s' is deprecated and will removed. Please use 'bin/console.php daemon' instead", $this->executable));
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($this->mode->isInstall()) {
|
if ($this->mode->isInstall()) {
|
||||||
throw new RuntimeException("Friendica isn't properly installed yet");
|
throw new RuntimeException("Friendica isn't properly installed yet");
|
||||||
|
|
|
@ -79,9 +79,7 @@ HELP;
|
||||||
|
|
||||||
protected function doExecute()
|
protected function doExecute()
|
||||||
{
|
{
|
||||||
if ($this->executable !== 'bin/console.php') {
|
$this->checkDeprecated('jetstream');
|
||||||
$this->out(sprintf("'%s' is deprecated and will removed. Please use 'bin/console.php jetstream' instead", $this->executable));
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($this->mode->isInstall()) {
|
if ($this->mode->isInstall()) {
|
||||||
throw new RuntimeException("Friendica isn't properly installed yet");
|
throw new RuntimeException("Friendica isn't properly installed yet");
|
||||||
|
|
|
@ -69,9 +69,7 @@ HELP;
|
||||||
|
|
||||||
protected function doExecute()
|
protected function doExecute()
|
||||||
{
|
{
|
||||||
if ($this->executable !== 'bin/console.php') {
|
$this->checkDeprecated('worker');
|
||||||
$this->out(sprintf("'%s' is deprecated and will removed. Please use 'bin/console.php worker' instead", $this->executable));
|
|
||||||
}
|
|
||||||
|
|
||||||
$this->mode->setExecutor(Mode::WORKER);
|
$this->mode->setExecutor(Mode::WORKER);
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue