Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix: #3352 Unable to install Drupal #3353

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
14 changes: 8 additions & 6 deletions web/src/app/System/HestiaApp.php
Expand Up @@ -117,23 +117,25 @@ public function updateComposer($version) {
$this->runUser("v-run-cli-cmd", ["composer", "selfupdate", "--$version"]);
}

public function runComposer($args, &$cmd_result = null, $version = 2): bool {
public function runComposer($args, &$cmd_result = null, $data = []): bool {
$composer =
$this->getUserHomeDir() .
DIRECTORY_SEPARATOR .
".composer" .
DIRECTORY_SEPARATOR .
"composer";
if (!is_file($composer)) {
$this->installComposer($version);
$this->installComposer($data["version"]);
} else {
$this->updateComposer($version);
$this->updateComposer($data["version"]);
}
if (empty($data["php_version"])) {
$data["php_version"] = "";
}

if (!empty($args) && is_array($args)) {
array_unshift($args, "composer");
array_unshift($args, "php" . $data["php_version"], $composer);
} else {
$args = ["composer", $args];
$args = ["php" . $data["php_version"], $composer, $args];
}

return $this->runUser("v-run-cli-cmd", $args, $cmd_result);
Expand Down
8 changes: 7 additions & 1 deletion web/src/app/WebApp/Installers/BaseSetup.php
Expand Up @@ -104,7 +104,13 @@ public function retrieveResources($options) {
}

if ($res_type === "composer") {
new ComposerResource($this->appcontext, $res_data, $resource_destination);
$res_data["php_version"] = $options["php_version"];
new ComposerResource(
$this->appcontext,
$res_data,
$resource_destination,
$options["php_version"],
);
} elseif ($res_type === "wp") {
new WpResource(
$this->appcontext,
Expand Down
7 changes: 5 additions & 2 deletions web/src/app/WebApp/Installers/Drupal/DrupalSetup.php
Expand Up @@ -38,8 +38,11 @@ class DrupalSetup extends BaseSetup {
public function install(array $options = null): bool {
parent::install($options);
parent::setup($options);

$this->appcontext->runComposer(["require", "-d " . $this->getDocRoot(), "drush/drush:^10"]);
$this->appcontext->runComposer(
["require", "-d " . $this->getDocRoot(), "drush/drush"],
$status2,
["version" => 2, "php_version" => $options["php_version"]],
);

$htaccess_rewrite = '
<IfModule mod_rewrite.c>
Expand Down
Expand Up @@ -27,7 +27,7 @@ public function __construct(HestiaApp $appcontext, $data, $destination) {
$this->project,
],
$status,
$data["version"],
$data,
);

if ($status->code !== 0) {
Expand Down