]> git.mxchange.org Git - friendica.git/commitdiff
Centralize deprecated check
authorPhilipp <admin@philipp.info>
Sun, 5 Jan 2025 22:12:22 +0000 (23:12 +0100)
committerPhilipp <admin@philipp.info>
Sun, 5 Jan 2025 22:13:49 +0000 (23:13 +0100)
src/Console/AbstractConsole.php
src/Console/Daemon.php
src/Console/JetstreamDaemon.php
src/Console/Worker.php

index 8ec0addeb3ca0f9bbfb2decbf91c501125356eb7..be804b43b8f3d222ae36d8496615485fed75d11c 100644 (file)
@@ -23,4 +23,16 @@ abstract class AbstractConsole extends Console
         * @var string
         */
        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));
+               }
+       }
 }
index ce557548034c38b3df66a2a4ccd75d1b5c1c4a0b..c8165a1d9b2722bdc060e4f13e54058dc86665a1 100644 (file)
@@ -93,9 +93,7 @@ HELP;
 
        protected function doExecute()
        {
-               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 daemon' instead", $this->executable));
-               }
+               $this->checkDeprecated('daemon');
 
                if ($this->mode->isInstall()) {
                        throw new RuntimeException("Friendica isn't properly installed yet");
index 06f996fa7ffc016a5fde0f3710537a5e8e05e163..d34e5780c24de73a0f5d6f09f8ac152d0dafb4db 100644 (file)
@@ -79,9 +79,7 @@ HELP;
 
        protected function doExecute()
        {
-               if ($this->executable !== 'bin/console.php') {
-                       $this->out(sprintf("'%s' is deprecated and will removed. Please use 'bin/console.php jetstream' instead", $this->executable));
-               }
+               $this->checkDeprecated('jetstream');
 
                if ($this->mode->isInstall()) {
                        throw new RuntimeException("Friendica isn't properly installed yet");
index 2e68324c7b2c26a13e0f515a9411be4a4387e293..1c7eeae0024c21b0f443c0e296667d49072404d1 100644 (file)
@@ -69,9 +69,7 @@ HELP;
 
        protected function doExecute()
        {
-               if ($this->executable !== 'bin/console.php') {
-                       $this->out(sprintf("'%s' is deprecated and will removed. Please use 'bin/console.php worker' instead", $this->executable));
-               }
+               $this->checkDeprecated('worker');
 
                $this->mode->setExecutor(Mode::WORKER);