Changeset 9490
- Timestamp:
- 04/12/10 16:02:32 (3 years ago)
- Files:
-
- modules/branches/2.8/backup/bin/ampbackup.php (modified) (3 diffs)
- modules/branches/2.8/backup/functions.inc.php (modified) (4 diffs)
- modules/branches/2.8/backup/install.php (modified) (4 diffs)
- modules/branches/2.8/backup/module.xml (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
modules/branches/2.8/backup/bin/ampbackup.php
r9476 r9490 92 92 $exec.=' --'.$key.'='; 93 93 break; 94 case 'overwritebackup': 95 $exec.=' --'.$key.'=yes'; 96 break; 94 97 default: 95 98 $exec.=' --'.$key.'='.$val; … … 109 112 if(is_file($opts['budir'].'/'.$opts['name'].'/'.$opts['now'].'.tar.gz')){ 110 113 $exec='/usr/bin/ssh -o StrictHostKeyChecking=no -i '.$opts['remotesshkey'].' '.$user.$opts['remotesshhost']; 111 $exec.=' \'dir='.$rbudir[0].'/backups/'.$opts['name'].'; rm -f $dir/'.$opts['now'].'.tar.gz; if [ ! "$(ls -A $dir)" ]; then rmdir $dir; fi '\'';114 $exec.=' \'dir='.$rbudir[0].'/backups/'.$opts['name'].'; rm -f $dir/'.$opts['now'].'.tar.gz; if [ ! "$(ls -A $dir)" ]; then rmdir $dir; fi\''; 112 115 exec($exec,$ret); 113 116 } … … 146 149 exec($exec,$ret); 147 150 } 148 system('mysqldump --add-drop-table -h'.$amp_conf['AMPDBHOST'].' -u'.$amp_conf['AMPDBUSER'].' -p'.$amp_conf['AMPDBPASS'].' --database '.$amp_conf['AMPDBNAME'].' > /tmp/ampbackups.'.$opts['now'].'/asterisk.sql'); 151 $ignorbackup=(($opts['overwritebackup']=='yes')?' --ignore-table='.$amp_conf['AMPDBNAME'].'.backup ':' '); 152 system('mysqldump --add-drop-table -h'.$amp_conf['AMPDBHOST'].' -u'.$amp_conf['AMPDBUSER'].' -p'.$amp_conf['AMPDBPASS'].' --database '.$amp_conf['AMPDBNAME'].$ignorbackup.' > /tmp/ampbackups.'.$opts['now'].'/asterisk.sql'); 149 153 } 150 154 //backup cdr if requested modules/branches/2.8/backup/functions.inc.php
r9391 r9490 419 419 $advanced=($amp_conf['AMPBACKUPADVANCED']||$opts['sudo']); 420 420 ?> 421 <style type="text/css"> 422 tr .tog{cursor:pointer;} 423 tr .tog span{color:black} 424 <?php 425 $sections=array('files','ftp','ssh','email','remote','advanced'); 426 foreach($sections as $sec){ 427 if(!$$sec){echo '.hide.'.$sec.'{display:none}'."\n";} 428 } 429 if(!$advanced){echo '.advanced{display:none}'."\n";} 430 ?> 431 h5{margin-top:10px;margin-bottom:10px} 432 </style> 433 <script language="javascript" type="text/javascript"> 434 $(document).ready(function() { 435 $('.tog').click(function(){ 436 var tclass = $(this).attr('class'); tclass = tclass.replace('tog ', ''); 437 var togspan = $(this).find('span'); 438 if(togspan.text()=='+'){ 439 togspan.text('- '); 440 $('.'+tclass).show(); 441 }else{ 442 togspan.text('+'); 443 $('.'+tclass).not('.tog').hide(); 444 } 445 }); 446 $('.sysconfigdep').click(function(){ 447 if($(this).is(':checked')){ 448 $('.sysconfig').attr('checked', true); 449 } 450 }) 451 $('.sysconfig').click(function(){ 452 if(!$(this).is(':checked')){ 453 $('.sysconfigdep').attr('checked', false); 454 } 455 }) 456 }); 457 </script> 421 458 <table> 422 459 <tr><td colspan="2"><h5><?php echo _("Basic Settings")?><hr></h5></td></tr> … … 426 463 </tr> 427 464 <tr> 428 <td><a href="#" class="info"><?php echo _("VoiceMail");?><span><?php echo _("Backup the System VoiceMail Boxes... CAUTION: Could result in large file");?></span></a>: </td> 429 <td><input type="checkbox" name="voicemail" tabindex="<?php echo ++$tabindex;?>" value="yes" <?php echo ($opts['voicemail']=='yes')?'checked':''; ?> /></td> 430 </tr> 431 <tr> 432 <td><a href="#" class="info"><?php echo _("System Recordings");?><span><?php echo _("Backup the System Recordings (AutoAttendant, Music On Hold, System Recordings)");?></span></a>: </td> 433 <td><input type="checkbox" name="recordings" value="yes" <?php echo ($opts['recordings']=='yes')?'checked':''; ?> /></td> 434 </tr> 435 <tr> 436 <td><a href="#" class="info"><?php echo _("System Configuration");?><span><?php echo _("Backup the System Configurations (Database, etc files, SQL Database, astdb)");?></span></a>: </td> 437 <td><input type="checkbox" name="configurations" value="yes" <?php echo ($opts['configurations']=='yes')?'checked':''; ?>/></td> 465 <td><a href="#" class="info"><?php echo _("Admin Web Directory");?><span><?php echo _("Backup the admin web directory (i.e. the static FreePBX web files). This is useful to have during a restore to prevent a version mismatch, but can dramatically increase the backup size.");?></span></a>: </td> 466 <td><input type="checkbox" name="admin" value="yes" class="sysconfigdep" <?php echo ($opts['admin']=='yes')?'checked':''; ?>/></td> 438 467 </tr> 439 468 <tr> 440 <td><a href="#" class="info"><?php echo _("Admin Web Directory");?><span><?php echo _("Backup the admin web directory (i.e. the static FreePBX web files). This is useful to have during a restore to prevent a version mismatch, but can dramatically increase the backup size.");?></span></a>: </td>441 <td><input type="checkbox" name="admin" value="yes" <?php echo ($opts['admin']=='yes')?'checked':''; ?>/></td>442 </tr>443 <tr>444 469 <td><a href="#" class="info"><?php echo _("CDR");?><span><?php echo _("Backup the System Call Detail Reporting (HTML and Database)");?></span></a>: </td> 445 470 <td><input type="checkbox" name="cdr" value="yes" <?php echo ($opts['cdr']=='yes')?'checked':''; ?>/></td> … … 449 474 <td><input type="checkbox" name="fop" value="yes" <?php echo ($opts['fop']=='yes')?'checked':''; ?>/></td> 450 475 </tr> 476 <tr> 477 <td><a href="#" class="info"><?php echo _("Ovewrite Backup Settings");?><span><?php echo _("When restoring the backup, if this option is selected, all saved backups and their scheduals will be overwriten. Leaving this unchecked will restore all other configurations EXCEPT for thoes related to backup. WHen doing a remote backup and restore, this option is always forced.");?></span></a>: </td> 478 <td><input type="checkbox" name="overwritebackup" value="yes" class="sysconfigdep" <?php echo ($opts['overwritebackup']=='yes')?'checked':''; ?>/></td> 479 </tr> 480 <tr> 481 <td><a href="#" class="info"><?php echo _("System Recordings");?><span><?php echo _("Backup the System Recordings (AutoAttendant, Music On Hold, System Recordings)");?></span></a>: </td> 482 <td><input type="checkbox" name="recordings" value="yes" <?php echo ($opts['recordings']=='yes')?'checked':''; ?> /></td> 483 </tr> 484 <tr> 485 <td><a href="#" class="info"><?php echo _("VoiceMail");?><span><?php echo _("Backup the System VoiceMail Boxes... CAUTION: Could result in large file");?></span></a>: </td> 486 <td><input type="checkbox" name="voicemail" tabindex="<?php echo ++$tabindex;?>" value="yes" <?php echo ($opts['voicemail']=='yes')?'checked':''; ?> /></td> 487 </tr> 488 <tr> 489 <td><a href="#" class="info"><?php echo _("System Configuration");?><span><?php echo _("Backup the System Configurations (Database, etc files, SQL Database, astdb)");?></span></a>: </td> 490 <td><input type="checkbox" name="configurations" value="yes" class="sysconfig" <?php echo ($opts['configurations']=='yes')?'checked':''; ?>/></td> 491 </tr> 451 492 452 493 <tr><td colspan="2" class="tog files"><h5><span><?php echo $files?'-':'+';?></span><?php echo _(' Additional Files')?><hr></h5></td></tr> … … 539 580 <td><input type="checkbox" name="sudo" tabindex="<?php echo ++$tabindex;?>" value="yes" <?php echo ($opts['sudo']=='yes')?'checked':''; ?> /></td> 540 581 </tr> 541 <style type="text/css">542 tr .tog{cursor:pointer;}543 tr .tog span{color:black}544 <?php545 $sections=array('files','ftp','ssh','email','remote','advanced');546 foreach($sections as $sec){547 if(!$$sec){echo '.hide.'.$sec.'{display:none}'."\n";}548 }549 if(!$advanced){echo '.advanced{display:none}'."\n";}550 ?>551 h5{margin-top:10px;margin-bottom:10px}552 </style>553 <script language="javascript" type="text/javascript">554 $(document).ready(function() {555 $('.tog').click(function(){556 var tclass = $(this).attr('class'); tclass = tclass.replace('tog ', '');557 var togspan = $(this).find('span');558 if(togspan.text()=='+'){559 togspan.text('- ');560 $('.'+tclass).show();561 }else{562 togspan.text('+');563 $('.'+tclass).not('.tog').hide();564 }565 });566 });567 </script>568 582 <?php 569 583 } modules/branches/2.8/backup/install.php
r9426 r9490 68 68 emailmaxtype varchar(5), 69 69 admin varchar(10), 70 overwritebackup varchar(5) default NULL, 70 71 include blob, 71 72 exclude blob, 72 73 sudo varchar(25), 73 emotesshhost varchar(50) default NULL,74 remotesshhost varchar(50) default NULL, 74 75 remotesshuser varchar(50) default NULL, 75 76 remotesshkey varchar(150) default NULL, … … 106 107 emailmaxtype varchar(5), 107 108 admin varchar(10), 109 overwritebackup varchar(5) default NULL, 108 110 include blob, 109 111 exclude blob, … … 236 238 } 237 239 238 //check for 2.6-style tables240 //check remote backup fields 239 241 $sql='describe backup'; 240 242 $fields=$db->getAssoc($sql); … … 249 251 out(_('WARNING: backup table not migrated')); 250 252 } else { 251 out(_('Successfully migrated fax_incomingtable!'));253 out(_('Successfully migrated backup table!')); 252 254 } 253 255 } 254 256 255 257 //check for overwritebackup filed 258 $sql='describe backup'; 259 $fields=$db->getAssoc($sql); 260 if(!array_key_exists('overwritebackup',$fields)){ 261 out(_('Migrating backup table...')); 262 $sql='alter table backup add overwritebackup varchar(5) default NULL'; 263 $q=$db->query($sql); 264 if(DB::IsError($q)){ 265 out(_('WARNING: backup table not migrated')); 266 } else { 267 out(_('Successfully migrated backup table!')); 268 } 269 } 256 270 ?> modules/branches/2.8/backup/module.xml
r9473 r9490 2 2 <rawname>backup</rawname> 3 3 <name>Backup & Restore</name> 4 <version>2.8.0. 2</version>4 <version>2.8.0.3</version> 5 5 <publisher>FreePBX</publisher> 6 6 <license>GPLv2+</license> … … 15 15 </depends> 16 16 <changelog> 17 *2.8.0.3* #4167 17 18 *2.8.0.2* #4167 18 19 *2.8.0.1* #4167
