Skip to content

Commit

Permalink
Enforce same ordering as we load classes with autoloader
Browse files Browse the repository at this point in the history
  • Loading branch information
justinbeaty committed Oct 5, 2024
1 parent 0de0cc5 commit 6435ca1
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 13 deletions.
4 changes: 2 additions & 2 deletions app/Mage.php
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@

$modules = mahoGetComposerInstallationData();
foreach ($modules as $module => $info) {
if (str_contains($module, 'mahocommerce/maho')) {
if ($module === 'mahocommerce/maho') {
continue;
}
foreach ($info['codePools'] as $dir) {
Expand All @@ -73,7 +73,7 @@
$paths[] = BP . '/lib';
}
foreach ($modules as $module => $info) {
if (str_contains($module, 'mahocommerce/maho')) {
if ($module === 'mahocommerce/maho') {
continue;
}
foreach ($info['extraDirs'] as $dir) {
Expand Down
20 changes: 14 additions & 6 deletions app/code/core/Mage/Core/Model/Config.php
Original file line number Diff line number Diff line change
Expand Up @@ -340,9 +340,13 @@ public function loadBase()
}
}

// Include all other vendor files, except those we already added from core
foreach (glob(BP . '/vendor/*/*/app/etc/*.xml') as $file) {
if (!MAHO_IS_CHILD_PROJECT || !str_starts_with($file, MAHO_FRAMEWORK_DIR)) {
// Include all other module files, except those from Maho source
$modules = mahoGetComposerInstallationData();
foreach ($modules as $module => $info) {
if ($module === 'mahocommerce/maho') {
continue;
}
foreach (glob(BP . "/vendor/$module/app/etc/*.xml") as $file) {
$files[basename($file)] = $file;
}
}
Expand Down Expand Up @@ -839,9 +843,13 @@ protected function _getDeclaredModuleFiles()
}
}

// Include all other vendor files, except those we already added from core
foreach (glob(BP . '/vendor/*/*/app/etc/modules/*.xml') as $file) {
if (!MAHO_IS_CHILD_PROJECT || !str_starts_with($file, MAHO_FRAMEWORK_DIR)) {
// Include all other module files, except those from Maho source
$modules = mahoGetComposerInstallationData();
foreach ($modules as $module => $info) {
if ($module === 'mahocommerce/maho') {
continue;
}
foreach (glob(BP . "/vendor/$module/app/etc/modules/*.xml") as $file) {
$moduleFiles[basename($file)] = $file;
}
}
Expand Down
13 changes: 8 additions & 5 deletions app/code/core/Mage/Core/Model/Design/Config.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,11 +50,14 @@ public function __construct(array $params = [])
}
}

// Include all other vendor files, except those we already added from core
foreach (glob(BP . '/vendor/*/*/app/design/*/*/*/etc/theme.xml') as $file) {
if (!MAHO_IS_CHILD_PROJECT || !str_starts_with($file, MAHO_FRAMEWORK_DIR)) {
$normalizedFile = str_replace(BP . '/vendor/', '', $file);
$normalizedFile = implode('/', array_slice(explode('/', $normalizedFile), 4));
// Include all other module files, except those from Maho source
$modules = mahoGetComposerInstallationData();
foreach ($modules as $module => $info) {
if ($module === 'mahocommerce/maho') {
continue;
}
foreach (glob(BP . "/vendor/$module/app/design/*/*/*/etc/theme.xml") as $file) {
$normalizedFile = str_replace(BP . "/vendor/$module", '', $file);
$files[$normalizedFile] = $file;
}
}
Expand Down

0 comments on commit 6435ca1

Please sign in to comment.