From 0eceb8906b46ce221693b520131ad30d795e740b Mon Sep 17 00:00:00 2001 From: AdmiringWorm Date: Fri, 3 Feb 2017 22:38:06 +0100 Subject: [PATCH 1/7] (php) Added v 5.3.x legacy package --- manual/php-legacy/README.md | 3 + manual/php-legacy/php_5.3.x/php_5.3.x.nuspec | 40 ++++++++++++++ .../php_5.3.x/tools/chocolateyInstall.ps1 | 55 +++++++++++++++++++ .../php_5.3.x/tools/chocolateyUninstall.ps1 | 20 +++++++ .../php_5.3.x/tools/downloadInfo.csv | 2 + manual/php-legacy/php_5.3.x/update.ps1 | 53 ++++++++++++++++++ 6 files changed, 173 insertions(+) create mode 100644 manual/php-legacy/README.md create mode 100644 manual/php-legacy/php_5.3.x/php_5.3.x.nuspec create mode 100644 manual/php-legacy/php_5.3.x/tools/chocolateyInstall.ps1 create mode 100644 manual/php-legacy/php_5.3.x/tools/chocolateyUninstall.ps1 create mode 100644 manual/php-legacy/php_5.3.x/tools/downloadInfo.csv create mode 100644 manual/php-legacy/php_5.3.x/update.ps1 diff --git a/manual/php-legacy/README.md b/manual/php-legacy/README.md new file mode 100644 index 00000000000..3e3e9e96459 --- /dev/null +++ b/manual/php-legacy/README.md @@ -0,0 +1,3 @@ +The php versions located in this folder is just here for convenience. +Just in case there is a need to update old versions of php. +Not one of these versions are officially supported by the php dev team. diff --git a/manual/php-legacy/php_5.3.x/php_5.3.x.nuspec b/manual/php-legacy/php_5.3.x/php_5.3.x.nuspec new file mode 100644 index 00000000000..04f78892ea2 --- /dev/null +++ b/manual/php-legacy/php_5.3.x/php_5.3.x.nuspec @@ -0,0 +1,40 @@ + + + + + php + PHP (Hypertext Preprocessor) + 0.0 + PHP Authors + chocolatey, Rob Reynolds + PHP – widely-used general-purpose scripting language that is especially suited for Web development and can be embedded into HTML. + PHP is an HTML-embedded scripting language. Much of its syntax is borrowed from C, Java and Perl with a couple of unique PHP-specific features thrown in. The goal of the language is to allow web developers to write dynamically generated pages quickly. + +## Package Parameters +- `/DontAddToPath` - Do not add install directory to path +- `/InstallDir:` - Override the installation directory (needs to be specified both during install and update, until it is remembered by choco) +- `/ThreadSafe` - Install the thread safe version of php that is compatible with Apache. + +These parameters can be passed to the installer with the use of --params. +For example: `--params '"/ThreadSafe ""/InstallDir:C:\PHP"""'`. + + http://www.php.net/ + https://github.com/chocolatey/chocolatey-coreteampackages/tree/master/automatic/php + php development programming foss cross-platform admin + http://us.php.net/license/ + false + https://secure.php.net/ChangeLog-5.php#5.3.29 + https://cdn.rawgit.com/chocolatey/chocolatey-coreteampackages/4e147ce52b1a2a7ac522ffbce6d176f257de6ac1/icons/php.svg + https://bugs.php.net/ + https://secure.php.net/docs.php + http://git.php.net + + + + + + + + + + diff --git a/manual/php-legacy/php_5.3.x/tools/chocolateyInstall.ps1 b/manual/php-legacy/php_5.3.x/tools/chocolateyInstall.ps1 new file mode 100644 index 00000000000..9f2f80a1d0e --- /dev/null +++ b/manual/php-legacy/php_5.3.x/tools/chocolateyInstall.ps1 @@ -0,0 +1,55 @@ +import-module "$env:ChocolateyInstall\helpers\chocolateyInstaller.psm1" +$ErrorActionPreference = 'Stop' + +$toolsPath = Split-Path $MyInvocation.MyCommand.Definition +. $toolsPath\helpers.ps1 + +$installLocation = GetInstallLocation "$toolsPath\.." + +if ($installLocation) { + Write-Host "Uninstalling previous version of php..." + UninstallPackage -libDirectory "$toolsPath\.." -packageName 'php' + Uninstall-ChocolateyPath $installLocation +} + +$pp = Get-PackageParameters + +$downloadInfo = GetDownloadInfo -downloadInfoFile "$toolsPath\downloadInfo.csv" -parameters $pp + +$packageArgs = @{ + packageName = 'php' + url = $downloadInfo.URL32 + checksum = $downloadInfo.Checksum32 + checksumType = 'sha256' + checksumType64 = 'sha256' +} +$newInstallLocation = $packageArgs.unzipLocation = GetNewInstallLocation $packageArgs.packageName $env:ChocolateyPackageVersion $pp + +Install-ChocolateyZipPackage @packageArgs + +if (!$pp.DontAddToPath) { + Install-ChocolateyPath $newInstallLocation +} + +$php_ini_path = $newInstallLocation + '/php.ini' + +if (($installLocation -ne $newInstallLocation) -and (Test-Path "$installLocation\php.ini")) { + Write-Host "Moving old configuration file." + Move-Item "$installLocation\php.ini" "$php_ini_path" + + $di = Get-ChildItem $installLocation -ea 0 | Measure-Object + if ($di.Count -eq 0) { + Write-Host "Removing old install location." + Remove-Item -Force -ea 0 $installLocation + } +} + +if (!(Test-Path $php_ini_path)) { + Write-Host 'Creating default php.ini' + cp $newInstallLocation/php.ini-production $php_ini_path + + Write-Host 'Configuring PHP extensions directory' + (gc $php_ini_path) -replace '; extension_dir = "ext"', 'extension_dir = "ext"' | sc $php_ini_path +} + +if (!$pp.ThreadSafe) { Write-Host 'Please make sure you have CGI installed in IIS for local hosting' } diff --git a/manual/php-legacy/php_5.3.x/tools/chocolateyUninstall.ps1 b/manual/php-legacy/php_5.3.x/tools/chocolateyUninstall.ps1 new file mode 100644 index 00000000000..f7c3e1462ab --- /dev/null +++ b/manual/php-legacy/php_5.3.x/tools/chocolateyUninstall.ps1 @@ -0,0 +1,20 @@ +$toolsPath = Split-Path $MyInvocation.MyCommand.Definition +. $toolsPath\helpers.ps1 + +$packageName = 'php' + +$installLocation = GetInstallLocation -libDirectory "$toolsPath\.." + +if ($installLocation) { + UninstallPackage -libDirectory "$toolsPath\.." -packageName $packageName + + $di = Get-ChildItem $installLocation -ea 0 | Measure-Object + if ($di.Count -eq 0) { + Remove-Item -Force -ea 0 $installLocation + } + + Uninstall-ChocolateyPath $installLocation + +} else { + Write-Warning "$packageName install path was not found. It may already be uninstalled!" +} diff --git a/manual/php-legacy/php_5.3.x/tools/downloadInfo.csv b/manual/php-legacy/php_5.3.x/tools/downloadInfo.csv new file mode 100644 index 00000000000..71a0cc25475 --- /dev/null +++ b/manual/php-legacy/php_5.3.x/tools/downloadInfo.csv @@ -0,0 +1,2 @@ +threadsafe|http://windows.php.net//downloads/releases/archives/php-5.3.29-Win32-VC9-x86.zip||c1d7bf791fda6dea29c3eb8ae73188ff3a45970d5ca54ff9e5702971381c19cd| +not-threadsafe|http://windows.php.net//downloads/releases/archives/php-5.3.29-nts-Win32-VC9-x86.zip||d63846ede80daacdb1ca2359c4f8bf1bd2f9831fe1b9599d2e4345ede931b75b| diff --git a/manual/php-legacy/php_5.3.x/update.ps1 b/manual/php-legacy/php_5.3.x/update.ps1 new file mode 100644 index 00000000000..a83b3ac6ae9 --- /dev/null +++ b/manual/php-legacy/php_5.3.x/update.ps1 @@ -0,0 +1,53 @@ +import-module au + +$releases = 'http://windows.php.net/downloads/releases/archives/' + +function global:au_BeforeUpdate { + $Latest.ChecksumTS32 = Get-RemoteChecksum $Latest.URLTS32 + $Latest.ChecksumNTS32 = Get-RemoteChecksum $Latest.URLNTS32 + + $lines = @( + @('threadsafe'; $Latest.URLTS32; '' ; $Latest.ChecksumTS32; '') -join '|' + @('not-threadsafe'; $Latest.URLNTS32; '' ; $Latest.ChecksumNTS32; '') -join '|' + ) + + [System.IO.File]::WriteAllLines("$PSScriptRoot\tools\downloadInfo.csv", $lines); +} + +function global:au_SearchReplace { + @{ + ".\tools\chocolateyInstall.ps1" = @{ + "(?i)(^\s*packageName\s*=\s*)('.*')" = "`$1'$($Latest.PackageName)'" + } + + "php_5.3.x.nuspec" = @{ + "(\).*?(\)" = "`${1}$($Latest.ReleaseNotes)`$2" + } + } +} + +function global:au_GetLatest { + $download_page = Invoke-WebRequest -Uri $releases + + $re = 'php-5\.3.+-nts.+\.zip$' + $versionSort = { [version]($_ -split '-' | select -Index 1) } + $url = $download_page.links | ? href -match $re | % href | sort $versionSort -Descending | select -First 1 + $urlTS = $url -replace '\-nts','' + $version = $url -split '-' | select -Index 1 + $majorVersion = $version -split '\.' | select -first 1 + $Result = @{ + Version = $version + URLNTS32 = "http://windows.php.net/" + $url + URLTS32 = "http://windows.php.net/" + $urlTS + ReleaseNotes = "https://secure.php.net/ChangeLog-${majorVersion}.php#${version}" + PackageName = 'php' + } + + if ($Result.URLNTS32 -eq $Result.TS32) { + throw "The threadsafe and non-threadsafe 32bit url is equal... This is not expected" + } + + $Result +} + +update -ChecksumFor none From 05afc34aaeceb078ad719c7dc400e46ffb3650eb Mon Sep 17 00:00:00 2001 From: AdmiringWorm Date: Fri, 3 Feb 2017 22:50:06 +0100 Subject: [PATCH 2/7] (php) Added v 5.4.x legacy package --- manual/php-legacy/php_5.4.x/php_5.4.x.nuspec | 40 ++++++++++++++ .../php_5.4.x/tools/chocolateyInstall.ps1 | 55 +++++++++++++++++++ .../php_5.4.x/tools/chocolateyUninstall.ps1 | 20 +++++++ .../php_5.4.x/tools/downloadInfo.csv | 2 + manual/php-legacy/php_5.4.x/update.ps1 | 53 ++++++++++++++++++ 5 files changed, 170 insertions(+) create mode 100644 manual/php-legacy/php_5.4.x/php_5.4.x.nuspec create mode 100644 manual/php-legacy/php_5.4.x/tools/chocolateyInstall.ps1 create mode 100644 manual/php-legacy/php_5.4.x/tools/chocolateyUninstall.ps1 create mode 100644 manual/php-legacy/php_5.4.x/tools/downloadInfo.csv create mode 100644 manual/php-legacy/php_5.4.x/update.ps1 diff --git a/manual/php-legacy/php_5.4.x/php_5.4.x.nuspec b/manual/php-legacy/php_5.4.x/php_5.4.x.nuspec new file mode 100644 index 00000000000..9d2af4309c6 --- /dev/null +++ b/manual/php-legacy/php_5.4.x/php_5.4.x.nuspec @@ -0,0 +1,40 @@ + + + + + php + PHP (Hypertext Preprocessor) + 0.0 + PHP Authors + chocolatey, Rob Reynolds + PHP – widely-used general-purpose scripting language that is especially suited for Web development and can be embedded into HTML. + PHP is an HTML-embedded scripting language. Much of its syntax is borrowed from C, Java and Perl with a couple of unique PHP-specific features thrown in. The goal of the language is to allow web developers to write dynamically generated pages quickly. + +## Package Parameters +- `/DontAddToPath` - Do not add install directory to path +- `/InstallDir:` - Override the installation directory (needs to be specified both during install and update, until it is remembered by choco) +- `/ThreadSafe` - Install the thread safe version of php that is compatible with Apache. + +These parameters can be passed to the installer with the use of --params. +For example: `--params '"/ThreadSafe ""/InstallDir:C:\PHP"""'`. + + http://www.php.net/ + https://github.com/chocolatey/chocolatey-coreteampackages/tree/master/automatic/php + php development programming foss cross-platform admin + http://us.php.net/license/ + false + https://secure.php.net/ChangeLog-5.php#5.4.45 + https://cdn.rawgit.com/chocolatey/chocolatey-coreteampackages/4e147ce52b1a2a7ac522ffbce6d176f257de6ac1/icons/php.svg + https://bugs.php.net/ + https://secure.php.net/docs.php + http://git.php.net + + + + + + + + + + diff --git a/manual/php-legacy/php_5.4.x/tools/chocolateyInstall.ps1 b/manual/php-legacy/php_5.4.x/tools/chocolateyInstall.ps1 new file mode 100644 index 00000000000..9f2f80a1d0e --- /dev/null +++ b/manual/php-legacy/php_5.4.x/tools/chocolateyInstall.ps1 @@ -0,0 +1,55 @@ +import-module "$env:ChocolateyInstall\helpers\chocolateyInstaller.psm1" +$ErrorActionPreference = 'Stop' + +$toolsPath = Split-Path $MyInvocation.MyCommand.Definition +. $toolsPath\helpers.ps1 + +$installLocation = GetInstallLocation "$toolsPath\.." + +if ($installLocation) { + Write-Host "Uninstalling previous version of php..." + UninstallPackage -libDirectory "$toolsPath\.." -packageName 'php' + Uninstall-ChocolateyPath $installLocation +} + +$pp = Get-PackageParameters + +$downloadInfo = GetDownloadInfo -downloadInfoFile "$toolsPath\downloadInfo.csv" -parameters $pp + +$packageArgs = @{ + packageName = 'php' + url = $downloadInfo.URL32 + checksum = $downloadInfo.Checksum32 + checksumType = 'sha256' + checksumType64 = 'sha256' +} +$newInstallLocation = $packageArgs.unzipLocation = GetNewInstallLocation $packageArgs.packageName $env:ChocolateyPackageVersion $pp + +Install-ChocolateyZipPackage @packageArgs + +if (!$pp.DontAddToPath) { + Install-ChocolateyPath $newInstallLocation +} + +$php_ini_path = $newInstallLocation + '/php.ini' + +if (($installLocation -ne $newInstallLocation) -and (Test-Path "$installLocation\php.ini")) { + Write-Host "Moving old configuration file." + Move-Item "$installLocation\php.ini" "$php_ini_path" + + $di = Get-ChildItem $installLocation -ea 0 | Measure-Object + if ($di.Count -eq 0) { + Write-Host "Removing old install location." + Remove-Item -Force -ea 0 $installLocation + } +} + +if (!(Test-Path $php_ini_path)) { + Write-Host 'Creating default php.ini' + cp $newInstallLocation/php.ini-production $php_ini_path + + Write-Host 'Configuring PHP extensions directory' + (gc $php_ini_path) -replace '; extension_dir = "ext"', 'extension_dir = "ext"' | sc $php_ini_path +} + +if (!$pp.ThreadSafe) { Write-Host 'Please make sure you have CGI installed in IIS for local hosting' } diff --git a/manual/php-legacy/php_5.4.x/tools/chocolateyUninstall.ps1 b/manual/php-legacy/php_5.4.x/tools/chocolateyUninstall.ps1 new file mode 100644 index 00000000000..f7c3e1462ab --- /dev/null +++ b/manual/php-legacy/php_5.4.x/tools/chocolateyUninstall.ps1 @@ -0,0 +1,20 @@ +$toolsPath = Split-Path $MyInvocation.MyCommand.Definition +. $toolsPath\helpers.ps1 + +$packageName = 'php' + +$installLocation = GetInstallLocation -libDirectory "$toolsPath\.." + +if ($installLocation) { + UninstallPackage -libDirectory "$toolsPath\.." -packageName $packageName + + $di = Get-ChildItem $installLocation -ea 0 | Measure-Object + if ($di.Count -eq 0) { + Remove-Item -Force -ea 0 $installLocation + } + + Uninstall-ChocolateyPath $installLocation + +} else { + Write-Warning "$packageName install path was not found. It may already be uninstalled!" +} diff --git a/manual/php-legacy/php_5.4.x/tools/downloadInfo.csv b/manual/php-legacy/php_5.4.x/tools/downloadInfo.csv new file mode 100644 index 00000000000..8eb15a85031 --- /dev/null +++ b/manual/php-legacy/php_5.4.x/tools/downloadInfo.csv @@ -0,0 +1,2 @@ +threadsafe|http://windows.php.net//downloads/releases/archives/php-5.4.45-Win32-VC9-x86.zip||38cde4bac05e916fb0c0b78a2e5bfeec9b02b4b6fc51c9a02a66e4fc1e1a1d08| +not-threadsafe|http://windows.php.net//downloads/releases/archives/php-5.4.45-nts-Win32-VC9-x86.zip||63da6fd7c73c25eef1baec7099c3de348390671f9b2e61b74a8ab300fa4eab92| diff --git a/manual/php-legacy/php_5.4.x/update.ps1 b/manual/php-legacy/php_5.4.x/update.ps1 new file mode 100644 index 00000000000..fcfa66ed334 --- /dev/null +++ b/manual/php-legacy/php_5.4.x/update.ps1 @@ -0,0 +1,53 @@ +import-module au + +$releases = 'http://windows.php.net/downloads/releases/archives/' + +function global:au_BeforeUpdate { + $Latest.ChecksumTS32 = Get-RemoteChecksum $Latest.URLTS32 + $Latest.ChecksumNTS32 = Get-RemoteChecksum $Latest.URLNTS32 + + $lines = @( + @('threadsafe'; $Latest.URLTS32; '' ; $Latest.ChecksumTS32; '') -join '|' + @('not-threadsafe'; $Latest.URLNTS32; '' ; $Latest.ChecksumNTS32; '') -join '|' + ) + + [System.IO.File]::WriteAllLines("$PSScriptRoot\tools\downloadInfo.csv", $lines); +} + +function global:au_SearchReplace { + @{ + ".\tools\chocolateyInstall.ps1" = @{ + "(?i)(^\s*packageName\s*=\s*)('.*')" = "`$1'$($Latest.PackageName)'" + } + + "php_5.4.x.nuspec" = @{ + "(\).*?(\)" = "`${1}$($Latest.ReleaseNotes)`$2" + } + } +} + +function global:au_GetLatest { + $download_page = Invoke-WebRequest -Uri $releases + + $re = 'php-5\.4.+-nts.+\.zip$' + $versionSort = { [version]($_ -split '-' | select -Index 1) } + $url = $download_page.links | ? href -match $re | % href | sort $versionSort -Descending | select -First 1 + $urlTS = $url -replace '\-nts','' + $version = $url -split '-' | select -Index 1 + $majorVersion = $version -split '\.' | select -first 1 + $Result = @{ + Version = $version + URLNTS32 = "http://windows.php.net/" + $url + URLTS32 = "http://windows.php.net/" + $urlTS + ReleaseNotes = "https://secure.php.net/ChangeLog-${majorVersion}.php#${version}" + PackageName = 'php' + } + + if ($Result.URLNTS32 -eq $Result.TS32) { + throw "The threadsafe and non-threadsafe 32bit url is equal... This is not expected" + } + + $Result +} + +update -ChecksumFor none From 73e2ed6ed08f92c7b82e6ea0b0c7d911797bfe92 Mon Sep 17 00:00:00 2001 From: AdmiringWorm Date: Fri, 3 Feb 2017 22:50:30 +0100 Subject: [PATCH 3/7] (php) Removed unnecessary dependency --- automatic/php/php.nuspec | 1 - 1 file changed, 1 deletion(-) diff --git a/automatic/php/php.nuspec b/automatic/php/php.nuspec index e1370885339..e3e4f28aaea 100644 --- a/automatic/php/php.nuspec +++ b/automatic/php/php.nuspec @@ -29,7 +29,6 @@ For example: `--params '"/ThreadSafe ""/InstallDir:C:\PHP"""'`. https://secure.php.net/docs.php http://git.php.net - From 648670f7759049fda2edb0a2beec3e09b022de8f Mon Sep 17 00:00:00 2001 From: AdmiringWorm Date: Fri, 3 Feb 2017 23:04:16 +0100 Subject: [PATCH 4/7] (php) Added v 5.5.x legacy package --- manual/php-legacy/php_5.5.x/php_5.5.x.nuspec | 40 +++++++++++ .../php_5.5.x/tools/chocolateyInstall.ps1 | 63 ++++++++++++++++++ .../php_5.5.x/tools/chocolateyUninstall.ps1 | 20 ++++++ .../php_5.5.x/tools/downloadInfo.csv | 2 + manual/php-legacy/php_5.5.x/update.ps1 | 66 +++++++++++++++++++ 5 files changed, 191 insertions(+) create mode 100644 manual/php-legacy/php_5.5.x/php_5.5.x.nuspec create mode 100644 manual/php-legacy/php_5.5.x/tools/chocolateyInstall.ps1 create mode 100644 manual/php-legacy/php_5.5.x/tools/chocolateyUninstall.ps1 create mode 100644 manual/php-legacy/php_5.5.x/tools/downloadInfo.csv create mode 100644 manual/php-legacy/php_5.5.x/update.ps1 diff --git a/manual/php-legacy/php_5.5.x/php_5.5.x.nuspec b/manual/php-legacy/php_5.5.x/php_5.5.x.nuspec new file mode 100644 index 00000000000..123d164a4be --- /dev/null +++ b/manual/php-legacy/php_5.5.x/php_5.5.x.nuspec @@ -0,0 +1,40 @@ + + + + + php + PHP (Hypertext Preprocessor) + 0.0 + PHP Authors + chocolatey, Rob Reynolds + PHP – widely-used general-purpose scripting language that is especially suited for Web development and can be embedded into HTML. + PHP is an HTML-embedded scripting language. Much of its syntax is borrowed from C, Java and Perl with a couple of unique PHP-specific features thrown in. The goal of the language is to allow web developers to write dynamically generated pages quickly. + +## Package Parameters +- `/DontAddToPath` - Do not add install directory to path +- `/InstallDir:` - Override the installation directory (needs to be specified both during install and update, until it is remembered by choco) +- `/ThreadSafe` - Install the thread safe version of php that is compatible with Apache. + +These parameters can be passed to the installer with the use of --params. +For example: `--params '"/ThreadSafe ""/InstallDir:C:\PHP"""'`. + + http://www.php.net/ + https://github.com/chocolatey/chocolatey-coreteampackages/tree/master/automatic/php + php development programming foss cross-platform admin + http://us.php.net/license/ + false + https://secure.php.net/ChangeLog-5.php#5.5.38 + https://cdn.rawgit.com/chocolatey/chocolatey-coreteampackages/4e147ce52b1a2a7ac522ffbce6d176f257de6ac1/icons/php.svg + https://bugs.php.net/ + https://secure.php.net/docs.php + http://git.php.net + + + + + + + + + + diff --git a/manual/php-legacy/php_5.5.x/tools/chocolateyInstall.ps1 b/manual/php-legacy/php_5.5.x/tools/chocolateyInstall.ps1 new file mode 100644 index 00000000000..4478ad105de --- /dev/null +++ b/manual/php-legacy/php_5.5.x/tools/chocolateyInstall.ps1 @@ -0,0 +1,63 @@ +import-module "$env:ChocolateyInstall\helpers\chocolateyInstaller.psm1" +$ErrorActionPreference = 'Stop' + +$toolsPath = Split-Path $MyInvocation.MyCommand.Definition +. $toolsPath\helpers.ps1 + +$installLocation = GetInstallLocation "$toolsPath\.." + +if ($installLocation) { + Write-Host "Uninstalling previous version of php..." + UninstallPackage -libDirectory "$toolsPath\.." -packageName 'php' + Uninstall-ChocolateyPath $installLocation +} + +$pp = Get-PackageParameters + +$downloadInfo = GetDownloadInfo -downloadInfoFile "$toolsPath\downloadInfo.csv" -parameters $pp + +if (!(UrlExists($downloadInfo.URL32))) { + Write-Host "Using archive urls" + $downloadInfo.URL32 = AddArchivePathToUrl($downloadInfo.URL32) + $downloadInfo.URL64 = AddArchivePathToUrl($downloadInfo.URL64) # Assuming the 64 bit version is archived simultaneously as the 32 bit one +} + +$packageArgs = @{ + packageName = 'php' + url = $downloadInfo.URL32 + url64Bit = $downloadInfo.URL64 + checksum = $downloadInfo.Checksum32 + checksum64 = $downloadInfo.Checksum64 + checksumType = 'sha256' + checksumType64 = 'sha256' +} +$newInstallLocation = $packageArgs.unzipLocation = GetNewInstallLocation $packageArgs.packageName $env:ChocolateyPackageVersion $pp + +Install-ChocolateyZipPackage @packageArgs + +if (!$pp.DontAddToPath) { + Install-ChocolateyPath $newInstallLocation +} + +$php_ini_path = $newInstallLocation + '/php.ini' + +if (($installLocation -ne $newInstallLocation) -and (Test-Path "$installLocation\php.ini")) { + Write-Host "Moving old configuration file." + Move-Item "$installLocation\php.ini" "$php_ini_path" + + $di = Get-ChildItem $installLocation -ea 0 | Measure-Object + if ($di.Count -eq 0) { + Write-Host "Removing old install location." + Remove-Item -Force -ea 0 $installLocation + } +} + +if (!(Test-Path $php_ini_path)) { + Write-Host 'Creating default php.ini' + cp $newInstallLocation/php.ini-production $php_ini_path + + Write-Host 'Configuring PHP extensions directory' + (gc $php_ini_path) -replace '; extension_dir = "ext"', 'extension_dir = "ext"' | sc $php_ini_path +} + +if (!$pp.ThreadSafe) { Write-Host 'Please make sure you have CGI installed in IIS for local hosting' } diff --git a/manual/php-legacy/php_5.5.x/tools/chocolateyUninstall.ps1 b/manual/php-legacy/php_5.5.x/tools/chocolateyUninstall.ps1 new file mode 100644 index 00000000000..f7c3e1462ab --- /dev/null +++ b/manual/php-legacy/php_5.5.x/tools/chocolateyUninstall.ps1 @@ -0,0 +1,20 @@ +$toolsPath = Split-Path $MyInvocation.MyCommand.Definition +. $toolsPath\helpers.ps1 + +$packageName = 'php' + +$installLocation = GetInstallLocation -libDirectory "$toolsPath\.." + +if ($installLocation) { + UninstallPackage -libDirectory "$toolsPath\.." -packageName $packageName + + $di = Get-ChildItem $installLocation -ea 0 | Measure-Object + if ($di.Count -eq 0) { + Remove-Item -Force -ea 0 $installLocation + } + + Uninstall-ChocolateyPath $installLocation + +} else { + Write-Warning "$packageName install path was not found. It may already be uninstalled!" +} diff --git a/manual/php-legacy/php_5.5.x/tools/downloadInfo.csv b/manual/php-legacy/php_5.5.x/tools/downloadInfo.csv new file mode 100644 index 00000000000..f0f1e3464cc --- /dev/null +++ b/manual/php-legacy/php_5.5.x/tools/downloadInfo.csv @@ -0,0 +1,2 @@ +threadsafe|http://windows.php.net//downloads/releases/php-5.5.38-Win32-VC11-x86.zip|http://windows.php.net//downloads/releases/php-5.5.38-Win32-VC11-x64.zip|800a7e2be97aace568848e6bb91c93114ba59793a4f89c8756c66b975f2311be|2a5eec621c36b94a5f2c59706f219b598fafbef9930215760f854de6ffba0092 +not-threadsafe|http://windows.php.net//downloads/releases/php-5.5.38-nts-Win32-VC11-x86.zip|http://windows.php.net//downloads/releases/php-5.5.38-nts-Win32-VC11-x64.zip|443fba0410873b9d7083c2b815b0d53bbcec8b2f5e8a69469e06e8d8cb2d343e|abdf2fefcd7d1daf75d689e309e8571879b15d4b61726546e4e064f96167387a diff --git a/manual/php-legacy/php_5.5.x/update.ps1 b/manual/php-legacy/php_5.5.x/update.ps1 new file mode 100644 index 00000000000..205b26a1e66 --- /dev/null +++ b/manual/php-legacy/php_5.5.x/update.ps1 @@ -0,0 +1,66 @@ +import-module au + +$releases = 'http://windows.php.net/downloads/releases/' +# Change the release url above with this one when +# version 5.5.x is only available from the archive section +# Fallback to the archive version in ./tools/chocolateyInstall.ps1 +# can also be removed then +#$releases = 'http://windows.php.net/downloads/releases/archives/' + +function global:au_BeforeUpdate { + $Latest.ChecksumTS32 = Get-RemoteChecksum $Latest.URLTS32 + $Latest.ChecksumTS64 = Get-RemoteChecksum $Latest.URLTS64 + $Latest.ChecksumNTS32 = Get-RemoteChecksum $Latest.URLNTS32 + $Latest.ChecksumNTS64 = Get-RemoteChecksum $Latest.URLNTS64 + + $lines = @( + @('threadsafe'; $Latest.URLTS32; $Latest.URLTS64; $Latest.ChecksumTS32; $Latest.ChecksumTS64) -join '|' + @('not-threadsafe'; $Latest.URLNTS32; $Latest.URLNTS64; $Latest.ChecksumNTS32; $Latest.ChecksumNTS64) -join '|' + ) + + [System.IO.File]::WriteAllLines("$PSScriptRoot\tools\downloadInfo.csv", $lines); +} + +function global:au_SearchReplace { + @{ + ".\tools\chocolateyInstall.ps1" = @{ + "(?i)(^\s*packageName\s*=\s*)('.*')" = "`$1'$($Latest.PackageName)'" + } + + "php_5.5.x.nuspec" = @{ + "(\).*?(\)" = "`${1}$($Latest.ReleaseNotes)`$2" + } + } +} + +function global:au_GetLatest { + $download_page = Invoke-WebRequest -Uri $releases + + $re = 'php-5\.5.+-nts.+\.zip$' + $versionSort = { [version]($_ -split '-' | select -Index 1) } + $url = $download_page.links | ? href -match $re | % href | sort $versionSort -Descending | select -First 2 + $urlTS = $url | % { $_ -replace '\-nts','' } + $version = $url[0] -split '-' | select -Index 1 + $majorVersion = $version -split '\.' | select -first 1 + $Result = @{ + Version = $version + URLNTS32 = "http://windows.php.net/" + ($url -match 'x86' | select -First 1) + URLNTS64 = "http://windows.php.net/" + ($url -match 'x64' | select -First 1) + URLTS32 = "http://windows.php.net/" + ($urlTS -match 'x86' | select -First 1) + URLTS64 = "http://windows.php.net/" + ($urlTS -match 'x64' | select -First 1) + ReleaseNotes = "https://secure.php.net/ChangeLog-${majorVersion}.php#${version}" + PackageName = 'php' + } + + if ($Result.URLNTS32 -eq $Result.TS32) { + throw "The threadsafe and non-threadsafe 32bit url is equal... This is not expected" + } + + if ($Result.URLNTS64 -eq $Result.TS64) { + throw "The threadsafe and non-threadsafe 64bit url is equal... This is not expected" + } + + $Result +} + +update -ChecksumFor none From ee8c874971b1e9fb06f727207c38680154ab40db Mon Sep 17 00:00:00 2001 From: AdmiringWorm Date: Fri, 3 Feb 2017 23:28:36 +0100 Subject: [PATCH 5/7] (php-legacy) Added helper script to force update all legacy php packages --- manual/php-legacy/update_all.ps1 | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 manual/php-legacy/update_all.ps1 diff --git a/manual/php-legacy/update_all.ps1 b/manual/php-legacy/update_all.ps1 new file mode 100644 index 00000000000..eb08f7019ec --- /dev/null +++ b/manual/php-legacy/update_all.ps1 @@ -0,0 +1,25 @@ +# Convenience script to update all packages +# They will still need to be manually pushed +# with [PUSH php_5.3.x php_5.4.x php_5.5.x] + +param( + [switch]$CreateCommitMessage +) + +$global:au_Force = $true + +$folders = Get-ChildItem "$PSScriptRoot" -Directory | ? { Test-Path "$_\update.ps1"} + +foreach ($folder in $folders) { + try { + pushd $folder.FullName + . ".\update.ps1" + } finally { + popd + } +} + +$global:au_Force = $null + +git add "$PSScriptRoot" +git commit -m "[PUSH $(($folders | % Name) -join ' ')]" From 3b4c9e8a12913ae2217bcb15afc45199d20b47e3 Mon Sep 17 00:00:00 2001 From: AdmiringWorm Date: Sat, 4 Feb 2017 01:03:32 +0100 Subject: [PATCH 6/7] (php) Previous installed package list isn't removed --- automatic/php/tools/helpers.ps1 | 3 +++ manual/php-legacy/README.md | 2 +- manual/php-legacy/update_all.ps1 | 4 +++- 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/automatic/php/tools/helpers.ps1 b/automatic/php/tools/helpers.ps1 index 5d2c7479f7f..0f8d6f6a05c 100644 --- a/automatic/php/tools/helpers.ps1 +++ b/automatic/php/tools/helpers.ps1 @@ -75,6 +75,9 @@ function UninstallPackage { $txtFile = Resolve-Path "$libDirectory\*.txt" | select -first 1 $fileName = ($txtFile -split '\\' | select -last 1).TrimEnd('.txt') Uninstall-ChocolateyZipPackage -PackageName $packageName -ZipFileName $fileName + if (Test-Path $txtFile) { + Remove-Item -Force -ea 0 $txtFile + } } } diff --git a/manual/php-legacy/README.md b/manual/php-legacy/README.md index 3e3e9e96459..def492e2c29 100644 --- a/manual/php-legacy/README.md +++ b/manual/php-legacy/README.md @@ -1,3 +1,3 @@ The php versions located in this folder is just here for convenience. Just in case there is a need to update old versions of php. -Not one of these versions are officially supported by the php dev team. +Not a single one of these versions are officially supported by the php dev team anymore. diff --git a/manual/php-legacy/update_all.ps1 b/manual/php-legacy/update_all.ps1 index eb08f7019ec..35bba73c2cb 100644 --- a/manual/php-legacy/update_all.ps1 +++ b/manual/php-legacy/update_all.ps1 @@ -22,4 +22,6 @@ foreach ($folder in $folders) { $global:au_Force = $null git add "$PSScriptRoot" -git commit -m "[PUSH $(($folders | % Name) -join ' ')]" +if ($CreateCommitMessage) { + git commit -m "[PUSH $(($folders | % Name) -join ' ')]" +} From 9de659468ccf9535bab500e990ad8ba09a124844 Mon Sep 17 00:00:00 2001 From: AdmiringWorm Date: Sat, 4 Feb 2017 02:03:38 +0100 Subject: [PATCH 7/7] (php-legacy) Added package source urls --- manual/php-legacy/php_5.3.x/php_5.3.x.nuspec | 2 +- manual/php-legacy/php_5.4.x/php_5.4.x.nuspec | 2 +- manual/php-legacy/php_5.5.x/php_5.5.x.nuspec | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/manual/php-legacy/php_5.3.x/php_5.3.x.nuspec b/manual/php-legacy/php_5.3.x/php_5.3.x.nuspec index 04f78892ea2..9a86e847437 100644 --- a/manual/php-legacy/php_5.3.x/php_5.3.x.nuspec +++ b/manual/php-legacy/php_5.3.x/php_5.3.x.nuspec @@ -19,7 +19,7 @@ These parameters can be passed to the installer with the use of --params. For example: `--params '"/ThreadSafe ""/InstallDir:C:\PHP"""'`. http://www.php.net/ - https://github.com/chocolatey/chocolatey-coreteampackages/tree/master/automatic/php + https://github.com/chocolatey/chocolatey-coreteampackages/tree/master/manual/php-legacy/php_5.3.x php development programming foss cross-platform admin http://us.php.net/license/ false diff --git a/manual/php-legacy/php_5.4.x/php_5.4.x.nuspec b/manual/php-legacy/php_5.4.x/php_5.4.x.nuspec index 9d2af4309c6..c28f5383d04 100644 --- a/manual/php-legacy/php_5.4.x/php_5.4.x.nuspec +++ b/manual/php-legacy/php_5.4.x/php_5.4.x.nuspec @@ -19,7 +19,7 @@ These parameters can be passed to the installer with the use of --params. For example: `--params '"/ThreadSafe ""/InstallDir:C:\PHP"""'`. http://www.php.net/ - https://github.com/chocolatey/chocolatey-coreteampackages/tree/master/automatic/php + https://github.com/chocolatey/chocolatey-coreteampackages/tree/master/manual/php-legacy/php_5.4.x php development programming foss cross-platform admin http://us.php.net/license/ false diff --git a/manual/php-legacy/php_5.5.x/php_5.5.x.nuspec b/manual/php-legacy/php_5.5.x/php_5.5.x.nuspec index 123d164a4be..d34a2808d76 100644 --- a/manual/php-legacy/php_5.5.x/php_5.5.x.nuspec +++ b/manual/php-legacy/php_5.5.x/php_5.5.x.nuspec @@ -19,7 +19,7 @@ These parameters can be passed to the installer with the use of --params. For example: `--params '"/ThreadSafe ""/InstallDir:C:\PHP"""'`. http://www.php.net/ - https://github.com/chocolatey/chocolatey-coreteampackages/tree/master/automatic/php + https://github.com/chocolatey/chocolatey-coreteampackages/tree/master/manual/php-legacy/php_5.5.x php development programming foss cross-platform admin http://us.php.net/license/ false