X-Git-Url: https://git.m6w6.name/?a=blobdiff_plain;f=src%2Fpharext%2FUpdater.php;h=d4ba5b8ada4498559f6f6824d5f9f4a3ddda36e4;hb=2c7405294e5af29661559572a129abd337f03043;hp=7da989db9db0c5147d83e3d0780560f881b1de21;hpb=b1fff040f69249e6060c01c14a50b49ba2ed20f3;p=pharext%2Fpharext 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);