Changeset 14265

Show
Ignore:
Timestamp:
07/19/12 11:16:53 (10 months ago)
Author:
mbrevda
Message:

use ssh port; better handeling of files > 2GB

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • modules/branches/2.10/backup/bin/backup.php

    r14231 r14265  
    7272      $cmd[] = '-o StrictHostKeyChecking=no -i'; 
    7373      $cmd[] = backup__($s[$b->b['bu_server']]['key']); 
     74      $cmd[] = '-p'; 
     75      $cmd[] = $s[$b->b['bu_server']]['port']; 
    7476      $cmd[] = backup__($s[$b->b['bu_server']]['user'])  
    7577          . '\@'  
  • modules/branches/2.10/backup/functions.inc/class.backup.php

    r14248 r14265  
    178178          $cmd[] = fpbx_which('tar') . ' cf - ' . $i['path']; 
    179179          if ($i['exclude']) { 
    180             $excludes = explode("\n", $i['exclude']); 
     180            $excludes = is_array($i['exclude']) 
     181                  ? $i['exclude'] 
     182                  : explode("\n", $i['exclude']); 
    181183            foreach ($excludes as $x) { 
    182184              $cmd[] = " --exclude='$x'"; 
     
    284286          } 
    285287           
    286           copy($this->b['_tmpfile'], $path . '/' . $this->b['_file'] . '.tgz'); 
    287            
     288          //would rather use the native copy() here, but by defualt 
     289          //php doesnt support files > 2GB 
     290          //see here for a posible solution: 
     291          //http://ca3.php.net/manual/en/function.fopen.php#37791 
     292          $cmd[] = fpbx_which('cp'); 
     293          $cmd[] = $this->b['_tmpfile']; 
     294          $cmd[] = $path . '/' . $this->b['_file'] . '.tgz'; 
     295           
     296          exec(implode(' ', $cmd), $error, $status); 
     297          unset($cmd, $error); 
     298          if ($status !== 0) { 
     299            backup_log('Error copying ' . $this->b['_tmpfile']  
     300                . ' to ' . $path . '/' . $this->b['_file']  
     301                . '.tgz: ' . $error); 
     302          }  
    288303          //run maintenance on the directory 
    289304          $this->maintenance($s['type'], $s); 
  • modules/branches/2.10/backup/functions.inc/restore.php

    r14044 r14265  
    303303  } 
    304304 
    305   if (is_file($path)) { 
     305  if (file_exists($path)) { 
    306306    return $path; 
    307307  } else { 
  • modules/branches/2.10/backup/page.backup_restore.php

    r13600 r14265  
    114114    array_walk_recursive($var['templates'], 'callback'); 
    115115     
    116     if (is_array($var['restore_path'])) { 
     116    if (is_array($_SESSION['backup_restore_path'])) { 
    117117      //TODO: if $var['restore_path'] is an array, that means it contains an error + error 
    118118      // message. Do something with the error meesage 
     119      echo _('Invalid backup for or undefined error'); 
    119120      break; 
    120121    }