]> granicus.if.org Git - php/commitdiff
maintain original file perms
authorTomas V.V.Cox <cox@php.net>
Sun, 19 Aug 2001 12:30:24 +0000 (12:30 +0000)
committerTomas V.V.Cox <cox@php.net>
Sun, 19 Aug 2001 12:30:24 +0000 (12:30 +0000)
pear/PEAR/Installer.php
pear/PEAR/Packager.php

index a4c595691a962aba4efa01e38daa2cbcd9ccd5a5..948eab69ec8c8afad4b1ade46afd08366f081481 100644 (file)
@@ -227,10 +227,12 @@ class PEAR_Installer extends PEAR_Common
             }
             $this->log(2, "+ created dir $dest_dir");
         }
+        $orig_perms = fileperms($file);
         if (!@copy($file, $dest_file)) {
             $this->log(0, "failed to copy $file to $dest_file");
             return false;
         }
+        chmod($dest_file, $orig_perms);
         $this->log(2, "+ copy $file to $dest_file");
         // FIXME Update Package database here
         //$this->updatePackageListFrom("$d/$file");
index b790ac956f00c1c6c06b38a8912b248ad12bd4ae..0df36e03e1392add0563832c02ba0b8623049567 100644 (file)
@@ -154,19 +154,24 @@ class PEAR_Packager extends PEAR_Common
                     return $this->raiseError("could not mkdir $dir");
                 }
             }
+            //Maintain original file perms
+            $orig_perms = fileperms($fname);
             if (!@copy($fname, $file)) {
                 $this->log(0, "could not copy $fname to $file");
             } else {
                 $this->log(2, "+ copying from $fname to $file");
             }
+            chmod($file, $orig_perms);
         }
         // XXX TODO: Rebuild the package file as the old method did?
 
         // This allows build packages from different pear pack def files
-        if (!@copy($pkgfile, $this->tmpdir . DIRECTORY_SEPARATOR . 'package.xml')) {
-            return $this->raiseError("could not copy $pkgfile to " . $this->tmpdir);
+        $dest_pkgfile = $this->tmpdir . DIRECTORY_SEPARATOR . 'package.xml';
+        $this->log(2, "+ copying package $pkgfile to $dest_pkgfile");
+        if (!@copy($pkgfile, $dest_pkgfile)) {
+            return $this->raiseError("could not copy $pkgfile to $dest_pkgfile");
         }
-        $this->log(2, "+ copying package $pkgfile to " . $this->tmpdir);
+        chmod($dest_pkgfile, 0644);
 
         // TAR the Package -------------------------------------------
         chdir(dirname($this->tmpdir));