Skip to content

Commit

Permalink
feat: improve install command
Browse files Browse the repository at this point in the history
  • Loading branch information
BernhardBaumrock committed Jan 28, 2024
1 parent 5c23d24 commit 4e6f164
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 3 deletions.
6 changes: 6 additions & 0 deletions App/Command.php
Original file line number Diff line number Diff line change
Expand Up @@ -423,6 +423,12 @@ public function wire()
// pw is not yet there, eg when using pw:install
if (!is_file("index.php")) return false;

// pw is here but not installed
if (is_file("install.php")) {
$this->alert("ProcessWire exists but is not installed");
return false;
}

try {
include 'index.php';
return $this->wire = $wire;
Expand Down
15 changes: 12 additions & 3 deletions App/Commands/PwInstall.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,12 @@ public function handle()
$this->error("Use ddev ssh to execute this command from within DDEV");
return self::FAILURE;
}

if ($this->wire()) {
$this->alert("ProcessWire is already installed!");
return self::SUCCESS;
}

$this->browser = new HttpBrowser(HttpClient::create());
$this->nextStep(true);
return self::SUCCESS;
Expand Down Expand Up @@ -218,9 +224,9 @@ public function stepReloadAdmin($notice = true)
} else {
$this->success("\n"
. "##### INSTALL SUCCESSFUL ######\n"
. "### powered by baumrock.com ###");
. "### powered by baumrock.com ###\n");
$this->warn("Login: $url");
$this->alert("You can now call php rock pw:setup");
$this->alert("You can now call rockshell pw:setup");
die();
}
}
Expand Down Expand Up @@ -419,10 +425,13 @@ public function getStep()

public function host($site)
{
$defaulthost = getenv('DDEV_PROJECT')
? getenv('DDEV_PROJECT') . ".ddev.site"
: "example.com";
$site = ltrim($site, "/");
$checkHTTP = !$this->host;
$host = $this->host ?: $this->option('host')
?: $this->ask('Enter host, eg example.ddev.site');
?: $this->ask('Enter host', $defaulthost);
$this->host = $host;

// check if host is reachable via HTTP
Expand Down

0 comments on commit 4e6f164

Please sign in to comment.