Commit 82868d6d authored by Benni Mack's avatar Benni Mack Committed by Oliver Bartsch
Browse files

[BUGFIX] Remove all INSTALL_TOOL_ENABLE files

With the introduction of feature #98528,
multiple locations for ENABLE_INSTALL_TOOL
files were allowed.

This change ensures that all files are
always removed.

Resolves: #99688
Related: #98528
Releases: main
Change-Id: I4ada34731d6c367ed4178d78ecb4b1224f8fbc6f
Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/77553


Reviewed-by: Andreas Fernandez's avatarAndreas Fernandez <a.fernandez@scripting-base.de>
Tested-by: Oliver Bartsch's avatarOliver Bartsch <bo@cedev.de>
Reviewed-by: Georg Ringer's avatarGeorg Ringer <georg.ringer@gmail.com>
Tested-by: core-ci's avatarcore-ci <typo3@b13.com>
Tested-by: Georg Ringer's avatarGeorg Ringer <georg.ringer@gmail.com>
Tested-by: Andreas Fernandez's avatarAndreas Fernandez <a.fernandez@scripting-base.de>
Reviewed-by: Oliver Bartsch's avatarOliver Bartsch <bo@cedev.de>
parent 6ddadaba
......@@ -65,11 +65,15 @@ class EnableFileService
}
/**
* Removes the INSTALL_TOOL_ENABLE file
* Removes the INSTALL_TOOL_ENABLE file from all locations
*/
public static function removeInstallToolEnableFile(): bool
{
return unlink(self::getInstallToolEnableFilePath());
$result = false;
while (is_file(self::getInstallToolEnableFilePath())) {
$result = unlink(self::getInstallToolEnableFilePath());
}
return $result;
}
/**
......
......@@ -113,4 +113,26 @@ class EnableFileServiceTest extends FunctionalTestCase
$subject->_call('removeFirstInstallFile');
self::assertEquals(array_values($expected), array_values(scandir($publicPath)));
}
/**
* @test
*/
public function removeInstallToolEnableFileRemovesAllAvailableFiles(): void
{
$defaultLocation = Environment::getVarPath() . '/transient/' . EnableFileService::INSTALL_TOOL_ENABLE_FILE_PATH;
$permanentLocation = Environment::getConfigPath() . '/' . EnableFileService::INSTALL_TOOL_ENABLE_FILE_PATH;
$legacyLocation = Environment::getLegacyConfigPath() . EnableFileService::INSTALL_TOOL_ENABLE_FILE_PATH;
@mkdir(dirname($defaultLocation));
@mkdir(dirname($permanentLocation));
@mkdir(dirname($legacyLocation));
file_put_contents($defaultLocation, 'abc');
file_put_contents($permanentLocation, 'abc');
file_put_contents($legacyLocation, 'abc');
$subject = new EnableFileService();
$result = $subject::removeInstallToolEnableFile();
self::assertTrue($result);
self::assertFileDoesNotExist($defaultLocation);
self::assertFileDoesNotExist($permanentLocation);
self::assertFileDoesNotExist($legacyLocation);
}
}
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment