]> git.mxchange.org Git - friendica.git/commitdiff
Add cons
authorPhilipp <admin@philipp.info>
Mon, 6 Jan 2025 17:59:22 +0000 (18:59 +0100)
committerPhilipp <admin@philipp.info>
Mon, 6 Jan 2025 17:59:22 +0000 (18:59 +0100)
src/Console/AbstractConsole.php
src/Core/Console.php

index be804b43b8f3d222ae36d8496615485fed75d11c..f9c413b915e4603f912f53872b4fff40c946294b 100644 (file)
@@ -10,6 +10,7 @@ declare(strict_types=1);
 namespace Friendica\Console;
 
 use Asika\SimpleConsole\Console;
+use Friendica\Core\Console as CoreConsole;
 use Friendica\Core\Logger\Capability\LogChannel;
 
 /**
@@ -25,13 +26,13 @@ abstract class AbstractConsole extends Console
        public const LOG_CHANNEL = LogChannel::CONSOLE;
 
        /**
-        * Checks, if the Console command was executed outside of`bin/console.php` and prints the correct execution
+        * Checks, if the Console command was executed outside `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') {
+               if (substr($this->executable, -strlen(CoreConsole::getDefaultExecutable())) === CoreConsole::getDefaultExecutable()) {
                        $this->out(sprintf("'%s' is deprecated and will removed. Please use 'bin/console.php %s' instead", $this->executable, $command));
                }
        }
index 34461c0daed7d07ccf0d549fa2c5bc9d80a9847e..d138a9dfa98e1552e744c546711e361318b1fa11 100644 (file)
@@ -16,6 +16,17 @@ use Friendica\Core\Logger\Capability\LogChannel;
  */
 class Console extends \Asika\SimpleConsole\Console
 {
+       /** @var string The default executable for a console call */
+       private const CONSOLE_EXECUTABLE = 'bin/console.php';
+
+       /**
+        * @return string The default executable for a console call
+        */
+       public static function getDefaultExecutable(): string
+       {
+               return self::CONSOLE_EXECUTABLE;
+       }
+
        // Disables the default help handling
        protected $helpOptions             = [];
        protected array $customHelpOptions = ['h', 'help', '?'];