Changeset 13797

Show
Ignore:
Timestamp:
03/12/12 07:18:36 (1 year ago)
Author:
mbrevda
Message:

[Auto Checking in outstanding changes in backup] revert (and improve) more of r13141 which broke restoring legacy backups

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • modules/branches/2.10/backup/functions.inc/restore.php

    r13600 r13797  
    315315function backup_migrate_legacy($bu) { 
    316316  global $amp_conf; 
    317  
     317  $legacy_name = ''; 
    318318  $name = pathinfo($bu, PATHINFO_BASENAME); 
    319319  if (substr($name, -7) != '.tar.gz' ) { 
     
    321321  } 
    322322   
    323   $legacy_name = substr($name, 0, -7); 
    324    
     323  //get legacy name based on the directory the legacy backup was origionally created in 
     324  //were expcecting to see something like: /tmp/ampbackups.20110310.16.00.00/ 
     325  //in the tarball 
     326  $cmd[] = fpbx_which('tar'); 
     327  $cmd[] = 'tf'; 
     328  $cmd[] = $bu; 
     329  exec(implode(' ', $cmd), $res); 
     330  unset($cmd); 
     331   
     332  foreach ($res as $r) { 
     333    if (preg_match('/\/tmp\/ampbackups\.([\d]{8}(\.[\d]{2}){3})\//', $r, $legacy_name)) { 
     334      if (isset($legacy_name[1])) { 
     335        $legacy_name = $legacy_name[0]; 
     336        break; 
     337      } 
     338    } 
     339  } 
     340  if (!$legacy_name) { 
     341    return false; 
     342  } 
     343   
     344  //create directory where tarball will be exctracted to 
    325345  $dir = $amp_conf['ASTSPOOLDIR'] . '/tmp/' . $legacy_name; 
    326346  mkdir($dir, 0755, true); 
     
    334354 
    335355  $dir2 = $dir . '/tmp/ampbackups.' . $legacy_name; 
    336  
     356   
     357  //exctract sub tarballs 
    337358  foreach (scandir($dir2) as $file) { 
    338359    if (substr($file, -7) == '.tar.gz') { 
  • modules/branches/2.10/backup/module.xml

    r13767 r13797  
    33  <repo>standard</repo> 
    44  <name>Backup &amp; Restore</name> 
    5   <version>2.10.0.20</version> 
     5  <version>2.10.0.21</version> 
    66  <publisher>Schmoozecom.com</publisher> 
    77  <license>GPLv2+</license> 
     
    1818  </depends> 
    1919  <changelog> 
     20    *2.10.0.21* revert (and improve) more of r13141 which broke restoring legacy backups  
    2021    *2.10.0.20* #5566 
    2122    *2.10.0.19* #5618, add ability to disable registered trunks on restore