Skip to content

Commit 08d089b

Browse files
#24076: Static tests fix.
1 parent 0aa36bd commit 08d089b

File tree

2 files changed

+34
-21
lines changed

2 files changed

+34
-21
lines changed

app/code/Magento/Deploy/Model/Filesystem.php

Lines changed: 27 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -285,22 +285,7 @@ public function cleanupFilesystem($directoryCodeList)
285285
$excludePatterns = ['#.htaccess#', '#deployed_version.txt#'];
286286
foreach ($directoryCodeList as $code) {
287287
if ($code == DirectoryList::STATIC_VIEW) {
288-
$directoryPath = $this->directoryList->getPath(DirectoryList::STATIC_VIEW);
289-
if ($this->driverFile->isExists($directoryPath)) {
290-
$files = $this->driverFile->readDirectory($directoryPath);
291-
foreach ($files as $file) {
292-
foreach ($excludePatterns as $pattern) {
293-
if (preg_match($pattern, $file)) {
294-
continue 2;
295-
}
296-
}
297-
if ($this->driverFile->isFile($file)) {
298-
$this->driverFile->deleteFile($file);
299-
} else {
300-
$this->driverFile->deleteDirectory($file);
301-
}
302-
}
303-
}
288+
$this->cleanupStaticDirectory($excludePatterns);
304289
} else {
305290
$this->filesystem->getDirectoryWrite($code)
306291
->delete();
@@ -374,4 +359,30 @@ private function reinitCacheDirectories()
374359
$command = $this->functionCallPath . 'cache:flush';
375360
$this->shell->execute($command);
376361
}
362+
363+
/**
364+
* Cleanup directory with static view files.
365+
*
366+
* @param array $excludePatterns
367+
* @throws \Magento\Framework\Exception\FileSystemException
368+
*/
369+
private function cleanupStaticDirectory(array $excludePatterns): void
370+
{
371+
$directoryPath = $this->directoryList->getPath(DirectoryList::STATIC_VIEW);
372+
if ($this->driverFile->isExists($directoryPath)) {
373+
$files = $this->driverFile->readDirectory($directoryPath);
374+
foreach ($files as $file) {
375+
foreach ($excludePatterns as $pattern) {
376+
if (preg_match($pattern, $file)) {
377+
continue 2;
378+
}
379+
}
380+
if ($this->driverFile->isFile($file)) {
381+
$this->driverFile->deleteFile($file);
382+
} else {
383+
$this->driverFile->deleteDirectory($file);
384+
}
385+
}
386+
}
387+
}
377388
}

app/code/Magento/Directory/Setup/Patch/Data/InitializeDirectoryData.php

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313

1414
/**
1515
* Class InitializeDirectoryData
16+
*
1617
* @package Magento\Directory\Setup\Patch
1718
*/
1819
class InitializeDirectoryData implements DataPatchInterface, PatchVersionInterface
@@ -41,7 +42,8 @@ public function __construct(
4142
}
4243

4344
/**
44-
* {@inheritdoc}
45+
* @inheritdoc
46+
*
4547
* @SuppressWarnings(PHPMD.ExcessiveMethodLength)
4648
*/
4749
public function apply()
@@ -437,7 +439,7 @@ public function apply()
437439
['CH', 'VS', 'Wallis'],
438440
['CH', 'ZG', 'Zug'],
439441
['CH', 'ZH', 'Zürich'],
440-
['ES', 'A Coruca', 'A Coruña'],
442+
['ES', 'A Coruсa', 'A Coruña'],
441443
['ES', 'Alava', 'Alava'],
442444
['ES', 'Albacete', 'Albacete'],
443445
['ES', 'Alicante', 'Alicante'],
@@ -874,23 +876,23 @@ public function apply()
874876
}
875877

876878
/**
877-
* {@inheritdoc}
879+
* @inheritdoc
878880
*/
879881
public static function getDependencies()
880882
{
881883
return [];
882884
}
883885

884886
/**
885-
* {@inheritdoc}
887+
* @inheritdoc
886888
*/
887889
public static function getVersion()
888890
{
889891
return '2.0.0';
890892
}
891893

892894
/**
893-
* {@inheritdoc}
895+
* @inheritdoc
894896
*/
895897
public function getAliases()
896898
{

0 commit comments

Comments
 (0)