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 installer migration #6

Merged
merged 4 commits into from
Jul 9, 2024
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 20 additions & 6 deletions public/install/forms.php
Original file line number Diff line number Diff line change
Expand Up @@ -59,18 +59,32 @@
header('LOCATION: index.php?step=3.5');
}

if (isset($_POST['generateKey'])) {
wh_log('Start APP_KEY generation', 'debug');

try {
if (!str_contains(getenv('APP_KEY'), 'base64')) {
$logs = run_console('php artisan key:generate --force');
wh_log($logs, 'debug');

wh_log('Created APP_KEY successful', 'debug');
header('LOCATION: index.php?step=3.6');
} else {
wh_log('Key already exists. Skipping', 'debug');
}
} catch (Throwable $th) {
wh_log('Creating APP_KEY failed', 'error');
header("LOCATION: index.php?step=3.5&message=" . $th->getMessage() . " <br>Please check the installer.log file in /var/www/controlpanel/storage/logs !");
}
}

if (isset($_POST['feedDB'])) {
wh_log('Feeding the Database', 'debug');
$logs = '';

try {
//$logs .= run_console(setenv('COMPOSER_HOME', dirname(__FILE__, 3) . '/vendor/bin/composer'));
//$logs .= run_console('composer install --no-dev --optimize-autoloader');
if (!str_contains(getenv('APP_KEY'), 'base64')) {
$logs .= run_console('php artisan key:generate --force');
} else {
$logs .= "Key already exists. Skipping\n";
}
$logs .= run_console('php artisan storage:link');
$logs .= run_console('php artisan migrate --seed --force');
$logs .= run_console('php artisan db:seed --class=ExampleItemsSeeder --force');
Expand All @@ -82,7 +96,7 @@
header('LOCATION: index.php?step=4');
} catch (Throwable $th) {
wh_log('Feeding the Database failed', 'error');
header("LOCATION: index.php?step=3.5&message=" . $th->getMessage() . " <br>Please check the installer.log file in /var/www/controlpanel/storage/logs !");
header("LOCATION: index.php?step=3.6&message=" . $th->getMessage() . " <br>Please check the installer.log file in /var/www/controlpanel/storage/logs !");
}
}

Expand Down
Loading