-
Notifications
You must be signed in to change notification settings - Fork 381
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #418 from chocolatey/php
(new package) Php
- Loading branch information
Showing
6 changed files
with
255 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<package xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"> | ||
<metadata> | ||
<id>php</id> | ||
<title>PHP (Hypertext Preprocessor)</title> | ||
<version>0.0</version> | ||
<authors>PHP Authors</authors> | ||
<owners>chocolatey, Rob Reynolds</owners> | ||
<summary>PHP – widely-used general-purpose scripting language that is especially suited for Web development and can be embedded into HTML.</summary> | ||
<description>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.</description> | ||
<projectUrl>http://www.php.net/</projectUrl> | ||
<packageSourceUrl>https://github.com/chocolatey/chocolatey-coreteampackages/tree/master/automatic/php</packageSourceUrl> | ||
<tags>php development programming foss cross-platform admin</tags> | ||
<licenseUrl>http://us.php.net/license/</licenseUrl> | ||
<requireLicenseAcceptance>false</requireLicenseAcceptance> | ||
<releaseNotes>https://secure.php.net/ChangeLog-7.php#7.0.13</releaseNotes> | ||
<iconUrl>https://rawgit.com/chocolatey/chocolatey-coreteampackages/4e147ce52b1a2a7ac522ffbce6d176f257de6ac1/icons/php.svg</iconUrl> | ||
<bugTrackerUrl>https://bugs.php.net/</bugTrackerUrl> | ||
<docsUrl>https://secure.php.net/docs.php</docsUrl> | ||
<projectSourceUrl>http://git.php.net</projectSourceUrl> | ||
<dependencies> | ||
<dependency id="chocolatey" version="0.9.10" /> | ||
<dependency id="vcredist2015" /> | ||
</dependencies> | ||
</metadata> | ||
<files> | ||
<file src="tools\**" target="tools" /> | ||
</files> | ||
</package> | ||
<!-- character encoding: “UTF-8” --> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
$toolsPath = Split-Path $MyInvocation.MyCommand.Definition | ||
. $toolsPath\helpers.ps1 | ||
|
||
$packageArgs = @{ | ||
packageName = 'php' | ||
url = 'http://windows.php.net//downloads/releases/php-7.0.13-nts-Win32-VC14-x86.zip' | ||
url64Bit = 'http://windows.php.net//downloads/releases/php-7.0.13-nts-Win32-VC14-x64.zip' | ||
checksum = '8a9a0f8a0c368ae75c398b93238b2ee14ca7746e5e265cac6d8a50ae5f9624db' | ||
checksum64 = '1d117986b57cc57441a3056f578ba56a7fcbb53a7cd2d7ddca7c634a6012687f' | ||
checksumType = 'sha256' | ||
checksumType64 = 'sha256' | ||
} | ||
$installLocation = $packageArgs.unzipLocation = Join-Path $(Get-ToolsLocation) $packageArgs.packageName | ||
|
||
if (!(UrlExists($packageArgs.url))) { | ||
Write-Host "Using archive urls" | ||
$url = AddArchivePathToUrl($url) | ||
$url64 = AddArchivePathToUrl($url64) # Assuming the 64 bit version is archived simultaneously as the 32 bit one | ||
} | ||
|
||
Install-ChocolateyZipPackage @packageArgs | ||
Install-ChocolateyPath $installLocation | ||
|
||
$php_ini_path = $installLocation + '/php.ini' | ||
if (!(Test-Path $php_ini_path)) { | ||
Write-Host 'Creating default php.ini' | ||
cp $installLocation/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 | ||
} | ||
|
||
Write-Host 'Please make sure you have CGI installed in IIS for local hosting' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
$packageName = 'php' | ||
|
||
$installLocation = Join-Path $(Get-ToolsLocation) $packageName | ||
Write-Host "Deleting $installLocation" | ||
rm -Force -Recurse $installLocation | ||
|
||
#Uninstall-ChocolateyPath $installLocation |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
#TODO: Proxy | ||
function UrlExists($uri) { | ||
try { | ||
$webClient =[System.Net.HttpWebRequest] [System.Net.WebRequest]::Create($uri) | ||
$webClient.Method = "HEAD" | ||
$webClient.Timeout = 3000 | ||
$webClient.GetResponse() | ||
} | ||
catch [System.Net.WebException] { | ||
return $false; | ||
} | ||
return $true; | ||
} | ||
|
||
function AddArchivePathToUrl($url) { | ||
$newUrl = $url | ||
$lix = $url.LastIndexOf("/") | ||
if ($lix -ne -1) { | ||
$newUrl = $url.SubString(0, $lix) + "/archives" + $url.SubString($lix) | ||
} | ||
return $newUrl | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
import-module au | ||
|
||
$releases = 'http://windows.php.net/download' | ||
|
||
function global:au_SearchReplace { | ||
@{ | ||
".\tools\chocolateyInstall.ps1" = @{ | ||
"(?i)(^\s*url\s*=\s*)('.*')" = "`$1'$($Latest.URL32)'" | ||
"(?i)(^\s*url64bit\s*=\s*)('.*')" = "`$1'$($Latest.URL64)'" | ||
"(?i)(^\s*checksum\s*=\s*)('.*')" = "`$1'$($Latest.Checksum32)'" | ||
"(?i)(^\s*checksum64\s*=\s*)('.*')" = "`$1'$($Latest.Checksum64)'" | ||
"(?i)(^\s*packageName\s*=\s*)('.*')" = "`$1'$($Latest.PackageName)'" | ||
} | ||
|
||
"$($Latest.PackageName).nuspec" = @{ | ||
"(\<releaseNotes\>).*?(\</releaseNotes\>)" = "`${1}$($Latest.ReleaseNotes)`$2" | ||
} | ||
} | ||
} | ||
|
||
function global:au_GetLatest { | ||
$download_page = Invoke-WebRequest -Uri $releases | ||
|
||
$re = 'php.+\.zip$' | ||
$url = $download_page.links | ? href -match 'php-\d.+-nts.+\.zip$' | % href | select -First 2 | ||
$version = $url[0] -split '-' | select -Index 1 | ||
@{ | ||
Version = $version | ||
URL32 = "http://windows.php.net/" + ($url -match 'x86' | select -First 1) | ||
URL64 = "http://windows.php.net/" + ($url -match 'x64' | select -First 1) | ||
ReleaseNotes = "https://secure.php.net/ChangeLog-7.php#${version}" | ||
} | ||
} | ||
|
||
update |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.