Skip to content

Commit 0f7c03d

Browse files
committed
Remove Composer Merge plugin before running Composer commands.
Seems to be the sticky wicket that is prevent the Installer from working on shared hosts.
1 parent 01208e4 commit 0f7c03d

1 file changed

Lines changed: 18 additions & 0 deletions

File tree

public/install/api/src/Api.php

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -380,6 +380,24 @@ public function postExtractWinter()
380380
]);
381381
rename($this->rootDir('.temp.sqlite'), $this->workDir('storage/database.sqlite'));
382382
}
383+
384+
// Rewrite composer.json to exclude the Composer Merge plugin, it seems to force the use of Symfony/Process and
385+
// the "proc_open" method which is commonly disabled on shared hosts.
386+
$this->log->notice('Remove Composer Merge plugin from composer.json if found', []);
387+
$composerJson = json_decode(file_get_contents($this->workDir('composer.json')), true);
388+
389+
if (isset($composerJson['require']['wikimedia/composer-merge-plugin'])) {
390+
$this->log->notice('Found merge plugin in required packages - removing', []);
391+
unset($composerJson['require']['wikimedia/composer-merge-plugin']);
392+
}
393+
if (isset($composerJson['extra']['merge-plugin'])) {
394+
$this->log->notice('Found merge plugin config in "extra" config definition - removing', []);
395+
unset($composerJson['extra']['merge-plugin']);
396+
}
397+
398+
if (!file_put_contents($this->workDir('composer.json'), json_encode($composerJson, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES))) {
399+
$this->log->error('Unable to write new Composer config', ['path' => $this->workDir('composer.json')]);
400+
}
383401
}
384402

385403
/**

0 commit comments

Comments
 (0)