Changeset 13141

Show
Ignore:
Timestamp:
12/29/11 18:30:56 (1 year ago)
Author:
p_lindheimer
Message:

fixes bugs enabling backup gui to see legacy backups, but so far restoring them doesn't end up restoring at least some of the files so that still needs to be addressed

Files:

Legend:

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

    r12513 r13141  
    306306    return $path; 
    307307  } else { 
    308     return array('error_msg' => _('File not found! ' . $path)); 
    309308  } 
    310309} 
     
    315314function backup_migrate_legacy($bu) { 
    316315  global $amp_conf; 
    317    
     316 
    318317  $name = pathinfo($bu, PATHINFO_BASENAME); 
    319318  if (!substr($name, -7) == '.tar.gz' ) { 
     
    321320  } 
    322321   
    323   $legacy_name = substr($name, strrpos($name, '-') + 1, -7); 
    324    
     322  $legacy_name = substr($name, 0, -7); 
    325323   
    326324  $dir = $amp_conf['ASTSPOOLDIR'] . '/tmp/' . $legacy_name; 
    327325  mkdir($dir, 0755, true); 
     326 
    328327  $cmd[] = fpbx_which('tar'); 
    329   $cmd[] = 'zxf'; 
     328  $cmd[] = '-zxf'; 
    330329  $cmd[] = $bu; 
    331330  $cmd[] = ' -C ' . $dir; 
    332331  exec(implode(' ', $cmd)); 
    333332  unset($cmd); 
    334    
     333 
    335334  $dir2 = $dir . '/tmp/ampbackups.' . $legacy_name; 
     335 
    336336  foreach (scandir($dir2) as $file) { 
    337337    if (substr($file, -7) == '.tar.gz') { 
    338338      $cmd[] = fpbx_which('tar'); 
    339       $cmd[] = 'zxf'; 
     339      $cmd[] = '-zxf'; 
    340340      $cmd[] = $dir2 . '/' . $file; 
    341341      $cmd[] = ' -C ' . $dir2; 
     
    347347     
    348348  } 
    349    
     349 
    350350  //add files to manifest 
    351351  $ret['file_list'] = scandirr($dir2); 
     
    360360    rename($dir2 . '/astdb.dump', $dir2 . '/astdb'); 
    361361     
    362     //removie it from the file_list 
     362    //remove it from the file_list 
    363363    unset($ret['file_list'][array_search('astdb.dump', $ret['file_list'])]); 
    364364 
     
    371371   
    372372  //serialize the astdb 
    373   if ($ret['astdb']) { 
     373  if (!empty($ret['astdb'])) { 
     374    $astdb = array(); 
    374375    foreach(file($dir2 . '/astdb') as $line) { 
    375376      $line = explode('] [', trim($line, '[]/')); 
     
    438439      . '.tgz'; 
    439440  $cmd[] = fpbx_which('tar'); 
    440   $cmd[] = 'zcf'; 
     441  $cmd[] = '-zcf'; 
    441442  $cmd[] = $dest; 
    442443  $cmd[] = '-C ' . $dir2; 
  • modules/branches/2.10/backup/page.backup_restore.php

    r13096 r13141  
    11<?php  
    22if (!defined('FREEPBX_IS_AUTH')) { die('No direct script access allowed'); } 
    3  
    43$get_vars = array( 
    54        'action'      => '', 
     
    123122         
    124123        //we didnt get a manifet. is this a legacy backup? 
    125         if($var['restore_path'] = backup_migrate_legacy($dest)) { 
     124        if($var['restore_path'] = backup_migrate_legacy($_SESSION['backup_restore_path'])) { 
    126125          if(!$var['manifest'] = backup_get_manifest_tarball($var['restore_path'])) { 
    127126            //nope, doesnt seem like legacy either. Guess we cant read this file 
    128             //TODO:alert the user 
    129              
     127            echo _('Invalid backup for or undefined error'); 
    130128          } else { 
    131129            $_SESSION['backup_restore_path'] = $var['restore_path']; 
     130            echo load_view(dirname(__FILE__) . '/views/restore/backup_list.php', $var); 
    132131          } 
    133132        } 
     
    135134      } 
    136135    } 
    137     //dbug($var['restore_path'], $var['manifest']); 
    138     echo load_view(dirname(__FILE__) . '/views/restore/backup_list.php', $var); 
     136    //dbug($_SESSION['backup_restore_path'], $var); 
    139137    break; 
    140138  default: