Changeset 201698
- Timestamp:
- 02/04/2010 06:02:24 AM (16 years ago)
- Location:
- automatic-wordpress-backup/trunk
- Files:
-
- 3 edited
-
S3.php (modified) (1 diff)
-
automatic-wordpress-backup.php (modified) (10 diffs)
-
readme.txt (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
automatic-wordpress-backup/trunk/S3.php
r185398 r201698 894 894 curl_setopt($curl, CURLOPT_WRITEFUNCTION, array(&$this, '__responseWriteCallback')); 895 895 curl_setopt($curl, CURLOPT_HEADERFUNCTION, array(&$this, '__responseHeaderCallback')); 896 curl_setopt($curl, CURLOPT_FOLLOWLOCATION, true);896 //curl_setopt($curl, CURLOPT_FOLLOWLOCATION, true); 897 897 898 898 // Request types -
automatic-wordpress-backup/trunk/automatic-wordpress-backup.php
r192499 r201698 2 2 /* 3 3 Plugin Name: Automatic WordPress Backup 4 Plugin URI: http://www.w ordpressbackup.org/4 Plugin URI: http://www.webdesigncompany.net/automatic-wordpress-backup/ 5 5 Description: Automatically upload backups of important parts of your blog to Amazon S3 6 Version: 1.1.0-dev 66 Version: 1.1.0-dev7 7 7 Author: Dan Coulter 8 8 Author URI: http://dancoulter.com/ … … 40 40 41 41 class cmAWB { 42 static $version = '1.1.0-dev 6';42 static $version = '1.1.0-dev7'; 43 43 44 44 /** … … 182 182 183 183 } 184 185 $fsd = new WP_Filesystem_Direct(1); 186 //print_r($fsd->dirlist($fsd->wp_content_dir(), true, true)); 187 188 189 184 190 185 ?> 191 186 <script type="text/javascript"> … … 238 233 239 234 <?php endif; ?> 240 <?php //self::backup(true) ?> 235 241 236 <form method="post" action="options.php"> 242 237 <input type="hidden" name="action" value="update" /> … … 386 381 ?> 387 382 <p><?php _e('<b>Warning!</b> Doing this will overwrite files and your database (depending on what was backed up). A manual backup will be run prior to the restore.') ?></p> 383 <p> 384 <div style="float: left; padding-top: 2px;"> 385 <input type="checkbox" checked="checked" id="use_existing_db" name="use_existing_db" value="1" /> 386 </div> 387 <div style="margin-left: 1.5em;"><label for="use_existing_db"> 388 <?php _e('Keep your current database settings by overwriting the settings (except the database prefix) in the backed up config file (if applicable).') ?> 389 </label></div> 390 </p> 388 391 <p class="submit"><button id="restore-trigger" class="button"><?php _e('Restore from backup') ?></button></p> 389 392 </div> … … 405 408 var data = { 406 409 action: 'awb_restore', 407 backup: $('input[name=restore-backup]:checked').val() 410 backup: $('input[name=restore-backup]:checked').val(), 411 use_existing_db: $("#use_existing_db:checked").length 408 412 }; 409 413 if ( $("#ftp-hostname").length ) { … … 425 429 } 426 430 427 console.log(rsp); 428 //window.location.reload(); 431 window.location.reload(); 429 432 }, 430 433 'json' … … 518 521 if ( in_array('database', $sections) ) { 519 522 $tables = $wpdb->get_col("SHOW TABLES LIKE '" . $wpdb->prefix . "%'"); 520 //$result = shell_exec('mysqldump --add-drop-table --single-transaction -h ' . DB_HOST . ' -u ' . DB_USER . ' --password="' . DB_PASSWORD . '" ' . DB_NAME . ' ' . implode(' ', $tables) . ' > ' . WP_CONTENT_DIR . '/uploads/awb/awb-database-backup.sql');521 523 $sql = ''; 522 524 foreach ( $tables as $table ) { 523 525 $sql .= self::backup_table($table); 524 526 } 525 //print_r($sql); 527 526 528 file_put_contents('awb-database-backup.sql', $sql); 527 529 $result = shell_exec('zip -u ' . $file . ' awb-database-backup.sql'); … … 704 706 $wp_filesystem->delete($rdir . '/backup.zip'); 705 707 708 if ( isset($_POST['use_existing_db']) && $_POST['use_existing_db'] ) { 709 $config_contents = $wp_filesystem->get_contents(trailingslashit($rdir) . 'wp-config.php'); 710 $config_contents = preg_replace( 711 "|define\(.DB_NAME., .*\);|", 712 "define('DB_NAME', '" . DB_NAME . "');", 713 $config_contents 714 ); 715 $config_contents = preg_replace( 716 "|define\(.DB_USER., .*\);|", 717 "define('DB_USER', '" . DB_USER . "');", 718 $config_contents 719 ); 720 $config_contents = preg_replace( 721 "|define\(.DB_PASSWORD., .*\);|", 722 "define('DB_PASSWORD', '" . DB_PASSWORD . "');", 723 $config_contents 724 ); 725 $config_contents = preg_replace( 726 "|define\(.DB_HOST., .*\);|", 727 "define('DB_HOST', '" . DB_HOST . "');", 728 $config_contents 729 ); 730 $wp_filesystem->put_contents(trailingslashit($rdir) . 'wp-config.php', $config_contents); 731 } 732 $wp_filesystem->delete($rdir . '/manifest.txt'); 733 echo $restore_dir; 734 706 735 $files = self::rscandir($restore_dir); 707 736 foreach ( $files as $file ) { … … 710 739 $wp_filesystem->mkdir($wp_filesystem->abspath() . dirname($file)); 711 740 } 712 @$wp_filesystem->move($rdir . $file, $wp_filesystem->abspath() . $file );741 @$wp_filesystem->move($rdir . $file, $wp_filesystem->abspath() . $file, true); 713 742 } 714 743 -
automatic-wordpress-backup/trunk/readme.txt
r186383 r201698 19 19 able to create the zips for backup. 20 20 21 For full info and installation instructions, visit http://www.w ordpressbackup.org21 For full info and installation instructions, visit http://www.webdesigncompany.net/automatic-wordpress-backup/ 22 22 23 23 == Installation ==
Note: See TracChangeset
for help on using the changeset viewer.