Changeset 5905

Show
Ignore:
Timestamp:
07/04/08 18:10:46 (5 years ago)
Author:
p_lindheimer
Message:

#2353 reverse sort backup sets

Files:

Legend:

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

    r3676 r5905  
    180180    if(!is_dir($dir)) mkdir($dir); 
    181181  } 
    182  
    183182  Get_Tar_Files($dir, $display, $file); 
    184   echo "<br><br><br><br><br><br><br><br><br><br><br><br>"; 
    185    
    186183} 
    187184else 
  • modules/branches/2.5/backup/schedule_functions.php

    r5830 r5905  
    1313//GNU General Public License for more details. 
    1414 
    15 function Get_Tar_Files($dir="", $display="", $file="") 
    16 
     15function Get_Tar_Files($dir="", $display="", $file="") { 
    1716  global $type; 
    1817  global $asterisk_conf; 
    1918  global $amp_conf; 
    20         if (is_dir($dir)) { 
    21           if (($file!=".") && ($file!="..") && ($file!="")){ 
    22                   echo "<li><a class=\"info\" href=\"javascript:decision('Are you sure you want to delete this File Set?','config.php?type=$type&display=$display&action=deletedataset&dir=$dir')\">"; 
    23       echo _("DELETE ALL THE DATA IN THIS SET"); echo "<span>"; echo _("Delete this backup set and all data associated with this backup set..");echo "</span></a><br></li>"; 
    24                   echo "<br>"; 
    25     } 
    26                 if ($dh = opendir($dir)){ 
    27                         while (($file = readdir($dh)) !== false) 
    28                         { 
    29                                 if (($file!=".") && ($file!="..") && ($dir==$amp_conf['ASTVARLIBDIR']."/backups/")) 
    30                                         echo "<li><a href=\"config.php?type=$type&display=$display&action=restore&dir=$dir/$file\">$file</a><br></li>"; 
    31                                 else if (($file!=".") && ($file!="..") ) 
    32                                         echo "<li><a href=\"config.php?type=$type&display=$display&action=restore&dir=$dir/$file&file=$file\">$file</a><br></li>"; 
    33                         } 
    34                         closedir($dh); 
    35                 } 
    36         } 
    37         else if (substr($dir, -6)=="tar.gz" ){ 
    38                 echo "<li><a class=\"info\" href=\"javascript:decision('Are you sure you want to delete this File Set?','config.php?type=$type&display=$display&action=deletefileset&dir=$dir&file=$file')\">"; 
    39     echo _("Delete File Set"); echo "<span>"; echo _("Delete this backup set."); echo "</span></a><br></li>"; 
    40                 echo "<br>"; 
    41                 $tar_string="tar tfz \"$dir\" | cut -d'/' -f4"; 
    42                 exec($tar_string,$restore_files,$error); 
    43                 echo "<li><a class=\"info\" href=\"javascript:decision('Are you sure you want to restore this COMPLETE file set?\n Doing so will permanently over-write all FreePBX and Asterisk files\n You will loose all Your Call Detail Records and any Voicemail that was recorded between the BACKUP DATE and NOW.','config.php?type=$type&display=$display&action=restored&dir=$dir&filetype=ALL&file=$file')\">"; 
    44     echo _("Restore Entire Backup Set"); echo "<span>"; echo _("Restore your Complete Backup set overwriting all files."); echo "</span></a><br></li>"; 
    45                 echo "<br>"; 
    46                 if (array_search('voicemail.tar.gz',$restore_files)){ 
    47                         echo "<li><a class=\"info\" href=\"javascript:decision('Are you sure you want to Restore this file set?\n Doing so will permanently delete any new voicemail you have in your mailbox\n since this backup on $file?','config.php?type=$type&display=$display&action=restored&dir=$dir&filetype=VoiceMail&file=$file')\">"; 
    48       echo _("Restore VoiceMail Files");echo "<span>"; echo _("Restore your Voicemail files from this backup set.  NOTE! This will delete any voicemail currently in the voicemail boxes."); 
     19    if (is_dir($dir)) { 
     20      if (($file!=".") && ($file!="..") && ($file!="")){ 
     21        echo "<li><a class=\"info\" href=\"javascript:decision('Are you sure you want to delete this File Set?','config.php?type=$type&display=$display&action=deletedataset&dir=$dir')\">"; 
     22        echo _("DELETE ALL THE DATA IN THIS SET"); echo "<span>"; echo _("Delete this backup set and all data associated with this backup set..");echo "</span></a><br></li>"; 
     23        echo "<br>"; 
     24      } 
     25      if ($dh = opendir($dir)){ 
     26        while (($file = readdir($dh)) !== false) { 
     27          $file_arr[] = $file; 
     28        } 
     29        rsort($file_arr); 
     30        $count = 25; 
     31        foreach ($file_arr as $file) { 
     32          if (($file!=".") && ($file!="..") && ($dir==$amp_conf['ASTVARLIBDIR']."/backups/")) { 
     33            echo "<li><a href=\"config.php?type=$type&display=$display&action=restore&dir=$dir/$file\">$file</a><br></li>"; 
     34            $count--; 
     35          } else if (($file!=".") && ($file!="..") ) { 
     36            echo "<li><a href=\"config.php?type=$type&display=$display&action=restore&dir=$dir/$file&file=$file\">$file</a><br></li>"; 
     37            $count--; 
     38          } 
     39        } 
     40        closedir($dh); 
     41        for ($i = $count; $i > 0; $i--) { 
     42          echo "<br />"; 
     43        } 
     44      } 
     45    } else if (substr($dir, -6)=="tar.gz" ){ 
     46      echo "<li><a class=\"info\" href=\"javascript:decision('Are you sure you want to delete this File Set?','config.php?type=$type&display=$display&action=deletefileset&dir=$dir&file=$file')\">"; 
     47      echo _("Delete File Set"); echo "<span>"; echo _("Delete this backup set."); echo "</span></a><br></li>"; 
     48      echo "<br>"; 
     49      $tar_string="tar tfz \"$dir\" | cut -d'/' -f4"; 
     50      exec($tar_string,$restore_files,$error); 
     51      echo "<li><a class=\"info\" href=\"javascript:decision('Are you sure you want to restore this COMPLETE file set?\n Doing so will permanently over-write all FreePBX and Asterisk files\n You will loose all Your Call Detail Records and any Voicemail that was recorded between the BACKUP DATE and NOW.','config.php?type=$type&display=$display&action=restored&dir=$dir&filetype=ALL&file=$file')\">"; 
     52      echo _("Restore Entire Backup Set");  
     53      echo "<span>";  
     54      echo _("Restore your Complete Backup set overwriting all files.");  
    4955      echo "</span></a><br></li>"; 
    50                         echo "<br>"; 
    51                 } 
    52  
    53                 if (array_search('recordings.tar.gz',$restore_files)){ 
    54                         echo "<li><a class=\"info\" href=\"config.php?type=$type&display=$display&action=restored&dir=$dir&filetype=Recordings&file=$file\">"; 
    55       echo _("Restore System Recordings Files"); echo "<span>"; echo _("Restore your system Voice Recordings including AutoAttendent files from this backup set.  NOTE! This will OVERWRITE any voicerecordings  currently on the system. It will NOT delete new files not currently in the backup set"); echo "</span></a><br></li>"; 
    56                         echo "<br>"; 
    57                 } 
    58                 if (array_search('configurations.tar.gz',$restore_files)){ 
    59                         echo "<li><a class=\"info\" href=\"javascript:decision('Are you sure you want to Restore this File Set\n Doing so will Permanently Over-Write all AMP and Asterisk Files?','config.php?type=$type&display=$display&action=restored&dir=$dir&filetype=Configurations&file=$file')\">"; 
    60       echo _("Restore System Configuration"); echo "<span>"; echo _("Restore your system configuration from this backup set.  NOTE! This will OVERWRITE any System changes you have made since this backup... ALL Itemes will be reset to what they were at the time of this backup set.."); echo "</span></a><br></li>"; 
    61                         echo "<br>"; 
    62                 } 
    63                 if (array_search('fop.tar.gz',$restore_files)){ 
    64                         echo "<li><a class=\"info\" href=\"javascript:decision('Are you sure you want to Restore the Operator Panel Files\n Doing so will Permanently Over-Write all Operator Panel Files?','config.php?type=$type&display=$display&action=restored&dir=$dir&filetype=FOP&file=$file')\">"; 
    65       echo _("Restore Operator Panel"); echo "<span>"; echo _("Restore the Operator Panel from this backup set.  NOTE! This will OVERWRITE any Operator Panel Changes you have made since this backup... ALL Itemes will be reset to what they were at the time of this backup set.."); echo "</span></a><br></li>"; 
    66                         echo "<br>"; 
    67                 } 
    68                 if (array_search('cdr.tar.gz',$restore_files)){ 
    69                         echo "<li><a class=\"info\" href=\"javascript:decision('Are you sure you want to Restore the CALL DETAIL FILES\n Doing so will Permanently DELETE  all CALL RECORDS.?','config.php?type=$type&display=$display&action=restored&dir=$dir&filetype=CDR&file=$file')\">"; 
    70       echo _("Restore Call Detail Report"); echo "<span>"; echo _("Restore the Call Detail Records from this backup set.  NOTE! This will DELETE ALL CALL RECORDS that have been saved since this backup set.."); echo "</span></a><br></li>"; 
    71                         echo "<br>"; 
    72                 } 
    73         } 
    74         else{ 
    75                 echo "<h2>"; echo _("ERROR its not a BACKUP SET file");echo "</h2>"; 
    76   } 
    77 
     56      echo "<br>"; 
     57      if (array_search('voicemail.tar.gz',$restore_files)){ 
     58        echo "<li><a class=\"info\" href=\"javascript:decision('Are you sure you want to Restore this file set?\n Doing so will permanently delete any new voicemail you have in your mailbox\n since this backup on $file?','config.php?type=$type&display=$display&action=restored&dir=$dir&filetype=VoiceMail&file=$file')\">"; 
     59        echo _("Restore VoiceMail Files"); 
     60        echo "<span>";  
     61        echo _("Restore your Voicemail files from this backup set.  NOTE! This will delete any voicemail currently in the voicemail boxes."); 
     62        echo "</span></a><br></li>"; 
     63        echo "<br>"; 
     64      } 
     65 
     66      if (array_search('recordings.tar.gz',$restore_files)){ 
     67        echo "<li><a class=\"info\" href=\"config.php?type=$type&display=$display&action=restored&dir=$dir&filetype=Recordings&file=$file\">"; 
     68        echo _("Restore System Recordings Files");  
     69        echo "<span>";  
     70        echo _("Restore your system Voice Recordings including AutoAttendent files from this backup set.  NOTE! This will OVERWRITE any voicerecordings  currently on the system. It will NOT delete new files not currently in the backup set"); echo "</span></a><br></li>"; 
     71        echo "<br>"; 
     72      } 
     73      if (array_search('configurations.tar.gz',$restore_files)){ 
     74        echo "<li><a class=\"info\" href=\"javascript:decision('Are you sure you want to Restore this File Set\n Doing so will Permanently Over-Write all AMP and Asterisk Files?','config.php?type=$type&display=$display&action=restored&dir=$dir&filetype=Configurations&file=$file')\">"; 
     75        echo _("Restore System Configuration"); echo "<span>"; echo _("Restore your system configuration from this backup set.  NOTE! This will OVERWRITE any System changes you have made since this backup... ALL Itemes will be reset to what they were at the time of this backup set.."); echo "</span></a><br></li>"; 
     76        echo "<br>"; 
     77      } 
     78      if (array_search('fop.tar.gz',$restore_files)){ 
     79        echo "<li><a class=\"info\" href=\"javascript:decision('Are you sure you want to Restore the Operator Panel Files\n Doing so will Permanently Over-Write all Operator Panel Files?','config.php?type=$type&display=$display&action=restored&dir=$dir&filetype=FOP&file=$file')\">"; 
     80        echo _("Restore Operator Panel");  
     81        echo "<span>";  
     82        echo _("Restore the Operator Panel from this backup set.  NOTE! This will OVERWRITE any Operator Panel Changes you have made since this backup... ALL Itemes will be reset to what they were at the time of this backup set..");  
     83        echo "</span></a><br></li>"; 
     84        echo "<br>"; 
     85      } 
     86      if (array_search('cdr.tar.gz',$restore_files)){ 
     87        echo "<li><a class=\"info\" href=\"javascript:decision('Are you sure you want to Restore the CALL DETAIL FILES\n Doing so will Permanently DELETE  all CALL RECORDS.?','config.php?type=$type&display=$display&action=restored&dir=$dir&filetype=CDR&file=$file')\">"; 
     88        echo _("Restore Call Detail Report");  
     89        echo "<span>";  
     90        echo _("Restore the Call Detail Records from this backup set.  NOTE! This will DELETE ALL CALL RECORDS that have been saved since this backup set..");  
     91        echo "</span></a><br></li>"; 
     92        echo "<br>"; 
     93      } 
     94    } else { 
     95      echo "<h2>"; echo _("ERROR its not a BACKUP SET file");echo "</h2>"; 
     96    } 
     97  } 
     98 
    7899function Restore_Tar_Files($dir="", $file="",$filetype="", $display="") { 
    79100  global $asterisk_conf;