check links and copy permissions
authorMichael Wallner <mike@php.net>
Thu, 3 Sep 2015 07:30:50 +0000 (09:30 +0200)
committerMichael Wallner <mike@php.net>
Thu, 3 Sep 2015 07:30:50 +0000 (09:30 +0200)
bin/pharext
bin/pharext.update
src/pharext/Updater.php

index 292d252ec4e8a66f34ad8503f9dcc9ea7a5037f5..62ee132e705ef2a2da1b85a4e3eeae441dbf8c2b 100755 (executable)
Binary files a/bin/pharext and b/bin/pharext differ
index 7e0a531fbb29575a6b74f303bd5e69a640938f19..f419b46da9c30040a56b99d5ffc5e9514ec9bde9 100755 (executable)
Binary files a/bin/pharext.update and b/bin/pharext.update differ
index 7da989db9db0c5147d83e3d0780560f881b1de21..d4ba5b8ada4498559f6f6824d5f9f4a3ddda36e4 100644 (file)
@@ -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);