|
5 | 5 | namespace Php\Pie\Installing; |
6 | 6 |
|
7 | 7 | use Php\Pie\Downloading\DownloadedPackage; |
8 | | -use Php\Pie\ExtensionType; |
9 | 8 | use Php\Pie\File\BinaryFile; |
| 9 | +use Php\Pie\File\WindowsDelete; |
10 | 10 | use Php\Pie\Platform\TargetPlatform; |
11 | 11 | use Php\Pie\Platform\WindowsExtensionAssetName; |
12 | 12 | use RecursiveDirectoryIterator; |
|
21 | 21 | use function file_exists; |
22 | 22 | use function is_file; |
23 | 23 | use function mkdir; |
24 | | -use function sprintf; |
25 | 24 | use function str_replace; |
26 | 25 | use function strlen; |
27 | 26 | use function substr; |
@@ -79,17 +78,6 @@ public function __invoke( |
79 | 78 | $output->writeln('<info>Copied extras:</info> ' . $destinationPathname); |
80 | 79 | } |
81 | 80 |
|
82 | | - /** |
83 | | - * @link https://github.com/php/pie/issues/20 |
84 | | - * |
85 | | - * @todo this should be improved in future to try to automatically set up the ext |
86 | | - */ |
87 | | - $output->writeln(sprintf( |
88 | | - '<comment>You must now add "%s=%s" to your php.ini</comment>', |
89 | | - $downloadedPackage->package->extensionType() === ExtensionType::PhpModule ? 'extension' : 'zend_extension', |
90 | | - $downloadedPackage->package->extensionName()->name(), |
91 | | - )); |
92 | | - |
93 | 81 | $binaryFile = BinaryFile::fromFileWithSha256Checksum($destinationDllName); |
94 | 82 |
|
95 | 83 | ($this->setupIniFile)( |
@@ -124,6 +112,10 @@ private function copyExtensionDll(TargetPlatform $targetPlatform, DownloadedPack |
124 | 112 | $destinationDllName = $targetPlatform->phpBinaryPath->extensionPath() . DIRECTORY_SEPARATOR |
125 | 113 | . 'php_' . $downloadedPackage->package->extensionName()->name() . '.dll'; |
126 | 114 |
|
| 115 | + if (file_exists($destinationDllName)) { |
| 116 | + WindowsDelete::usingMoveToTemp($destinationDllName); |
| 117 | + } |
| 118 | + |
127 | 119 | if (! copy($sourceDllName, $destinationDllName) || ! file_exists($destinationDllName) && ! is_file($destinationDllName)) { |
128 | 120 | throw new RuntimeException('Failed to install DLL to ' . $destinationDllName); |
129 | 121 | } |
|
0 commit comments