Skip to content

Commit

Permalink
feat upgrade.sh: use $BLUEPRINT_ENVIRONMENT instead of --post-upgrade
Browse files Browse the repository at this point in the history
  • Loading branch information
prplwtf committed Dec 21, 2024
1 parent 3c4913e commit 0ac727f
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 18 deletions.
10 changes: 5 additions & 5 deletions blueprint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,7 @@ if [[ $1 != "-bash" ]]; then
exit 2
else
# Only run if Blueprint is not in the process of upgrading.
if [[ $1 != "--post-upgrade" ]]; then
if [[ $BLUEPRINT_ENVIRONMENT != "upgrade" ]]; then
# Print Blueprint icon with ascii characters.
C0="\x1b[0m"
C1="\x1b[31;43;1m"
Expand Down Expand Up @@ -280,8 +280,8 @@ if [[ $1 != "-bash" ]]; then
php artisan bp:cache
} &>> "$BLUEPRINT__DEBUG"

# Run migrations if Blueprint is not upgrading.
if [[ ( $1 != "--post-upgrade" ) && ( $DOCKER != "y" ) ]]; then
# Run migrations if Blueprint is not running through Docker.
if [[ $DOCKER != "y" ]]; then
PRINT INFO "Running database migrations.."
php artisan migrate --force
fi
Expand All @@ -304,12 +304,12 @@ if [[ $1 != "-bash" ]]; then
fi

# Finish installation
if [[ $1 != "--post-upgrade" ]]; then
if [[ $BLUEPRINT_ENVIRONMENT != "upgrade" ]]; then
PRINT SUCCESS "Blueprint has completed its installation process."
fi

dbAdd "blueprint.setupFinished"
# Let the panel know the user has finished installation.
dbAdd "blueprint.setupFinished"
sed -i "s~NOTINSTALLED~INSTALLED~g" "$FOLDER/app/BlueprintFramework/Services/PlaceholderService/BlueprintPlaceholderService.php"
exit 0
fi
Expand Down
14 changes: 1 addition & 13 deletions scripts/commands/advanced/upgrade.sh
Original file line number Diff line number Diff line change
Expand Up @@ -106,19 +106,7 @@ Command() {
-e "s|USERSHELL=\"/bin/bash\" #;|USERSHELL=\"$USERSHELL\" #;|g" \
"$FOLDER/blueprint.sh"
mv "$FOLDER/blueprint" "$FOLDER/.blueprint"
bash blueprint.sh --post-upgrade

# Ask user if they'd like to migrate their database.
PRINT INPUT "Would you like to migrate your database? (Y/n)"
read -r YN
if [[ ( $YN == "y"* ) || ( $YN == "Y"* ) || ( $YN == "" ) ]]; then
PRINT INFO "Running database migrations.."
php artisan migrate --force
php artisan up &>> "$BLUEPRINT__DEBUG"
else
PRINT INFO "Database migrations have been skipped."
fi
YN=""
BLUEPRINT_ENVIRONMENT="upgrade" bash blueprint.sh

if [[ ${HAS_DEV} == true ]]; then
PRINT INFO "Restoring extension development files.."
Expand Down

0 comments on commit 0ac727f

Please sign in to comment.