Changeset 6275

Show
Ignore:
Timestamp:
08/02/08 19:51:57 (1 month ago)
Author:
p_lindheimer
Message:

closes #2743, at least partially, so that we will not delete all the current entries if the restore dataset has an empty or blank astdb.dump file which otherise completely breaks the system

Files:

Legend:

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

    r5619 r6275  
    4242} 
    4343$dump = file_get_contents("/tmp/ampbackups.".$argv[1]."/astdb.dump"); 
    44 $arr = explode("\n", $dump); 
    4544 
    4645// Before restoring, let's clear out all of the current settings for the main objects 
     46// but as a safety, if the dump file is empy, we won't clear it out. 
    4747// 
    48 foreach ($deltree as $family) { 
    49         $astman->database_deltree($family); 
    50 
    51  
    52 foreach ($arr as $line) { 
    53         $result = preg_match("/\[(.+)\] \[(.+)\]/", $line, $matches); 
    54         // Now, the bad ones we know about are the ones that start with //, anything starting with SIP or IAX, 
    55         // and RG (which are only temporary anyway). 
    56         if (!isset($matches[1]) || $matches[1] == "") { continue; } 
    57         $pattern = "/(^\/\/)|(^\/IAX)|(^\/SIP)|(^\/RG)|(^\/BLKVM)|(^\/FM)|(^\/dundi)/"; 
    58         if (preg_match($pattern, $matches[1])) { continue; } 
    59         preg_match("/(.+)\/(.+)$/", $matches[1], $famkey); 
    60         $famkey[1]=trim($famkey[1], '/'); 
    61         $astman->database_put($famkey[1], $famkey[2], '"'.$matches[2].'"'); 
     48if (!empty($dump)) { 
     49        $arr = explode("\n", $dump); 
     50        foreach ($deltree as $family) { 
     51                $astman->database_deltree($family); 
     52        } 
     53        foreach ($arr as $line) { 
     54                $result = preg_match("/\[(.+)\] \[(.+)\]/", $line, $matches); 
     55                // Now, the bad ones we know about are the ones that start with //, anything starting with SIP or IAX, 
     56                // and RG (which are only temporary anyway). 
     57                if (!isset($matches[1]) || $matches[1] == "") { continue; } 
     58                $pattern = "/(^\/\/)|(^\/IAX)|(^\/SIP)|(^\/RG)|(^\/BLKVM)|(^\/FM)|(^\/dundi)/"; 
     59                if (preg_match($pattern, $matches[1])) { continue; } 
     60                preg_match("/(.+)\/(.+)$/", $matches[1], $famkey); 
     61                $famkey[1]=trim($famkey[1], '/'); 
     62                $astman->database_put($famkey[1], $famkey[2], '"'.$matches[2].'"'); 
     63        } 
    6264} 
    6365 
  • modules/branches/2.5/backup/module.xml

    r6201 r6275  
    22        <rawname>backup</rawname> 
    33        <name>Backup &amp; Restore</name> 
    4         <version>2.5.0.1</version> 
     4        <version>2.5.0.2</version> 
    55        <type>tool</type> 
    66        <category>System Administration</category> 
     
    1212        </depends> 
    1313        <changelog> 
     14                *2.5.0.2* #2743 don't delete the current astdb entries if the new astdb.dump is empty 
    1415                *2.5.0.1* #2884 include zaptel.conf in backup 
    1516                *2.5.0* #2889, #2845, #2353, added delete and add icons 
Donate



Support
Download
Develop
Forums
News
Documentation
Paid Support
About

Paid Ads