From: Michael Wallner Date: Thu, 3 Sep 2015 07:30:50 +0000 (+0200) Subject: check links and copy permissions X-Git-Tag: v4.1.0~10 X-Git-Url: https://git.m6w6.name/?p=pharext%2Fpharext;a=commitdiff_plain;h=2c7405294e5af29661559572a129abd337f03043 check links and copy permissions --- diff --git a/bin/pharext b/bin/pharext index 292d252..62ee132 100755 Binary files a/bin/pharext and b/bin/pharext differ diff --git a/bin/pharext.update b/bin/pharext.update index 7e0a531..f419b46 100755 Binary files a/bin/pharext.update and b/bin/pharext.update differ diff --git a/src/pharext/Updater.php b/src/pharext/Updater.php index 7da989d..d4ba5b8 100644 --- a/src/pharext/Updater.php +++ b/src/pharext/Updater.php @@ -82,8 +82,14 @@ class Updater implements Command } foreach ($this->args[0] as $file) { - if (file_exists($file)) { - $this->updatePackage(new SplFileInfo($file)); + $info = new SplFileInfo($file); + + while ($info->isLink()) { + $info = new SplFileInfo($info->getLinkTarget()); + } + + if ($info->isFile()) { + $this->updatePackage($info); } else { $this->error("File '%s' does not exist\n", $file); exit(self::EARGS); @@ -124,6 +130,9 @@ class Updater implements Command if (!copy($file->getPathname(), $temp)) { throw new Exception; } + if (!chmod($temp, $file->getPerms())) { + throw new Exception; + } $this->replacePharext($temp);