Commit b493a0ab by Carsten Brandt

composer: create directory if it does not exists

may happen if yii is installed globally. fixes #6402
parent dec17f51
...@@ -176,6 +176,9 @@ class Installer extends LibraryInstaller ...@@ -176,6 +176,9 @@ class Installer extends LibraryInstaller
protected function saveExtensions(array $extensions) protected function saveExtensions(array $extensions)
{ {
$file = $this->vendorDir . '/' . self::EXTENSION_FILE; $file = $this->vendorDir . '/' . self::EXTENSION_FILE;
if (!file_exists(dirname($file))) {
mkdir(dirname($file), 0777, true);
}
$array = str_replace("'<vendor-dir>", '$vendorDir . \'', var_export($extensions, true)); $array = str_replace("'<vendor-dir>", '$vendorDir . \'', var_export($extensions, true));
file_put_contents($file, "<?php\n\n\$vendorDir = dirname(__DIR__);\n\nreturn $array;\n"); file_put_contents($file, "<?php\n\n\$vendorDir = dirname(__DIR__);\n\nreturn $array;\n");
// invalidate opcache of extensions.php if exists // invalidate opcache of extensions.php if exists
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment