1
0
Fork 0

realpathGlob tweaks, refs #2932

pull/3034/head
Jordi Boggiano 2014-06-01 15:15:20 +02:00
parent 443858dae7
commit 56c5af8dc4
4 changed files with 5 additions and 5 deletions

View File

@ -214,6 +214,6 @@ EOT
protected function getOldInstallationFiles($rollbackDir) protected function getOldInstallationFiles($rollbackDir)
{ {
$fs = new Filesystem; $fs = new Filesystem;
return $fs->realpathGlob($rollbackDir . '/*' . self::OLD_INSTALL_EXT) ?: array(); return $fs->realpathGlob($rollbackDir . '/*' . self::OLD_INSTALL_EXT);
} }
} }

View File

@ -132,7 +132,7 @@ abstract class ArchiveDownloader extends FileDownloader
*/ */
private function listFiles($dir) private function listFiles($dir)
{ {
$files = array_merge($this->filesystem->realpathGlob($dir . '/.*') ?: array(), $this->filesystem->realpathGlob($dir . '/*') ?: array()); $files = array_merge($this->filesystem->realpathGlob($dir . '/.*'), $this->filesystem->realpathGlob($dir . '/*'));
return array_values(array_filter($files, function ($el) { return array_values(array_filter($files, function ($el) {
return basename($el) !== '.' && basename($el) !== '..'; return basename($el) !== '.' && basename($el) !== '..';

View File

@ -126,7 +126,7 @@ class LibraryInstaller implements InstallerInterface
$downloadPath = $this->getPackageBasePath($package); $downloadPath = $this->getPackageBasePath($package);
if (strpos($package->getName(), '/')) { if (strpos($package->getName(), '/')) {
$packageVendorDir = dirname($downloadPath); $packageVendorDir = dirname($downloadPath);
if (is_dir($packageVendorDir) && !$this->filesystem->realpathGlob($packageVendorDir.'/*')) { if (is_dir($packageVendorDir) && $this->filesystem->isDirEmpty($packageVendorDir)) {
@rmdir($packageVendorDir); @rmdir($packageVendorDir);
} }
} }

View File

@ -52,9 +52,9 @@ class Filesystem
{ {
$matches = glob($pattern, $flags); $matches = glob($pattern, $flags);
if (!$matches) { if (!$matches) {
return false; return array();
} }
var_dump($matches);
return array_map('realpath', $matches); return array_map('realpath', $matches);
} }