1
0
mirror of https://github.com/flarum/core.git synced 2025-07-23 09:41:26 +02:00

chore: Allow installing monorepo through composer for dev purposes

This is as close as we're gonna get to a good solution for now.
This commit is contained in:
Daniël Klabbers
2022-04-30 21:00:27 +02:00
committed by GitHub
parent b14c0780d2
commit 2e89ba3c94
2 changed files with 207 additions and 5 deletions

View File

@@ -89,16 +89,36 @@ class ExtensionManager
// Using keys of an associative array allows us to do these checks in constant time.
$installedSet = [];
$composerJsonConfs = [];
foreach ($installed as $package) {
if (Arr::get($package, 'type') != 'flarum-extension' || empty(Arr::get($package, 'name'))) {
$name = Arr::get($package, 'name');
if (empty($name)) {
continue;
}
$installedSet[Arr::get($package, 'name')] = true;
$path = isset($package['install-path'])
$packagePath = isset($package['install-path'])
? $this->paths->vendor.'/composer/'.$package['install-path']
: $this->paths->vendor.'/'.Arr::get($package, 'name');
: $this->paths->vendor.'/'.$name;
if (Arr::get($package, 'type') === 'flarum-extension') {
$composerJsonConfs[$packagePath] = $package;
}
if ($subextPaths = Arr::get($package, 'extra.flarum-subextensions', [])) {
foreach ($subextPaths as $subExtPath) {
$subPackagePath = "$packagePath/$subExtPath";
$conf = json_decode($this->filesystem->get("$subPackagePath/composer.json"), true);
if (Arr::get($conf, 'type') === 'flarum-extension') {
$composerJsonConfs[$subPackagePath] = $conf;
}
}
}
}
foreach ($composerJsonConfs as $path => $package) {
$installedSet[Arr::get($package, 'name')] = true;
// Instantiates an Extension object using the package path and composer.json file.
$extension = new Extension($path, $package);