Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix issue#253 window install failed #260

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/Base/Archive/PHPUnzipper.php
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ public function __destruct()
*/
public function extractTo(string $path): void
{
$this->zipArchive->extractTo($path);
}
}

Expand Down
2 changes: 0 additions & 2 deletions src/Console/Command/InstallerCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -140,13 +140,11 @@ protected function binaryInstallWindows($path, InputInterface $input, OutputInte
$progress = new ProgressBar($output, 100);

$inst->setProgress($progress);
$inst->setInput($input);
$inst->setOutput($output);
$inst->install();

$deps_handler = new Windows\DependencyLib($php);
$deps_handler->setProgress($progress);
$deps_handler->setInput($input);
$deps_handler->setOutput($output);

$helper = $this->getHelperSet()->get('question');
Expand Down
10 changes: 6 additions & 4 deletions src/Engine/PHP.php
Original file line number Diff line number Diff line change
Expand Up @@ -212,16 +212,18 @@ protected function getIniPathFromPhpInfo($info)
$iniPath = '';

foreach ($info as $s) {
if (strpos($s, 'Loaded Configuration File') !== false) {
if (
strpos($s, 'Loaded Configuration File') !== false
|| strpos($s, 'Additional .ini files parsed') !== false
) {
[, $iniPath] = explode('=>', $s);
if ($iniPath === '(None)') {
if (strtolower(trim($iniPath)) === '(none)') {
$iniPath = '';
continue;
}

break;
}
}

$iniPath = trim($iniPath);
if ($iniPath == '') {
throw new Exception('Cannot detect php.ini directory');
Expand Down
4 changes: 2 additions & 2 deletions src/Package/PHP/Command/Install/Windows/Binary.php
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ private function uncompress($zipFile)
$this->createTempDir($this->extName);
$this->cleanup();
$zipClass = Archive\Factory::getUnzipperClassName();
$zipArchive = $zipClass($zipFile);
$zipArchive = new $zipClass($zipFile);
/** @var \Pickle\Base\Interfaces\Archive\Unzipper $zipArchive */
$this->output->writeln('Extracting archives...');
$zipArchive->extractTo($this->tempDir);
Expand Down Expand Up @@ -283,7 +283,7 @@ private function copyFiles()
if (substr($basename, 0, 4) == 'php_') {
$this->extDll[] = $basename;
$this->output->writeln("copying {$dll} to " . $dest . "\n");
$success = copy($dll, $this->php->getExtensionDir() . '/' . $basename);
$success = copy($dll, $dest);
if (!$success) {
throw new Exception('Cannot copy DLL <' . $dll . '> to <' . $dest . '>');
}
Expand Down
6 changes: 4 additions & 2 deletions src/Package/Util/Windows/DependencyLib.php
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,8 @@ private function fetchDllMap()

private function checkDepListerExe()
{
$ret = exec('deplister.exe ' . $this->php->getPath() . ' .');
$deplister = dirname($this->php->getPath()) . DIRECTORY_SEPARATOR . 'deplister.exe ';
$ret = exec($deplister . $this->php->getPath() . ' .');
if (empty($ret)) {
$depexe = @file_get_contents(self::DEPLISTER_URL);
if (!$depexe) {
Expand All @@ -210,7 +211,8 @@ private function checkDepListerExe()
private function getDllsForBinary($binary)
{
$out = [];
$ret = exec('deplister.exe ' . escapeshellarg($binary) . ' .', $out);
$deplister = dirname($this->php->getPath()) . DIRECTORY_SEPARATOR . 'deplister.exe ';
$ret = exec($deplister . escapeshellarg($binary) . ' .', $out);
if (empty($ret) || !$ret) {
throw new RuntimeException('Error while running deplister.exe');
}
Expand Down