Commit 57cf564a authored by Antoine Beaupré's avatar Antoine Beaupré

remove recursive mkdir code

place the escapeshellarg() calls properly
print the cp error on failure
assume the target parent directory
parent ed74b4de
...@@ -522,23 +522,16 @@ class m_bro { ...@@ -522,23 +522,16 @@ class m_bro {
// Last step // Copy -R // Last step // Copy -R
$src = $this->convertabsolute($src); $src = $this->convertabsolute($src);
$dest = $this->convertabsolute($dest); $dest = $this->convertabsolute($dest);
$src = escapeshellarg($src);
$dest = escapeshellarg($dest);
if (!$src || !$dest) { if (!$src || !$dest) {
$err->raise("bro",1); $err->raise("bro",1);
return false; return false;
} }
/* XXX: UNIX-specific because of that slash */ $src = escapeshellarg($src);
$array = explode('/', $dest); $dest = escapeshellarg($dest);
$dir = ""; // TODO: write a recursive copy function(?)
foreach ($array as $v) { exec("cp -Rpf '$src' '$dest'", $void, $ret);
$dir .= "$v/";
@mkdir($dest);
}
#TODO write a recursive copy function(?)
exec("cp -Rpf '$src'/* '$dest'", $void, $ret);
if ($ret) { if ($ret) {
$err->raise("bro","Errors happened while copying the source to destination."); $err->raise("bro","Errors happened while copying the source to destination. cp return value: %d", $ret);
return false; return false;
} }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment