Skip to content

Commit

Permalink
Remove Composer Merge plugin before running Composer commands.
Browse files Browse the repository at this point in the history
Seems to be the sticky wicket that is prevent the Installer from working on shared hosts.
  • Loading branch information
bennothommo committed Oct 8, 2021
1 parent 01208e4 commit 0f7c03d
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions public/install/api/src/Api.php
Original file line number Diff line number Diff line change
Expand Up @@ -380,6 +380,24 @@ public function postExtractWinter()
]);
rename($this->rootDir('.temp.sqlite'), $this->workDir('storage/database.sqlite'));
}

// Rewrite composer.json to exclude the Composer Merge plugin, it seems to force the use of Symfony/Process and
// the "proc_open" method which is commonly disabled on shared hosts.
$this->log->notice('Remove Composer Merge plugin from composer.json if found', []);
$composerJson = json_decode(file_get_contents($this->workDir('composer.json')), true);

if (isset($composerJson['require']['wikimedia/composer-merge-plugin'])) {
$this->log->notice('Found merge plugin in required packages - removing', []);
unset($composerJson['require']['wikimedia/composer-merge-plugin']);
}
if (isset($composerJson['extra']['merge-plugin'])) {
$this->log->notice('Found merge plugin config in "extra" config definition - removing', []);
unset($composerJson['extra']['merge-plugin']);
}

if (!file_put_contents($this->workDir('composer.json'), json_encode($composerJson, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES))) {
$this->log->error('Unable to write new Composer config', ['path' => $this->workDir('composer.json')]);
}
}

/**
Expand Down

0 comments on commit 0f7c03d

Please sign in to comment.