Skip to content

Commit

Permalink
Update installer.php
Browse files Browse the repository at this point in the history
Adds `chmod()`
  • Loading branch information
emersion committed Feb 4, 2015
1 parent 500ba1a commit ac7c758
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions installer.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ function tmpPath() {
* Copy a file, or recursively copy a folder and its contents
* @param string $source Source path
* @param string $dest Destination path
* @param string $permissions New folder creation permissions
* @param string $permissions New files permissions
* @return bool Returns true on success, false on failure
* @see https://stackoverflow.com/questions/2050859/copy-entire-contents-of-a-directory-to-another-using-php
*/
Expand All @@ -53,7 +53,12 @@ function xcopy($source, $dest, $permissions = 0755) {

// Simple copy for a file
if (is_file($source)) {
return copy($source, $dest);
$result = copy($source, $dest);
if ($result === false) {
return false;
}
chmod($dest, $permissions);
return true;
}

// Make destination directory
Expand All @@ -78,7 +83,7 @@ function xcopy($source, $dest, $permissions = 0755) {
return true;
}
function xrm($file) {
// Simple copy for a file
// Simple deletion for a file
if (is_file($file)) {
return unlink($file);
}
Expand All @@ -91,7 +96,7 @@ function xrm($file) {
continue;
}

// Deep copy directories
// Deep delete directories
xrm($file.DIRECTORY_SEPARATOR.$entry);
}

Expand Down

0 comments on commit ac7c758

Please sign in to comment.