-
Notifications
You must be signed in to change notification settings - Fork 2
/
fix-autoload.php
21 lines (21 loc) · 1.23 KB
/
fix-autoload.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
<?php
/**
* This helper is needed to "trick" composer autoloader to load the prefixed files
* Otherwise if owncloud/core contains the same libraries ( i.e. guzzle ) it won't
* load the files, as the file hash is the same and thus composer would think this was already loaded
*
* More information also found here: https://github.com/humbug/php-scoper/issues/298
*/
// TODO: fix all scoped deps
$match = '(guzzlehttp|symfony|lcobucci\/jwt|ramsey\/uuid|paragonie\/random_compat|ralouphie\/getallheaders|phpseclib\/phpseclib\/phpseclib)';
$scoper_path = __DIR__ . '/vendor/composer';
$static_loader_path = $scoper_path . '/autoload_static.php';
echo "Fixing $static_loader_path \n";
$static_loader = file_get_contents($static_loader_path);
$static_loader = preg_replace('/\'([A-Za-z0-9]*?)\' => __DIR__ \. (.*?' . $match . '.*?),/', '\'PsAccounts$1\' => __DIR__ . $2,', $static_loader);
file_put_contents($static_loader_path, $static_loader);
$files_loader_path = $scoper_path . '/autoload_files.php';
echo "Fixing $files_loader_path \n";
$files_loader = file_get_contents($files_loader_path);
$files_loader = preg_replace('/\'(.*?)\' => (.*?' . $match . '.*?),/', '\'PsAccounts$1\' => $2,', $files_loader);
file_put_contents($files_loader_path, $files_loader);