[TikiWiki-commits] [Git][tikiwiki/tiki][master] [FIX] ConsoleApplicationBuilder.php: fix console command lookup when reusing cached instances

"Victor Emanouilov \(@kroky\) via TikiWiki-cvs" <[email protected]>
Newsgroups gmane.comp.cms.tiki.cvs
Message-ID <6a1e767542f80_38193ca06466b@gitlab-sidekiq-low-urgency-cpu-bound-v2-5f66f86c7b-zzzml.mail>

Victor Emanouilov pushed to branch master at Tiki Wiki CMS Groupware / Tiki


Commits:
bf52c5ea by Sammy Ndabo at 2026-06-02T06:03:47+00:00
[FIX] ConsoleApplicationBuilder.php: fix console command lookup when reusing cached instances
---
* [REF] ConsoleApplicationBuilder.php: remove the default 1100 value to callers

* [FIX] ConsoleApplicationBuilder.php: revert to the previous constants declaration

* [REM] ConsoleApplicationBuilder: completely removed the called command parameter and update all the callers

* [FIX] ConsoleApplicationBuilder.php: cache only fully initialized console instance

* [FIX] ConsoleApplicationBuilder.php: fix console command lookup when reusing cached instances

See merge request tikiwiki/tiki!10127

- - - - -


2 changed files:

- lib/core/Tiki/Command/ConsoleApplicationBuilder.php
- lib/core/Tiki/Package/Extension/Extension.php


Changes:

=====================================
lib/core/Tiki/Command/ConsoleApplicationBuilder.php
=====================================
@@ -532,13 +532,17 @@ class ConsoleApplicationBuilder
      * Iterates over all commands in the list, and registers / doesn't register the commands in accordance with the result
      * of the check function and the action configured for the command group
      *
-     * @param boolean $returnLastInstance
+     * @param int|bool $statusCode
      * @return Application
      */
     public function create($statusCode = 1100): Application
     {
         global $tikipath;
 
+        if (is_bool($statusCode)) {
+            $statusCode = 1100;
+        }
+
         if (self::$lastInstance) {
             return self::$lastInstance;
         }
@@ -558,8 +562,6 @@ class ConsoleApplicationBuilder
         $console->setName(tra('Tiki Console Tool'));
         $console->setCatchExceptions(false);
 
-        $commandCalled = $_SERVER['argv'][1] ?? false;
-
         /**
          * @var  $condition string  The name of the check method to be executed
          * @var  $actions   array   List of actions that should apply to a group of commands
@@ -621,10 +623,6 @@ class ConsoleApplicationBuilder
                     }
                 }
                 $console->add($command);
-                // If the command exactly matches one that was requested, stop processing further commands as they will not be used anyhow.
-                if ($commandCalled === $command->getName()) {
-                    break 2;
-                }
             }
         }
 


=====================================
lib/core/Tiki/Package/Extension/Extension.php
=====================================
@@ -245,7 +245,7 @@ class Extension
         foreach ($finder->in($path)->depth('== 0')->directories() as $themeDir) {
             try {
                 $consoleBuilder = new ConsoleApplicationBuilder();
-                $console = $consoleBuilder->create(true);
+                $console = $consoleBuilder->create();
                 $command = $console->find($commandName);
 
                 $themeName = basename($themeDir);



View it on GitLab: https://gitlab.com/tikiwiki/tiki/-/commit/bf52c5ea584dfd72b27a52cecb64d397d884a8fd

-- 
View it on GitLab: https://gitlab.com/tikiwiki/tiki/-/commit/bf52c5ea584dfd72b27a52cecb64d397d884a8fd
You're receiving this email because of your account on gitlab.com. Manage all notifications: https://gitlab.com/-/profile/notifications | Help: https://gitlab.com/help

_______________________________________________
TikiWiki-cvs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/tikiwiki-cvs
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.