Skip to content

Instantly share code, notes, and snippets.

@Tjitse-E
Created November 22, 2022 13:14
Show Gist options
  • Save Tjitse-E/87fc5f7d28b51afafbcd765f67929569 to your computer and use it in GitHub Desktop.
Save Tjitse-E/87fc5f7d28b51afafbcd765f67929569 to your computer and use it in GitHub Desktop.
commit cb985f7401925639e25f55b93cdb44613fcfa1a9
Author: Tjitse Efdé <tjitse@vendic.nl>
Date: Tue Nov 8 14:30:19 2022 +0100
M245 fix setup:static-content:deploy timeout (https://github.com/magento/magento2/commit/12a9eacaf57baf1dbd71b22cbd9ada32f3ffa479)
diff --git a/Collector/Collector.php b/Collector/Collector.php
index b09001a..441d165 100644
--- a/Collector/Collector.php
+++ b/Collector/Collector.php
@@ -93,6 +93,9 @@ class Collector implements CollectorInterface
if ($file->getModule() && !$this->moduleManager->isEnabled($file->getModule())) {
continue;
}
+ if (!$file->getFileName()) {
+ continue;
+ }
$file->setDeployedFileName($this->fileNameResolver->resolve($file->getFileName()));
$params = $this->getParams($file);
$packagePath = "{$params['area']}/{$params['theme']}/{$params['locale']}";
diff --git a/Package/Processor/PreProcessor/Css.php b/Package/Processor/PreProcessor/Css.php
index 152c95f..4ecac53 100644
--- a/Package/Processor/PreProcessor/Css.php
+++ b/Package/Processor/PreProcessor/Css.php
@@ -135,7 +135,12 @@ class Css implements ProcessorInterface
$imports = [];
$this->map[$fullPath] = [];
- $content = $this->staticDir->readFile($this->minification->addMinifiedSign($fullPath));
+ $tmpFilename = $this->minification->addMinifiedSign($fullPath);
+ if ($this->staticDir->isReadable($tmpFilename)) {
+ $content = $this->staticDir->readFile($tmpFilename);
+ } else {
+ $content = '';
+ }
$callback = function ($matchContent) use ($packagePath, $filePath, &$imports) {
$importRelPath = $this->normalize(pathinfo($filePath, PATHINFO_DIRNAME) . '/' . $matchContent['path']);
diff --git a/Package/Processor/PreProcessor/Less.php b/Package/Processor/PreProcessor/Less.php
index dbda66c..f4339b4 100644
--- a/Package/Processor/PreProcessor/Less.php
+++ b/Package/Processor/PreProcessor/Less.php
@@ -59,6 +59,11 @@ class Less implements ProcessorInterface
*/
private $map = [];
+ /**
+ * @var array
+ */
+ private $pFileCache = [];
+
/**
* Less constructor
*
@@ -132,6 +137,7 @@ class Less implements ProcessorInterface
$currentPackageFiles = array_merge($package->getFilesByType('less'), $package->getFilesByType('css'));
foreach ($currentPackageFiles as $file) {
+ $this->pFileCache = [];
if ($this->inParentFiles($file->getDeployedFileName(), $parentFile->getFileName(), $map)) {
return true;
}
@@ -154,6 +160,10 @@ class Less implements ProcessorInterface
return true;
} else {
foreach ($map[$parentFile] as $pFile) {
+ if (in_array($pFile, $this->pFileCache)) {
+ continue;
+ }
+ $this->pFileCache[] = $pFile;
if ($this->inParentFiles($fileName, $pFile, $map)) {
return true;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment