[TASK] Show command of console commands in backend 16/61316/7
authorGeorg Ringer <georg.ringer@gmail.com>
Thu, 18 Jul 2019 03:46:28 +0000 (05:46 +0200)
committerAndreas Fernandez <a.fernandez@scripting-base.de>
Mon, 22 Jul 2019 06:39:06 +0000 (08:39 +0200)
Show the console command and arguments in the backend of symfony commands.

Resolves: #88788
Releases: master, 9.5
Change-Id: Ief0abb4404c14dbfa85eb4acddcb74e796ba0272
Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/61316
Tested-by: Benjamin Franzke <bfr@qbus.de>
Tested-by: TYPO3com <noreply@typo3.com>
Tested-by: Sybille Peters <sypets@gmx.de>
Tested-by: Andreas Fernandez <a.fernandez@scripting-base.de>
Reviewed-by: Benjamin Franzke <bfr@qbus.de>
Reviewed-by: Andreas Fernandez <a.fernandez@scripting-base.de>
typo3/sysext/scheduler/Classes/Task/ExecuteSchedulableCommandTask.php

index 326e622..56c1bd4 100644 (file)
@@ -91,6 +91,34 @@ class ExecuteSchedulableCommandTask extends AbstractTask
     }
 
     /**
+     * Return a text representation of the selected command and arguments
+     *
+     * @return string Information to display
+     */
+    public function getAdditionalInformation(): string
+    {
+        $label = $this->commandIdentifier;
+
+        try {
+            $commandRegistry = GeneralUtility::makeInstance(CommandRegistry::class);
+            $schedulableCommand = $commandRegistry->getCommandByIdentifier($this->commandIdentifier);
+        } catch (UnknownCommandException $e) {
+            return sprintf(
+                $this->getLanguageService()->sL('LLL:EXT:scheduler/Resources/Private/Language/locallang.xlf:msg.unregisteredCommand'),
+                $this->commandIdentifier
+            );
+        }
+
+        $input = new ArrayInput($this->getArguments(), $schedulableCommand->getDefinition());
+        $arguments = $input->__toString();
+        if ($arguments !== '') {
+            $label .= ' ' . $arguments;
+        }
+
+        return $label;
+    }
+
+    /**
      * @return array
      */
     public function getArguments(): array