Skip to content

Commit

Permalink
Fix autoloader patch to work with composer-installed setup. (OpenMage…
Browse files Browse the repository at this point in the history
  • Loading branch information
colinmollenhour committed May 2, 2023
1 parent cefa503 commit d3dcc76
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions app/Mage.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,14 @@
Varien_Autoload::register();

/** AUTOLOADER PATCH **/
if (file_exists($autoloaderPath = (getenv('COMPOSER_VENDOR_PATH') ?: BP . DS . 'vendor') . DS . 'autoload.php')) {
require $autoloaderPath;
$autoloaderPath = getenv('COMPOSER_VENDOR_PATH');
if (!$autoloaderPath) {
$autoloaderPath = dirname(BP) . DS . 'vendor';
if (!is_dir($autoloaderPath)) {
$autoloaderPath = BP . DS . 'vendor';
}
}
require $autoloaderPath . DS . 'autoload.php';
/** AUTOLOADER PATCH **/

/* Support additional includes, such as composer's vendor/autoload.php files */
Expand Down

0 comments on commit d3dcc76

Please sign in to comment.