[TASK] Speed up ReST file reference check 95/59495/4
authorChristian Kuhn <lolli@schwarzbu.ch>
Sat, 19 Jan 2019 07:25:32 +0000 (08:25 +0100)
committerAnja Leichsenring <aleichsenring@ab-softlab.de>
Sun, 20 Jan 2019 10:49:10 +0000 (11:49 +0100)
There is a test related check for the extension scanner
to verify all referenced ReST files actually exist. It
is active as part of the 'integrity' job in bamboo.
The patch adds a variable to suppress checking the same
ReST file name multiple times if it is referenced in many
matchers. In practice, this speeds up the scanning process
drastically, on my local machine with current master from
more than a minute to less than ten seconds.

Resolves: #87493
Releases: master, 9.5
Change-Id: Iaa19add06ad9eeda9d36e3e204c1a671368b5f29
Reviewed-on: https://review.typo3.org/59495
Reviewed-by: Andreas Fernandez <a.fernandez@scripting-base.de>
Tested-by: Andreas Fernandez <a.fernandez@scripting-base.de>
Tested-by: TYPO3com <noreply@typo3.com>
Reviewed-by: Anja Leichsenring <aleichsenring@ab-softlab.de>
Tested-by: Anja Leichsenring <aleichsenring@ab-softlab.de>
Build/Scripts/extensionScannerRstFileReferences.php

index 47f4db6..b5e9830 100755 (executable)
@@ -30,11 +30,16 @@ call_user_func(function () {
         ->in(__DIR__ . '/../../typo3/sysext/install/Configuration/ExtensionScanner/Php');
 
     $invalidRestFiles = [];
+    $validRestFiles = [];
     foreach ($matcherConfigurationFiles as $matcherConfigurationFile) {
         /** @var SplFileInfo $matcherConfigurationFile */
         $matcherConfigurations = require $matcherConfigurationFile->getPathname();
         foreach ($matcherConfigurations as $matcherConfiguration) {
             foreach ($matcherConfiguration['restFiles'] as $restFile) {
+                if (in_array($restFile, $validRestFiles, true)) {
+                    // Local cache as guard to not check same file over and over again
+                    continue;
+                }
                 $restFinder = new \Symfony\Component\Finder\Finder();
                 $restFileLocation = $restFinder->files()
                     ->in(__DIR__ . '/../../typo3/sysext/core/Documentation/Changelog')
@@ -44,6 +49,8 @@ call_user_func(function () {
                         'configurationFile' => $matcherConfigurationFile->getPathname(),
                         'invalidFile' => $restFile,
                     ];
+                } else {
+                    $validRestFiles[] = $restFile;
                 }
             }
         }