|
50 | 50 | [ValidateNotNull()] |
51 | 51 | [ValidateLength(1, [int]::MaxValue)] |
52 | 52 | [string] $Path, |
| 53 | + [Parameter(Mandatory = $false, Position = 4, HelpMessage = 'The path where additional files (DLL, ...) will be installed; if omitted we''ll use the directory where PHP resides')] |
| 54 | + [ValidateNotNull()] |
| 55 | + [ValidateLength(1, [int]::MaxValue)] |
| 56 | + [string] $AdditionalFilesPath, |
53 | 57 | [switch] $DontEnable, |
54 | 58 | [switch] $NoDependencies |
55 | 59 | ) |
|
68 | 72 | if (-Not(Test-Path -LiteralPath $phpVersion.ExtensionsPath -PathType Container)) { |
69 | 73 | throw "The PHP extension directory ""$($phpVersion.ExtensionsPath)"" configured in your php.ini does not exist. You may need to create it, or fix the extension_dir setting in the php.ini file." |
70 | 74 | } |
| 75 | + if ($null -eq $AdditionalFilesPath -or $AdditionalFilesPath -eq '') { |
| 76 | + $AdditionalFilesPath = $phpVersion.ActualFolder |
| 77 | + } elseif (-Not(Test-Path -LiteralPath $AdditionalFilesPath -PathType Container)) { |
| 78 | + throw "The directory ""$AdditionalFilesPath"" where additional files should be saved does not exist." |
| 79 | + } |
71 | 80 | if ($null -eq $Version) { |
72 | 81 | $Version = '' |
73 | 82 | } |
|
219 | 228 | Write-Debug -Message "Failed to reset the ACL for $($oldExtension.Filename): $($_.Exception.Message)" |
220 | 229 | } |
221 | 230 | foreach ($additionalFile in $additionalFiles) { |
222 | | - $additionalFileDestination = Join-Path -Path $phpVersion.ActualFolder -ChildPath $(Split-Path -Path $additionalFile -Leaf) |
| 231 | + $additionalFileDestination = Join-Path -Path $AdditionalFilesPath -ChildPath $(Split-Path -Path $additionalFile -Leaf) |
223 | 232 | Copy-Item -LiteralPath $additionalFile -Destination $additionalFileDestination -Force |
224 | 233 | try { |
225 | 234 | Reset-Acl -Path $additionalFileDestination |
|
234 | 243 | else { |
235 | 244 | Write-Verbose ("Installing new extension '{0}' version {1}" -f $newExtension.Name, $newExtension.Version) |
236 | 245 | if (-not($NoDependencies)) { |
237 | | - Install-PhpExtensionPrerequisite -Extension $newExtension.Handle -PhpPath $phpVersion.ActualFolder |
| 246 | + Install-PhpExtensionPrerequisite -Extension $newExtension.Handle -InstallPath $AdditionalFilesPath -PhpPath $phpVersion.ActualFolder |
238 | 247 | } |
239 | 248 | if ($null -eq $finalDllName) { |
240 | 249 | $newExtensionFilename = [System.IO.Path]::Combine($phpVersion.ExtensionsPath, [System.IO.Path]::GetFileName($dllPath)) |
|
249 | 258 | Write-Debug -Message "Failed to reset the ACL for $($newExtensionFilename): $($_.Exception.Message)" |
250 | 259 | } |
251 | 260 | foreach ($additionalFile in $additionalFiles) { |
252 | | - $additionalFileDestination = Join-Path -Path $phpVersion.ActualFolder -ChildPath $(Split-Path -Path $additionalFile -Leaf) |
| 261 | + $additionalFileDestination = Join-Path -Path $AdditionalFilesPath -ChildPath $(Split-Path -Path $additionalFile -Leaf) |
253 | 262 | Copy-Item -LiteralPath $additionalFile -Destination $additionalFileDestination -Force |
254 | 263 | try { |
255 | 264 | Reset-Acl -Path $additionalFileDestination |
|
0 commit comments