4 Commits

Author SHA1 Message Date
d178b8da91 make the update more verbose for testing
All checks were successful
CI/CD Pipeline / test (push) Successful in 3s
CI/CD Pipeline / deploy (push) Successful in 20s
CI/CD Pipeline / promote_stable (push) Successful in 2s
2026-02-15 23:37:48 +01:00
7ecb6378fe make the update more verbose for testing
All checks were successful
CI/CD Pipeline / test (push) Successful in 3s
CI/CD Pipeline / deploy (push) Successful in 20s
CI/CD Pipeline / promote_stable (push) Successful in 3s
2026-02-15 23:34:18 +01:00
9496078644 make the update more verbose for testing
All checks were successful
CI/CD Pipeline / test (push) Successful in 2s
CI/CD Pipeline / deploy (push) Successful in 20s
CI/CD Pipeline / promote_stable (push) Successful in 2s
2026-02-15 23:27:49 +01:00
3aab864c34 make the update more verbose for testing
All checks were successful
CI/CD Pipeline / test (push) Successful in 2s
CI/CD Pipeline / deploy (push) Successful in 19s
CI/CD Pipeline / promote_stable (push) Successful in 3s
2026-02-15 23:22:14 +01:00

View File

@@ -59,16 +59,17 @@ resolve_configured_php_bin() {
echo "keyhelp-php-domain" echo "keyhelp-php-domain"
return return
fi fi
if command -v keyhelp-php84 >/dev/null 2>&1; then if [[ -x "/usr/bin/keyhelp-php-domain" ]]; then
echo "keyhelp-php84" echo "/usr/bin/keyhelp-php-domain"
return return
fi fi
if command -v php >/dev/null 2>&1; then if [[ -x "/usr/local/bin/keyhelp-php-domain" ]]; then
echo "php" echo "/usr/local/bin/keyhelp-php-domain"
return return
fi fi
echo "$current" echo "Configured PHP binary 'keyhelp-php-domain' was not found." >&2
return echo "Set ACP -> System -> CLI to a working custom binary (e.g. keyhelp-php84)." >&2
exit 1
fi fi
if command -v "$trimmed" >/dev/null 2>&1; then if command -v "$trimmed" >/dev/null 2>&1; then
@@ -81,21 +82,24 @@ resolve_configured_php_bin() {
return return
fi fi
echo "$current" echo "Configured PHP binary '$trimmed' is not executable/resolvable." >&2
echo "Set ACP -> System -> CLI to a valid command or absolute executable path." >&2
exit 1
} }
read_setting_php_bin() { read_setting_php_bin() {
if [[ ! -f artisan ]]; then if [[ ! -f artisan ]]; then
echo "" echo ""
return return 0
fi fi
echo "Running with PHP binary: $PHP_BIN -r <read system.php_binary>" >&2
"$PHP_BIN" -r ' "$PHP_BIN" -r '
require "vendor/autoload.php"; require "vendor/autoload.php";
$app = require "bootstrap/app.php"; $app = require "bootstrap/app.php";
$app->make(Illuminate\Contracts\Console\Kernel::class)->bootstrap(); $app->make(Illuminate\Contracts\Console\Kernel::class)->bootstrap();
$value = (string) \App\Models\Setting::where("key", "system.php_binary")->value("value"); $value = (string) \App\Models\Setting::where("key", "system.php_binary")->value("value");
echo trim($value); echo trim($value);
' 2>/dev/null || true '
} }
PHP_BIN="$(resolve_php_bin)" PHP_BIN="$(resolve_php_bin)"
@@ -112,9 +116,15 @@ if [[ -z "$COMPOSER_BIN" ]]; then
echo "Composer not found in PATH." echo "Composer not found in PATH."
exit 1 exit 1
fi fi
echo "Running with PHP binary: $PHP_BIN $COMPOSER_BIN install --no-dev --optimize-autoloader"
"$PHP_BIN" "$COMPOSER_BIN" install --no-dev --optimize-autoloader "$PHP_BIN" "$COMPOSER_BIN" install --no-dev --optimize-autoloader
CONFIGURED_PHP="$(read_setting_php_bin)" if ! CONFIGURED_PHP="$(read_setting_php_bin)"; then
echo "Failed to read configured PHP binary from settings." >&2
echo "Aborting to avoid running update with the wrong PHP binary." >&2
exit 1
fi
echo "Configured PHP binary from settings: ${CONFIGURED_PHP:-<empty>}"
PHP_BIN="$(resolve_configured_php_bin "$CONFIGURED_PHP" "$PHP_BIN")" PHP_BIN="$(resolve_configured_php_bin "$CONFIGURED_PHP" "$PHP_BIN")"
echo "Final PHP binary: $PHP_BIN" echo "Final PHP binary: $PHP_BIN"
@@ -129,15 +139,19 @@ echo "Building assets..."
npm run build npm run build
echo "Running migrations..." echo "Running migrations..."
echo "Running with PHP binary: $PHP_BIN artisan migrate --force"
"$PHP_BIN" artisan migrate --force "$PHP_BIN" artisan migrate --force
echo "Syncing version/build to settings..." echo "Syncing version/build to settings..."
echo "Running with PHP binary: $PHP_BIN -r <read composer.json version>"
VERSION="$("$PHP_BIN" -r '$c=json_decode(file_get_contents("composer.json"), true); echo $c["version"] ?? "";')" VERSION="$("$PHP_BIN" -r '$c=json_decode(file_get_contents("composer.json"), true); echo $c["version"] ?? "";')"
echo "Running with PHP binary: $PHP_BIN -r <read composer.json build>"
BUILD="$("$PHP_BIN" -r '$c=json_decode(file_get_contents("composer.json"), true); echo $c["build"] ?? "";')" BUILD="$("$PHP_BIN" -r '$c=json_decode(file_get_contents("composer.json"), true); echo $c["build"] ?? "";')"
echo "Computed from composer.json: VERSION=$VERSION, BUILD=$BUILD" echo "Computed from composer.json: VERSION=$VERSION, BUILD=$BUILD"
if [[ -n "$VERSION" || -n "$BUILD" ]]; then if [[ -n "$VERSION" || -n "$BUILD" ]]; then
echo "Updating settings version/build (VERSION=$VERSION, BUILD=$BUILD)..." echo "Updating settings version/build (VERSION=$VERSION, BUILD=$BUILD)..."
echo "Running with PHP binary: $PHP_BIN -r <write settings version/build>"
SPEEDBB_VERSION="$VERSION" SPEEDBB_BUILD="$BUILD" "$PHP_BIN" -r ' SPEEDBB_VERSION="$VERSION" SPEEDBB_BUILD="$BUILD" "$PHP_BIN" -r '
require "vendor/autoload.php"; require "vendor/autoload.php";
$app = require "bootstrap/app.php"; $app = require "bootstrap/app.php";
@@ -145,26 +159,33 @@ if [[ -n "$VERSION" || -n "$BUILD" ]]; then
$version = getenv("SPEEDBB_VERSION"); $version = getenv("SPEEDBB_VERSION");
$build = getenv("SPEEDBB_BUILD"); $build = getenv("SPEEDBB_BUILD");
if ($version !== false && $version !== "") { if ($version !== false && $version !== "") {
$updated = \Illuminate\Support\Facades\DB::table("settings") \Illuminate\Support\Facades\DB::table("settings")->upsert(
->where("key", "version") [[
->update(["value" => $version]); "key" => "version",
if ($updated === 0) { "value" => $version,
\Illuminate\Support\Facades\DB::table("settings") "created_at" => now(),
->insert(["key" => "version", "value" => $version, "created_at" => now(), "updated_at" => now()]); "updated_at" => now(),
} ]],
echo "Updated version rows: {$updated}\n"; ["key"],
["value", "updated_at"]
);
echo "Upserted version setting.\n";
} }
if ($build !== false && $build !== "") { if ($build !== false && $build !== "") {
$updated = \Illuminate\Support\Facades\DB::table("settings") \Illuminate\Support\Facades\DB::table("settings")->upsert(
->where("key", "build") [[
->update(["value" => $build]); "key" => "build",
if ($updated === 0) { "value" => $build,
\Illuminate\Support\Facades\DB::table("settings") "created_at" => now(),
->insert(["key" => "build", "value" => $build, "created_at" => now(), "updated_at" => now()]); "updated_at" => now(),
} ]],
echo "Updated build rows: {$updated}\n"; ["key"],
["value", "updated_at"]
);
echo "Upserted build setting.\n";
} }
' \ ' \
&& echo "Running with PHP binary: $PHP_BIN -r <verify settings version/build>" \
&& "$PHP_BIN" -r ' && "$PHP_BIN" -r '
require "vendor/autoload.php"; require "vendor/autoload.php";
$app = require "bootstrap/app.php"; $app = require "bootstrap/app.php";