Skip to content

Commit 9be8798

Browse files
committed
Merge pull request #10 from KevinDonaldson/master
Changing to use server variable instead of php function in Autoload.php
2 parents be9a968 + 4d86d69 commit 9be8798

File tree

2 files changed

+10
-3
lines changed

2 files changed

+10
-3
lines changed

src/Autoload.php

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,8 +73,14 @@ static public function instance()
7373
*/
7474
public static function getVendorRootDir()
7575
{
76-
if (isset($_SERVER['MAGE_VENDOR_ROOT'])) {
77-
return $_SERVER['MAGE_VENDOR_ROOT'];
76+
// Checks for variable if done in Vhosts config.
77+
if (getenv('MAGE_VENDOR_ROOT')) {
78+
return getenv('MAGE_VENDOR_ROOT');
79+
}
80+
81+
// Checks for variable if done in .htaccess file.
82+
if (getenv('REDIRECT_MAGE_VENDOR_ROOT')) {
83+
return getenv('REDIRECT_MAGE_VENDOR_ROOT');
7884
}
7985

8086
if (defined('VENDOR_ROOT')) {

tests/AutoloadTest.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,8 @@ public function testRegisterStandard()
3838

3939
public function testRegisterWithEnv()
4040
{
41-
$_SERVER['MAGE_VENDOR_ROOT'] = __DIR__ . '/../vendor';
41+
$mageVendorRoot = __DIR__ . '/../vendor';
42+
putenv("MAGE_VENDOR_ROOT=$mageVendorRoot");
4243

4344
Varien_Autoload::register();
4445

0 commit comments

Comments
 (0)