Skip to content

Commit

Permalink
civicrm-upgrade-examples - Support autoloader when used as root-proje…
Browse files Browse the repository at this point in the history
…ct or dependency
  • Loading branch information
totten committed Jul 21, 2022
1 parent 5a757d3 commit 61f7b60
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion bin/civicrm-upgrade-examples
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,22 @@
<?php
namespace Civi\UpgradeTest;

require_once dirname(__DIR__) . '/vendor/autoload.php';
ini_set('display_errors', 1);
$found = 0;
$autoloaders = array(
dirname(__DIR__) . DIRECTORY_SEPARATOR . 'vendor' . DIRECTORY_SEPARATOR . 'autoload.php',
dirname(dirname(dirname(__DIR__))) . DIRECTORY_SEPARATOR . 'autoload.php'
);
foreach ($autoloaders as $autoloader) {
if (file_exists($autoloader)) {
require_once $autoloader;
$found = 1;
break;
}
}
if (!$found) {
die("Failed to find autoloader");
}

main($argv);

Expand Down

0 comments on commit 61f7b60

Please sign in to comment.