diff --git a/src/Controller/ShopwareFilesController.php b/src/Controller/ShopwareFilesController.php
index 960cdb6a..409b5682 100644
--- a/src/Controller/ShopwareFilesController.php
+++ b/src/Controller/ShopwareFilesController.php
@@ -70,6 +70,7 @@ public function listShopwareFiles(): JsonResponse
$invalidFiles = [];
$allFilesAreOkay = true;
+ $shopwarePatches = $this->getShopwarePatches();
foreach (explode("\n", $data) as $row) {
if ($this->isPlatform) {
@@ -96,10 +97,16 @@ public function listShopwareFiles(): JsonResponse
$allFilesAreOkay = false;
}
+ $isPatched = $shopwarePatches ? $this->isFilePatched($file, $shopwarePatches) : false;
+ if ($isPatched) {
+ $ignoredState = self::STATUS_IGNORED_IN_PROJECT;
+ }
+
$invalidFiles[] = [
'name' => $file,
'shopwareUrl' => $this->getShopwareUrl($file),
'expected' => $ignoredState === self::STATUS_IGNORED_IN_PROJECT,
+ 'patched' => $isPatched,
];
}
@@ -261,4 +268,50 @@ private function getNameByIntegrationId(string $integrationId): ?string
return 'integration ' . $integrationEntity->getLabel();
}
+
+ private function getShopwarePatches(): ?array
+ {
+ $shopwarePatches = [];
+ $composerFile = $this->projectDir . '/composer.json';
+ if (!is_file($composerFile)) {
+ return null;
+ }
+
+ $composerJson = json_decode(file_get_contents($composerFile), true);
+ $patchedPackages = $composerJson['extra']['patches'] ?? [];
+
+ foreach ($patchedPackages as $packageName => $patches) {
+ if (!str_starts_with($packageName, 'shopware')) {
+ continue;
+ }
+
+ foreach ($patches as $patch) {
+ $patchFileLocation = $this->projectDir . '/' . $patch;
+ if (is_file($patchFileLocation)) {
+ $shopwarePatches[$packageName][] = $patch;
+ }
+ }
+ }
+
+ return $shopwarePatches;
+ }
+
+ private function isFilePatched(string $fileName, array $shopwarePatches): ?string
+ {
+ foreach ($shopwarePatches as $package) {
+ foreach ($package as $patch) {
+ $patchFileLocation = $this->projectDir . '/' . $patch;
+ if (!is_file($patchFileLocation)) {
+ continue;
+ }
+
+ $patchFile = file_get_contents($patchFileLocation);
+ if (str_contains($patchFile, $fileName)) {
+ return $patch;
+ }
+ }
+ }
+
+ return null;
+ }
}
diff --git a/src/Resources/app/administration/src/module/frosh-tools/component/frosh-tools-tab-files/template.twig b/src/Resources/app/administration/src/module/frosh-tools/component/frosh-tools-tab-files/template.twig
index 051f5a70..e6fb8540 100644
--- a/src/Resources/app/administration/src/module/frosh-tools/component/frosh-tools-tab-files/template.twig
+++ b/src/Resources/app/administration/src/module/frosh-tools/component/frosh-tools-tab-files/template.twig
@@ -28,8 +28,14 @@
- {{ $tc('frosh-tools.tabs.files.expectedProject') }}
+ {{ $tc('frosh-tools.tabs.files.expectedPatched') }}
+ {{ $tc('frosh-tools.tabs.files.expectedProject') }}
{{ $tc('frosh-tools.tabs.files.expectedAll') }}
+
+
diff --git a/src/Resources/app/administration/src/module/frosh-tools/snippet/de-DE.json b/src/Resources/app/administration/src/module/frosh-tools/snippet/de-DE.json
index 611b94ab..9b2c1496 100644
--- a/src/Resources/app/administration/src/module/frosh-tools/snippet/de-DE.json
+++ b/src/Resources/app/administration/src/module/frosh-tools/snippet/de-DE.json
@@ -45,6 +45,7 @@
"restoreFile": "Datei wiederherstellen"
},
"expectedAll": "Datei wurde manipuliert",
+ "expectedPatched": "Datei wurde gepatcht, Fehler wird ignoriert durch Projekt Konfiguration",
"expectedProject": "Datei wurde manipuliert, Fehler wird ignoriert durch Projekt Konfiguration"
},
"state-machines": {
diff --git a/src/Resources/app/administration/src/module/frosh-tools/snippet/en-GB.json b/src/Resources/app/administration/src/module/frosh-tools/snippet/en-GB.json
index 19ce8c5b..f3b91333 100644
--- a/src/Resources/app/administration/src/module/frosh-tools/snippet/en-GB.json
+++ b/src/Resources/app/administration/src/module/frosh-tools/snippet/en-GB.json
@@ -45,6 +45,7 @@
"restoreFile": "Restore file"
},
"expectedAll": "File has been modified",
+ "expectedPatched": "File has been patched and will be ignored by project settings",
"expectedProject": "File has been modified, but will be ignored by project settings"
},
"state-machines": {