Changeset 2083

Show
Ignore:
Timestamp:
01/22/08 03:30:23 (10 months ago)
Author:
anarcat
Message:

remove recursive mkdir code
place the escapeshellarg() calls properly
print the cp error on failure
assume the target parent directory

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • alternc/trunk/bureau/class/m_bro.php

    r2082 r2083  
    523523    $src = $this->convertabsolute($src); 
    524524    $dest = $this->convertabsolute($dest); 
     525    if (!$src || !$dest) { 
     526      $err->raise("bro",1); 
     527      return false; 
     528    } 
    525529    $src = escapeshellarg($src); 
    526530    $dest = escapeshellarg($dest); 
    527     if (!$src || !$dest) { 
    528       $err->raise("bro",1); 
    529       return false; 
    530     } 
    531     /* XXX: UNIX-specific because of that slash */ 
    532     $array = explode('/', $dest); 
    533     $dir = ""; 
    534     foreach ($array as $v) { 
    535       $dir .= "$v/"; 
    536       @mkdir($dest); 
    537     } 
    538     #TODO write a recursive copy function(?) 
    539     exec("cp -Rpf '$src'/* '$dest'", $void, $ret); 
     531    // TODO: write a recursive copy function(?) 
     532    exec("cp -Rpf '$src' '$dest'", $void, $ret); 
    540533    if ($ret) { 
    541       $err->raise("bro","Errors happened while copying the source to destination."); 
     534      $err->raise("bro","Errors happened while copying the source to destination. cp return value: %d", $ret); 
    542535      return false; 
    543536    }