Changeset 338704
- Timestamp:
- 01/30/2011 02:01:49 AM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
wp-db-backup/tags/2.2.4/wp-db-backup.php
r338565 r338704 183 183 default: 184 184 $this->deliver_backup($this->backup_file, $via); 185 $this->error_display( 'frame');186 } 187 die();185 ); 186 } 187 ; 188 188 } 189 189 if (isset($_GET['fragment'] )) { … … 245 245 <script type="text/javascript"> 246 246 //<![CDATA[ 247 248 249 250 251 252 253 254 255 247 256 window.onbeforeunload = function() { 248 257 return "' . __('Navigating away from this page will cause your backup to fail.', 'wp-db-backup') . '"; … … 286 295 window.onbeforeunload = null; 287 296 fram.src = "' . $download_uri . '"; 297 298 299 288 300 '; 289 301 break; … … 1017 1029 1018 1030 $diskfile = $this->backup_dir . $filename; 1031 1032 1019 1033 /** 1020 * Try to compress to gzip, if available1034 * Try 1021 1035 */ 1022 if ( function_exists('gzencode') ) { 1023 $gz_diskfile = "{$diskfile}.gz"; 1024 if ( function_exists('file_get_contents') ) { 1025 $text = file_get_contents($diskfile); 1026 } else { 1027 $text = implode("", file($diskfile)); 1028 } 1029 $gz_text = gzencode($text, 9); 1030 $fp = fopen($gz_diskfile, "w"); 1031 fwrite($fp, $gz_text); 1032 if ( fclose($fp) ) { 1036 if ( function_exists('memory_get_usage') && ( (int) @ini_get('memory_limit') < 64 ) ) { 1037 @ini_set('memory_limit', '64M' ); 1038 } 1039 1040 if ( file_exists( $diskfile ) && empty( $_GET['download-retry'] ) ) { 1041 /** 1042 * Try gzipping with an external application 1043 */ 1044 if ( file_exists( $diskfile ) && ! file_exists( $gz_diskfile ) ) { 1045 @exec( "gzip $diskfile" ); 1046 } 1047 1048 if ( file_exists( $gz_diskfile ) ) { 1033 1049 unlink($diskfile); 1034 1050 $diskfile = $gz_diskfile; 1035 1051 $filename = "{$filename}.gz"; 1036 } 1037 } 1038 /* 1039 * 1040 */ 1052 1053 /** 1054 * Try to compress to gzip, if available 1055 */ 1056 } else { 1057 if ( function_exists('gzencode') ) { 1058 if ( function_exists('file_get_contents') ) { 1059 $text = file_get_contents($diskfile); 1060 } else { 1061 $text = implode("", file($diskfile)); 1062 } 1063 $gz_text = gzencode($text, 9); 1064 $fp = fopen($gz_diskfile, "w"); 1065 fwrite($fp, $gz_text); 1066 if ( fclose($fp) ) { 1067 unlink($diskfile); 1068 $diskfile = $gz_diskfile; 1069 $filename = "{$filename}.gz"; 1070 } 1071 } 1072 } 1073 /* 1074 * 1075 */ 1076 } 1041 1077 1042 1078 if ('http' == $delivery) { 1043 if ( ! file_exists($diskfile))1079 if ( 1044 1080 $this->error(array('kind' => 'fatal', 'msg' => sprintf(__('File not found:%s','wp-db-backup'), " <strong>$filename</strong><br />") . '<br /><a href="' . $this->page_url . '">' . __('Return to Backup','wp-db-backup') . '</a>')); 1045 header('Content-Description: File Transfer'); 1046 header('Content-Type: application/octet-stream'); 1047 header('Content-Length: ' . filesize($diskfile)); 1048 header("Content-Disposition: attachment; filename=$filename"); 1049 $success = readfile($diskfile); 1050 unlink($diskfile); 1081 } elseif ( file_exists( $diskfile ) ) { 1082 header('Content-Description: File Transfer'); 1083 header('Content-Type: application/octet-stream'); 1084 header('Content-Length: ' . filesize($diskfile)); 1085 header("Content-Disposition: attachment; filename=$filename"); 1086 $success = readfile($diskfile); 1087 unlink($diskfile); 1088 } 1051 1089 } elseif ('smtp' == $delivery) { 1052 1090 if (! file_exists($diskfile)) {
Note: See TracChangeset
for help on using the changeset viewer.