diff --git a/linux/install.sh b/linux/install.sh index 40e2f54..272f5ba 100644 --- a/linux/install.sh +++ b/linux/install.sh @@ -6,7 +6,7 @@ set -e -PHPVM_VERSION="1.12.0" +PHPVM_VERSION="1.12.1" PHPVM_DIR="${PHPVM_DIR:-$HOME/.phpvm}" PHPVM_REPO="https://raw.githubusercontent.com/devhardiyanto/phpvm/main" diff --git a/linux/phpvm.sh b/linux/phpvm.sh index 74d2508..3710472 100644 --- a/linux/phpvm.sh +++ b/linux/phpvm.sh @@ -10,7 +10,7 @@ # phpvm use 8.3.0 # ============================================================================== -PHPVM_VERSION="1.12.0" +PHPVM_VERSION="1.12.1" PHPVM_DIR="${PHPVM_DIR:-$HOME/.phpvm}" PHPVM_VERSIONS="$PHPVM_DIR/versions" PHPVM_CURRENT="$PHPVM_DIR/current" @@ -19,7 +19,7 @@ PHPVM_CACHE="$PHPVM_DIR/cache" PHPVM_LOG="$PHPVM_DIR/build.log" PHPVM_UPDATE_URL="https://raw.githubusercontent.com/devhardiyanto/phpvm/main/version.txt" PHPVM_LAST_CHECK="$PHPVM_DIR/.last_update_check" -PHPVM_CHECK_INTERVAL=86400 # 24 hours +PHPVM_CHECK_INTERVAL=3600 # 1 hour # ── Colors ──────────────────────────────────────────────────────────────────── # printf (not echo -e): the message is passed through %s so backslashes in the @@ -32,12 +32,12 @@ _step() { printf ' \033[36m> %s\033[0m\n' "$*"; } _warn() { printf ' \033[33m[warn] %s\033[0m\n' "$*"; } _dim() { printf ' \033[90m%s\033[0m\n' "$*"; } -# ── Update checker (once per day, via version.txt) ─────────────────────────── +# ── Update checker (hourly, via version.txt) ───────────────────────────────── _phpvm_check_update() { # Skip in CI or if explicitly disabled [[ -n "${CI:-}" || -n "${PHPVM_NO_UPDATE_CHECK:-}" ]] && return - # Only check once per day + # Only check once per interval if [[ -f "$PHPVM_LAST_CHECK" ]]; then local last_ts now elapsed # GNU stat (-c) on Linux, BSD stat (-f) on macOS. diff --git a/tests/windows/Doctor.Tests.ps1 b/tests/windows/Doctor.Tests.ps1 index ab9e74f..7a228f2 100644 --- a/tests/windows/Doctor.Tests.ps1 +++ b/tests/windows/Doctor.Tests.ps1 @@ -28,4 +28,22 @@ Describe 'Invoke-Doctor' { $out | Should -Match 'Active PHP version: 8\.3\.0' } + + Context 'Test-ExtDirMatch (ext_dir junction equivalence)' { + It 'Accepts the version-specific ext path' { + Test-ExtDirMatch "$VERSIONS_DIR\8.5.6\ext" '8.5.6' | Should -BeTrue + } + It 'Accepts the current\ext junction spelling' { + Test-ExtDirMatch "$CURRENT_LINK\ext" '8.5.6' | Should -BeTrue + } + It 'Ignores a trailing backslash' { + Test-ExtDirMatch "$VERSIONS_DIR\8.5.6\ext\" '8.5.6' | Should -BeTrue + } + It 'Rejects an unrelated extension_dir' { + Test-ExtDirMatch 'C:\xampp\php\ext' '8.5.6' | Should -BeFalse + } + It 'Rejects an empty extension_dir' { + Test-ExtDirMatch '' '8.5.6' | Should -BeFalse + } + } } diff --git a/version.txt b/version.txt index 32bd932..6f165bc 100644 --- a/version.txt +++ b/version.txt @@ -1 +1 @@ -1.12.0 \ No newline at end of file +1.12.1 \ No newline at end of file diff --git a/windows/install.ps1 b/windows/install.ps1 index a27994b..c23cac9 100644 --- a/windows/install.ps1 +++ b/windows/install.ps1 @@ -8,7 +8,7 @@ Set-StrictMode -Version Latest $ErrorActionPreference = "Stop" -$PHPVM_VERSION = "1.12.0" +$PHPVM_VERSION = "1.12.1" $PHPVM_DIR = if ($env:PHPVM_DIR) { $env:PHPVM_DIR } else { "$env:USERPROFILE\.phpvm" } $PHPVM_BIN = "$PHPVM_DIR\bin" diff --git a/windows/phpvm.ps1 b/windows/phpvm.ps1 index 2233c5c..ffbc458 100644 --- a/windows/phpvm.ps1 +++ b/windows/phpvm.ps1 @@ -15,7 +15,7 @@ Set-StrictMode -Version Latest $ErrorActionPreference = "Stop" # -- Constants ----------------------------------------------------------------- -$PHPVM_VERSION = "1.12.0" +$PHPVM_VERSION = "1.12.1" $PHPVM_DIR = if ($env:PHPVM_DIR) { $env:PHPVM_DIR } else { "$env:USERPROFILE\.phpvm" } $VERSIONS_DIR = "$PHPVM_DIR\versions" $CURRENT_LINK = "$PHPVM_DIR\current" @@ -23,10 +23,10 @@ $PHPVM_BIN = "$PHPVM_DIR\bin" $PHPVM_CACERT = "$PHPVM_DIR\cacert.pem" $PHPVM_CACERT_URL = "https://curl.se/ca/cacert.pem" -# -- Update checker (once per day, via version.txt) --------------------------- +# -- Update checker (hourly, via version.txt) --------------------------------- $PHPVM_UPDATE_URL = "https://raw.githubusercontent.com/devhardiyanto/phpvm/main/version.txt" $PHPVM_LAST_CHECK = "$PHPVM_DIR\.last_update_check" -$PHPVM_CHECK_INTERVAL = 86400 # 24 hours in seconds +$PHPVM_CHECK_INTERVAL = 3600 # 1 hour in seconds function Check-PHPVMUpdate { if ($env:CI -or $env:PHPVM_NO_UPDATE_CHECK) { return } @@ -1593,6 +1593,17 @@ function Invoke-Cacert ([string]$sub) { # Read-only health check. Never mutates state - every finding points at the +# True when the ini's extension_dir points at the active version's ext folder. +# `current` is a junction to versions\, so the versions\\ext and +# current\ext spellings name the same directory - accept either rather than +# string-comparing and false-flagging a valid setup. +function Test-ExtDirMatch ([string]$iniExtDir, [string]$cur) { + if (-not $iniExtDir) { return $false } + $acceptable = @("$VERSIONS_DIR\$cur\ext", "$CURRENT_LINK\ext") | + ForEach-Object { $_.TrimEnd('\') } + return ($acceptable -icontains $iniExtDir.TrimEnd('\')) +} + # command that fixes it. Exit-code-neutral: it's a report, not a gate. function Invoke-Doctor { Write-Host "" @@ -1638,7 +1649,7 @@ function Invoke-Doctor { $info = Get-PHPBuildInfo if ($info.IniPath -and (Test-Path $info.IniPath)) { $iniExtDir = Invoke-PHP $info.Exe "echo ini_get('extension_dir');" - if ($iniExtDir -and ($iniExtDir.TrimEnd('\') -ieq $info.ExtDir.TrimEnd('\'))) { + if (Test-ExtDirMatch $iniExtDir $cur) { Doctor-Ok "extension_dir matches active build." } else { Doctor-Warn "extension_dir mismatch: '$iniExtDir' != '$($info.ExtDir)'"