projects
/
pharext
/
pharext
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
|
github
raw
|
inline
| side by side
check links and copy permissions
[pharext/pharext]
/
src
/
pharext
/
Updater.php
diff --git
a/src/pharext/Updater.php
b/src/pharext/Updater.php
index bee5ed6e71f730be22c3d38d08922e912e8e5263..d4ba5b8ada4498559f6f6824d5f9f4a3ddda36e4 100644
(file)
--- a/
src/pharext/Updater.php
+++ b/
src/pharext/Updater.php
@@
-82,8
+82,14
@@
class Updater implements Command
}
foreach ($this->args[0] as $file) {
}
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);
} else {
$this->error("File '%s' does not exist\n", $file);
exit(self::EARGS);
@@
-109,6
+115,11
@@
class Updater implements Command
}
$phar->stopBuffering();
}
$phar->stopBuffering();
+
+ $phar->setMetadata([
+ "version" => Metadata::version(),
+ "header" => Metadata::header(),
+ ] + $phar->getMetadata());
}
private function updatePackage(SplFileInfo $file, Phar $phar = null) {
}
private function updatePackage(SplFileInfo $file, Phar $phar = null) {
@@
-119,6
+130,9
@@
class Updater implements Command
if (!copy($file->getPathname(), $temp)) {
throw new Exception;
}
if (!copy($file->getPathname(), $temp)) {
throw new Exception;
}
+ if (!chmod($temp, $file->getPerms())) {
+ throw new Exception;
+ }
$this->replacePharext($temp);
$this->replacePharext($temp);