From 0be846de83e017205f744f9f6ff895e1a3dde06f Mon Sep 17 00:00:00 2001 From: Michele Locati Date: Mon, 25 Nov 2019 16:35:11 +0100 Subject: [PATCH] Install the stable release of xdebug even on PHP 7.4RC --- __tests__/extensions.test.ts | 2 +- src/extensions.ts | 8 +------- src/scripts/win32.ps1 | 17 +++++++++++++++-- 3 files changed, 17 insertions(+), 10 deletions(-) diff --git a/__tests__/extensions.test.ts b/__tests__/extensions.test.ts index 08b9fe44..42290743 100644 --- a/__tests__/extensions.test.ts +++ b/__tests__/extensions.test.ts @@ -10,7 +10,7 @@ describe('Extension tests', () => { expect(win32).toContain('Add-Extension xdebug'); expect(win32).toContain('Add-Extension pcov'); win32 = await extensions.addExtension('xdebug, pcov', '7.4', 'win32'); - expect(win32).toContain('Add-Extension xdebug beta'); + expect(win32).toContain('Add-Extension xdebug'); win32 = await extensions.addExtension( 'does_not_exist', diff --git a/src/extensions.ts b/src/extensions.ts index ec6754b8..7d52b39d 100644 --- a/src/extensions.ts +++ b/src/extensions.ts @@ -50,13 +50,7 @@ export async function addExtensionWindows( let script = '\n'; await utils.asyncForEach(extensions, async function(extension: string) { // add script to enable extension is already installed along with php - let minimum_stability = 'stable'; - switch (version + extension.toLowerCase()) { - case '7.4xdebug': - minimum_stability = 'beta'; - break; - } - script += '\nAdd-Extension ' + extension + ' ' + minimum_stability; + script += '\nAdd-Extension ' + extension; }); return script; } diff --git a/src/scripts/win32.ps1 b/src/scripts/win32.ps1 index 97a95f29..d965460d 100644 --- a/src/scripts/win32.ps1 +++ b/src/scripts/win32.ps1 @@ -48,7 +48,8 @@ Set-PhpIniKey -Key 'date.timezone' -Value 'UTC' -Path $php_dir Enable-PhpExtension -Extension openssl, curl -Path $php_dir try { Update-PhpCAInfo -Path $php_dir -Source CurrentUser -} catch { +} +catch { Update-PhpCAInfo -Path $php_dir -Source Curl } if ([Version]$installed.Version -ge '7.4') { @@ -59,7 +60,19 @@ Add-Log $tick "PHP" $status Install-Composer -Scope System -Path $php_dir -PhpPath $php_dir Add-Log $tick "Composer" "Installed" -Function Add-Extension($extension, $mininum_stability) { +Function Add-Extension { + Param ( + [Parameter(Position = 0, Mandatory = $true)] + [ValidateNotNull()] + [ValidateLength(1, [int]::MaxValue)] + [string] + $extension, + [Parameter(Position = 1, Mandatory = $false)] + [ValidateNotNull()] + [ValidateSet('stable', 'beta', 'alpha', 'devel', 'snapshot')] + [string] + $mininum_stability = 'stable' + ) try { $extension_info = Get-PhpExtension -Path $php_dir | Where-Object { $_.Name -eq $extension -or $_.Handle -eq $extension } if ($null -ne $extension_info) {