|
158 | 158 | if ($remoteFileIsZip) { |
159 | 159 | $tempFolder = New-TempDirectory |
160 | 160 | Expand-ArchiveWith7Zip -ArchivePath $downloadedFile -DestinationPath $tempFolder |
161 | | - $phpDlls = @(Get-ChildItem -Path $tempFolder\php_*.dll -File -Depth 0) |
162 | | - if ($phpDlls.Count -eq 0) { |
163 | | - $phpDlls = @(Get-ChildItem -Path $tempFolder\php_*.dll -File -Depth 1) |
164 | | - } |
165 | | - if ($phpDlls.Count -eq 0) { |
166 | | - throw ("No PHP DLL found in archive downloaded from {0}" -f $availablePackageVersion.PackageArchiveUrl) |
167 | | - } |
168 | | - if ($phpDlls.Count -ne 1) { |
169 | | - throw ("Multiple PHP DLL found in archive downloaded from {0}" -f $availablePackageVersion.PackageArchiveUrl) |
170 | | - } |
171 | | - $dllPath = $phpDlls[0].FullName |
172 | | - switch ($peclPackageHandle) { |
173 | | - 'amqp' { |
174 | | - $tmp = Get-ChildItem -Path $tempFolder\rabbit*.dll -File -Depth 1 |
175 | | - if ($tmp) { |
176 | | - $additionalFiles += $tmp |
177 | | - } |
178 | | - } |
179 | | - 'couchbase' { |
180 | | - $libcouchbaseDll = Join-Path -Path $tempFolder -ChildPath 'libcouchbase.dll' |
181 | | - if (Test-Path -LiteralPath $libcouchbaseDll -PathType Leaf) { |
182 | | - $additionalFiles += $libcouchbaseDll |
183 | | - } |
184 | | - } |
185 | | - 'decimal' { |
186 | | - $libmpdecDll = Join-Path -Path $tempFolder -ChildPath 'libmpdec.dll' |
187 | | - if (Test-Path -LiteralPath $libmpdecDll -PathType Leaf) { |
188 | | - $additionalFiles += $libmpdecDll |
189 | | - } |
190 | | - } |
191 | | - 'imagick' { |
192 | | - $additionalFiles += @(Get-ChildItem -Path $tempFolder\CORE_*.dll -File -Depth 1) |
193 | | - $additionalFiles += @(Get-ChildItem -Path $tempFolder\IM_*.dll -File -Depth 1) |
194 | | - $additionalFiles += @(Get-ChildItem -Path $tempFolder\FILTER_*.dll -File -Depth 1) |
195 | | - } |
196 | | - 'memcached' { |
197 | | - $libmemcachedDll = Join-Path -Path $tempFolder -ChildPath 'libmemcached.dll' |
198 | | - $libhashkitDll = Join-Path -Path $tempFolder -ChildPath 'libhashkit.dll' |
199 | | - if (Test-Path -LiteralPath $libmemcachedDll -PathType Leaf) { |
200 | | - $additionalFiles += $libmemcachedDll |
201 | | - } |
202 | | - if (Test-Path -LiteralPath $libhashkitDll -PathType Leaf) { |
203 | | - $additionalFiles += $libhashkitDll |
204 | | - } |
| 161 | + $dllFiles = Get-ChildItem -Path $tempFolder\*.dll -File -Depth 0 |
| 162 | + if (-not($dllFiles)) { |
| 163 | + $dllFiles = Get-ChildItem -Path $tempFolder\*.dll -File -Depth 1 |
| 164 | + if (-not($dllFiles)) { |
| 165 | + $dllFiles = @() |
205 | 166 | } |
206 | | - 'yaml' { |
207 | | - $yamlDll = Join-Path -Path $tempFolder -ChildPath 'yaml.dll' |
208 | | - if (Test-Path -LiteralPath $yamlDll -PathType Leaf) { |
209 | | - $additionalFiles += $yamlDll |
| 167 | + } |
| 168 | + $dllPath = $null |
| 169 | + foreach ($dllFile in $dllFiles) { |
| 170 | + if ($dllFile.Name -like "php_*.dll") { |
| 171 | + if ($dllPath) { |
| 172 | + throw ("Multiple PHP DLL found in archive downloaded from {0}" -f $availablePackageVersion.PackageArchiveUrl) |
210 | 173 | } |
| 174 | + $dllPath = $dllFile.FullName |
| 175 | + } else { |
| 176 | + $additionalFiles += $dllFile.FullName |
211 | 177 | } |
212 | 178 | } |
| 179 | + if (-not($dllPath)) { |
| 180 | + throw ("No PHP DLL found in archive downloaded from {0}" -f $availablePackageVersion.PackageArchiveUrl) |
| 181 | + } |
213 | 182 | } |
214 | 183 | else { |
215 | 184 | $keepDownloadedFile = $true |
|
0 commit comments