@@ -279,7 +279,7 @@ discard block |
||
279 | 279 | $this->log(sprintf(__("Excluding table %s.%s from backup"), $table, $database)); |
280 | 280 | } |
281 | 281 | $inc++; |
282 | - } |
|
282 | + } |
|
283 | 283 | |
284 | 284 | return $tablesList; |
285 | 285 | |
@@ -503,7 +503,7 @@ discard block |
||
503 | 503 | $buffer = ""; |
504 | 504 | $this->countRecords++; |
505 | 505 | |
506 | - foreach ($arr as $key => $value) { |
|
506 | + foreach ($arr as $key => $value) { |
|
507 | 507 | $value = $this->_real_escape($value); |
508 | 508 | $buffer .= "'".$value."', "; |
509 | 509 | } |
@@ -529,8 +529,8 @@ discard block |
||
529 | 529 | $line = ("\n#\n# Table structure for table `$tableName`\n#\n\n"); |
530 | 530 | $this->fs->get_tmp_filesystem_append()->write($dumpfile, $line); |
531 | 531 | |
532 | - if ($this->dbDropSyntax) |
|
533 | - { |
|
532 | + if ($this->dbDropSyntax) |
|
533 | + { |
|
534 | 534 | $line = ("\nDROP table IF EXISTS `$tableName`;\n"); |
535 | 535 | $this->fs->get_tmp_filesystem_append()->write($dumpfile, $line); |
536 | 536 | } |
@@ -147,14 +147,14 @@ |
||
147 | 147 | $unit_list = array('B', 'KB', 'MB', 'GB', 'PB'); |
148 | 148 | |
149 | 149 | if ($bytes == 0) { |
150 | - return $bytes . ' ' . $unit_list[0]; |
|
150 | + return $bytes . ' ' . $unit_list[0]; |
|
151 | 151 | } |
152 | 152 | |
153 | 153 | $unit_count = count($unit_list); |
154 | 154 | for ($i = $unit_count - 1; $i >= 0; $i--) { |
155 | - $power = $i * 10; |
|
156 | - if (($bytes >> $power) >= 1) |
|
157 | - return round($bytes / (1 << $power), $decimals) . ' ' . $unit_list[$i]; |
|
155 | + $power = $i * 10; |
|
156 | + if (($bytes >> $power) >= 1) |
|
157 | + return round($bytes / (1 << $power), $decimals) . ' ' . $unit_list[$i]; |
|
158 | 158 | } |
159 | 159 | } |
160 | 160 | } |
@@ -555,15 +555,15 @@ discard block |
||
555 | 555 | return array($bytes_wrote, $last_position); |
556 | 556 | } |
557 | 557 | |
558 | - /** |
|
559 | - * Open a TAR archive and put the file cursor at the end for data appending |
|
560 | - * |
|
561 | - * If $file is empty, the tar file will be created in memory |
|
562 | - * |
|
563 | - * @param string $file |
|
564 | - * @throws ArchiveIOException |
|
565 | - */ |
|
566 | - /* |
|
558 | + /** |
|
559 | + * Open a TAR archive and put the file cursor at the end for data appending |
|
560 | + * |
|
561 | + * If $file is empty, the tar file will be created in memory |
|
562 | + * |
|
563 | + * @param string $file |
|
564 | + * @throws ArchiveIOException |
|
565 | + */ |
|
566 | + /* |
|
567 | 567 | public function openForAppend($file = '') |
568 | 568 | { |
569 | 569 | $this->file = $file; |
@@ -593,16 +593,16 @@ discard block |
||
593 | 593 | } |
594 | 594 | */ |
595 | 595 | |
596 | - /** |
|
597 | - * Append data to a file to the current TAR archive using an existing file in the filesystem |
|
598 | - * |
|
599 | - * @param string $file path to the original file |
|
600 | - * @param int $start starting reading position in file |
|
601 | - * @param int $end end position in reading multiple with 512 |
|
602 | - * @param string|FileInfo $fileinfo either the name to us in archive (string) or a FileInfo oject with all meta data, empty to take from original |
|
603 | - * @throws ArchiveIOException |
|
604 | - */ |
|
605 | - /* |
|
596 | + /** |
|
597 | + * Append data to a file to the current TAR archive using an existing file in the filesystem |
|
598 | + * |
|
599 | + * @param string $file path to the original file |
|
600 | + * @param int $start starting reading position in file |
|
601 | + * @param int $end end position in reading multiple with 512 |
|
602 | + * @param string|FileInfo $fileinfo either the name to us in archive (string) or a FileInfo oject with all meta data, empty to take from original |
|
603 | + * @throws ArchiveIOException |
|
604 | + */ |
|
605 | + /* |
|
606 | 606 | * public function appendFileData($file, $fileinfo = '', $start = 0, $limit = 0) |
607 | 607 | { |
608 | 608 | $end = $start+($limit*512); |
@@ -658,14 +658,14 @@ discard block |
||
658 | 658 | return $last_position; |
659 | 659 | }*/ |
660 | 660 | |
661 | - /** |
|
662 | - * Adds a file to a TAR archive by appending it's data |
|
663 | - * |
|
664 | - * @param string $archive name of the archive file |
|
665 | - * @param string $file name of the file to read data from |
|
666 | - * @param string $start start position from where to start reading data |
|
667 | - * @throws ArchiveIOException |
|
668 | - */ |
|
661 | + /** |
|
662 | + * Adds a file to a TAR archive by appending it's data |
|
663 | + * |
|
664 | + * @param string $archive name of the archive file |
|
665 | + * @param string $file name of the file to read data from |
|
666 | + * @param string $start start position from where to start reading data |
|
667 | + * @throws ArchiveIOException |
|
668 | + */ |
|
669 | 669 | /*public function addFileToArchive($archive, $file, $start = 0) |
670 | 670 | { |
671 | 671 | $this->openForAppend($archive); |
@@ -54,10 +54,10 @@ discard block |
||
54 | 54 | |
55 | 55 | curl_setopt($ch, CURLOPT_POST, 1); |
56 | 56 | curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0); |
57 | - curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0); |
|
58 | - curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 60); |
|
59 | - curl_setopt($ch, CURLOPT_TIMEOUT, 1200); |
|
60 | - curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); |
|
57 | + curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0); |
|
58 | + curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 60); |
|
59 | + curl_setopt($ch, CURLOPT_TIMEOUT, 1200); |
|
60 | + curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); |
|
61 | 61 | |
62 | 62 | curl_setopt($ch, CURLOPT_POSTFIELDS, $send_array ); |
63 | 63 | curl_setopt($ch, CURLOPT_VERBOSE, true); |
@@ -89,9 +89,9 @@ discard block |
||
89 | 89 | private function curl_file_create($filename, $mimetype = '', $postname = '') { |
90 | 90 | if (!function_exists('curl_file_create')) { |
91 | 91 | |
92 | - return "@$filename;filename=" |
|
93 | - . ($postname ?: basename($filename)) |
|
94 | - . ($mimetype ? ";type=$mimetype" : ''); |
|
92 | + return "@$filename;filename=" |
|
93 | + . ($postname ?: basename($filename)) |
|
94 | + . ($mimetype ? ";type=$mimetype" : ''); |
|
95 | 95 | |
96 | 96 | }else{ |
97 | 97 |
@@ -221,28 +221,28 @@ discard block |
||
221 | 221 | |
222 | 222 | // add error/update messages |
223 | 223 | |
224 | - // check if the user have submitted the settings |
|
225 | - // wordpress will add the "settings-updated" $_GET parameter to the url |
|
226 | - if (isset($_GET['settings-updated'])) { |
|
227 | - // add settings saved message with the class of "updated" |
|
228 | - add_settings_error('wporg_messages', 'wporg_message', __('Settings Saved', 'wporg'), 'updated'); |
|
229 | - } |
|
224 | + // check if the user have submitted the settings |
|
225 | + // wordpress will add the "settings-updated" $_GET parameter to the url |
|
226 | + if (isset($_GET['settings-updated'])) { |
|
227 | + // add settings saved message with the class of "updated" |
|
228 | + add_settings_error('wporg_messages', 'wporg_message', __('Settings Saved', 'wporg'), 'updated'); |
|
229 | + } |
|
230 | 230 | |
231 | - // show error/update messages |
|
232 | - settings_errors('wporg_messages'); |
|
233 | - ?> |
|
231 | + // show error/update messages |
|
232 | + settings_errors('wporg_messages'); |
|
233 | + ?> |
|
234 | 234 | |
235 | 235 | <?php |
236 | 236 | $xcloner_sanitization = $this->get_xcloner_container()->get_xcloner_sanitization(); |
237 | 237 | |
238 | - if( isset( $_GET[ 'tab' ] ) ) { |
|
239 | - $active_tab = $xcloner_sanitization->sanitize_input_as_string($_GET[ 'tab' ]); |
|
240 | - } // end if |
|
241 | - else{ |
|
238 | + if( isset( $_GET[ 'tab' ] ) ) { |
|
239 | + $active_tab = $xcloner_sanitization->sanitize_input_as_string($_GET[ 'tab' ]); |
|
240 | + } // end if |
|
241 | + else{ |
|
242 | 242 | $active_tab = "general_options"; |
243 | 243 | } |
244 | 244 | |
245 | - ?> |
|
245 | + ?> |
|
246 | 246 | <h1><?= esc_html(get_admin_page_title()); ?></h1> |
247 | 247 | |
248 | 248 | <ul class="nav-tab-wrapper row"> |
@@ -276,9 +276,9 @@ discard block |
||
276 | 276 | do_settings_sections('xcloner_cleanup_settings_page'); |
277 | 277 | } |
278 | 278 | |
279 | - // output save settings button |
|
280 | - submit_button('Save Settings'); |
|
281 | - ?> |
|
279 | + // output save settings button |
|
280 | + submit_button('Save Settings'); |
|
281 | + ?> |
|
282 | 282 | </form> |
283 | 283 | |
284 | 284 | </div> |
@@ -385,9 +385,9 @@ discard block |
||
385 | 385 | } |
386 | 386 | |
387 | 387 | $endpoint = sprintf( |
388 | - 'DefaultEndpointsProtocol=https;AccountName=%s;AccountKey=%s', |
|
389 | - get_option("xcloner_azure_account_name"), |
|
390 | - get_option("xcloner_azure_api_key") |
|
388 | + 'DefaultEndpointsProtocol=https;AccountName=%s;AccountKey=%s', |
|
389 | + get_option("xcloner_azure_account_name"), |
|
390 | + get_option("xcloner_azure_api_key") |
|
391 | 391 | ); |
392 | 392 | |
393 | 393 | $blobRestProxy = ServicesBuilder::getInstance()->createBlobService($endpoint); |
@@ -431,12 +431,12 @@ discard block |
||
431 | 431 | |
432 | 432 | |
433 | 433 | $client = new S3Client([ |
434 | - 'credentials' => [ |
|
435 | - 'key' => get_option("xcloner_aws_key"), |
|
436 | - 'secret' => get_option("xcloner_aws_secret") |
|
437 | - ], |
|
438 | - 'region' => get_option("xcloner_aws_region"), |
|
439 | - 'version' => 'latest', |
|
434 | + 'credentials' => [ |
|
435 | + 'key' => get_option("xcloner_aws_key"), |
|
436 | + 'secret' => get_option("xcloner_aws_secret") |
|
437 | + ], |
|
438 | + 'region' => get_option("xcloner_aws_region"), |
|
439 | + 'version' => 'latest', |
|
440 | 440 | ]); |
441 | 441 | |
442 | 442 | $adapter = new AwsS3Adapter($client, get_option("xcloner_aws_bucket_name")); |
@@ -599,9 +599,9 @@ discard block |
||
599 | 599 | { |
600 | 600 | $query = sprintf('mimeType = \'application/vnd.google-apps.folder\' and \'%s\' in parents and name contains \'%s\'', $parent, $dir); |
601 | 601 | $response = $service->files->listFiles([ |
602 | - 'pageSize' => 1, |
|
603 | - 'q' => $query |
|
604 | - ]); |
|
602 | + 'pageSize' => 1, |
|
603 | + 'q' => $query |
|
604 | + ]); |
|
605 | 605 | |
606 | 606 | if(sizeof($response)) |
607 | 607 | { |
@@ -630,16 +630,16 @@ discard block |
||
630 | 630 | $this->logger->info(sprintf("Creating the FTP remote storage connection"), array("")); |
631 | 631 | |
632 | 632 | $adapter = new Adapter([ |
633 | - 'host' => get_option("xcloner_ftp_hostname"), |
|
634 | - 'username' => get_option("xcloner_ftp_username"), |
|
635 | - 'password' => get_option("xcloner_ftp_password"), |
|
636 | - |
|
637 | - /** optional config settings */ |
|
638 | - 'port' => get_option("xcloner_ftp_port", 21), |
|
639 | - 'root' => get_option("xcloner_ftp_path"), |
|
640 | - 'passive' => get_option("xcloner_ftp_transfer_mode"), |
|
641 | - 'ssl' => get_option("xcloner_ftp_ssl_mode"), |
|
642 | - 'timeout' => get_option("xcloner_ftp_timeout", 30), |
|
633 | + 'host' => get_option("xcloner_ftp_hostname"), |
|
634 | + 'username' => get_option("xcloner_ftp_username"), |
|
635 | + 'password' => get_option("xcloner_ftp_password"), |
|
636 | + |
|
637 | + /** optional config settings */ |
|
638 | + 'port' => get_option("xcloner_ftp_port", 21), |
|
639 | + 'root' => get_option("xcloner_ftp_path"), |
|
640 | + 'passive' => get_option("xcloner_ftp_transfer_mode"), |
|
641 | + 'ssl' => get_option("xcloner_ftp_ssl_mode"), |
|
642 | + 'timeout' => get_option("xcloner_ftp_timeout", 30), |
|
643 | 643 | ]); |
644 | 644 | |
645 | 645 | $adapter->connect(); |
@@ -656,15 +656,15 @@ discard block |
||
656 | 656 | $this->logger->info(sprintf("Creating the SFTP remote storage connection"), array("")); |
657 | 657 | |
658 | 658 | $adapter = new SftpAdapter([ |
659 | - 'host' => get_option("xcloner_sftp_hostname"), |
|
660 | - 'username' => get_option("xcloner_sftp_username"), |
|
661 | - 'password' => get_option("xcloner_sftp_password"), |
|
662 | - |
|
663 | - /** optional config settings */ |
|
664 | - 'port' => get_option("xcloner_sftp_port", 22), |
|
665 | - 'root' => get_option("xcloner_sftp_path"), |
|
666 | - 'privateKey' => get_option("xcloner_sftp_private_key"), |
|
667 | - 'timeout' => get_option("xcloner_ftp_timeout", 30), |
|
659 | + 'host' => get_option("xcloner_sftp_hostname"), |
|
660 | + 'username' => get_option("xcloner_sftp_username"), |
|
661 | + 'password' => get_option("xcloner_sftp_password"), |
|
662 | + |
|
663 | + /** optional config settings */ |
|
664 | + 'port' => get_option("xcloner_sftp_port", 22), |
|
665 | + 'root' => get_option("xcloner_sftp_path"), |
|
666 | + 'privateKey' => get_option("xcloner_sftp_private_key"), |
|
667 | + 'timeout' => get_option("xcloner_ftp_timeout", 30), |
|
668 | 668 | ]); |
669 | 669 | |
670 | 670 | $adapter->connect(); |
@@ -284,12 +284,12 @@ discard block |
||
284 | 284 | } |
285 | 285 | |
286 | 286 | public function getMetadataFull($adapter = "storage_adapter" , $path) |
287 | - { |
|
288 | - $location = $this->$adapter->applyPathPrefix($path); |
|
289 | - $spl_info = new SplFileInfo($location); |
|
287 | + { |
|
288 | + $location = $this->$adapter->applyPathPrefix($path); |
|
289 | + $spl_info = new SplFileInfo($location); |
|
290 | 290 | |
291 | - return ($spl_info); |
|
292 | - } |
|
291 | + return ($spl_info); |
|
292 | + } |
|
293 | 293 | |
294 | 294 | |
295 | 295 | public function get_backup_archives_list($storage_selection = "") |
@@ -659,27 +659,27 @@ discard block |
||
659 | 659 | |
660 | 660 | private function array_orderby() |
661 | 661 | { |
662 | - $args = func_get_args(); |
|
663 | - $data = array_shift($args); |
|
662 | + $args = func_get_args(); |
|
663 | + $data = array_shift($args); |
|
664 | 664 | |
665 | - foreach ($args as $n => $field) { |
|
666 | - if (is_string($field)) { |
|
667 | - $tmp = array(); |
|
668 | - foreach ($data as $key => $row) |
|
669 | - { |
|
665 | + foreach ($args as $n => $field) { |
|
666 | + if (is_string($field)) { |
|
667 | + $tmp = array(); |
|
668 | + foreach ($data as $key => $row) |
|
669 | + { |
|
670 | 670 | if(is_array($row)) |
671 | 671 | $tmp[$key] = $row[$field]; |
672 | 672 | else |
673 | 673 | $tmp[$key] = $row->$field; |
674 | 674 | } |
675 | - $args[$n] = $tmp; |
|
676 | - } |
|
677 | - } |
|
678 | - $args[] = &$data; |
|
675 | + $args[$n] = $tmp; |
|
676 | + } |
|
677 | + } |
|
678 | + $args[] = &$data; |
|
679 | 679 | |
680 | - call_user_func_array('array_multisort', $args); |
|
680 | + call_user_func_array('array_multisort', $args); |
|
681 | 681 | |
682 | - return array_pop($args); |
|
682 | + return array_pop($args); |
|
683 | 683 | } |
684 | 684 | |
685 | 685 | public function is_excluded($file) |
@@ -307,7 +307,7 @@ discard block |
||
307 | 307 | $this->loader->add_action( 'plugins_loaded', $plugin_i18n, 'load_plugin_textdomain' ); |
308 | 308 | |
309 | 309 | //wp_localize_script( 'ajax-script', 'my_ajax_object', |
310 | - // array( 'ajax_url' => admin_url( 'admin-ajax.php' ) ) ); |
|
310 | + // array( 'ajax_url' => admin_url( 'admin-ajax.php' ) ) ); |
|
311 | 311 | |
312 | 312 | } |
313 | 313 | |
@@ -341,8 +341,8 @@ discard block |
||
341 | 341 | |
342 | 342 | private function define_plugin_settings(){ |
343 | 343 | /** |
344 | - * register wporg_settings_init to the admin_init action hook |
|
345 | - */ |
|
344 | + * register wporg_settings_init to the admin_init action hook |
|
345 | + */ |
|
346 | 346 | |
347 | 347 | $this->xcloner_settings = new XCloner_Settings($this); |
348 | 348 | |
@@ -393,15 +393,15 @@ discard block |
||
393 | 393 | } |
394 | 394 | |
395 | 395 | function friendly_error_type($type) { |
396 | - static $levels=null; |
|
397 | - if ($levels===null) { |
|
398 | - $levels=[]; |
|
399 | - foreach (get_defined_constants() as $key=>$value) { |
|
400 | - if (strpos($key,'E_')!==0) {continue;} |
|
396 | + static $levels=null; |
|
397 | + if ($levels===null) { |
|
398 | + $levels=[]; |
|
399 | + foreach (get_defined_constants() as $key=>$value) { |
|
400 | + if (strpos($key,'E_')!==0) {continue;} |
|
401 | 401 | $levels[$value]= $key; //substr($key,2); |
402 | - } |
|
403 | - } |
|
404 | - return (isset($levels[$type]) ? $levels[$type] : "Error #{$type}"); |
|
402 | + } |
|
403 | + } |
|
404 | + return (isset($levels[$type]) ? $levels[$type] : "Error #{$type}"); |
|
405 | 405 | } |
406 | 406 | |
407 | 407 | private function define_ajax_hooks() |
@@ -437,19 +437,19 @@ discard block |
||
437 | 437 | add_action( 'wp_ajax_copy_backup_remote_to_local', array($xcloner_api,'copy_backup_remote_to_local') ); |
438 | 438 | add_action( 'admin_notices', array($this, 'xcloner_error_admin_notices' )); |
439 | 439 | |
440 | - } |
|
440 | + } |
|
441 | 441 | |
442 | 442 | } |
443 | 443 | |
444 | 444 | function add_plugin_action_links($links, $file) { |
445 | - if ($file == plugin_basename(dirname(dirname(__FILE__)) . '/xcloner.php')) |
|
445 | + if ($file == plugin_basename(dirname(dirname(__FILE__)) . '/xcloner.php')) |
|
446 | 446 | { |
447 | 447 | $links[] = '<a href="admin.php?page=xcloner_settings_page">'.__('Settings', 'xcloner-backup-and-restore').'</a>'; |
448 | 448 | $links[] = '<a href="admin.php?page=xcloner_generate_backups_page">'.__('Generate Backup', 'xcloner-backup-and-restore').'</a>'; |
449 | 449 | } |
450 | 450 | |
451 | - return $links; |
|
452 | - } |
|
451 | + return $links; |
|
452 | + } |
|
453 | 453 | |
454 | 454 | public function xcloner_error_admin_notices() { |
455 | 455 | settings_errors( 'xcloner_error_message' ); |
@@ -526,9 +526,9 @@ discard block |
||
526 | 526 | function xcloner_display() |
527 | 527 | { |
528 | 528 | // check user capabilities |
529 | - if (!current_user_can('manage_options')) { |
|
530 | - return; |
|
531 | - } |
|
529 | + if (!current_user_can('manage_options')) { |
|
530 | + return; |
|
531 | + } |
|
532 | 532 | |
533 | 533 | $page = sanitize_key($_GET['page']); |
534 | 534 |
@@ -203,12 +203,12 @@ discard block |
||
203 | 203 | $scheduler->update_cron_hook($_POST['id']); |
204 | 204 | |
205 | 205 | if( $wpdb->last_error ) { |
206 | - $response['error'] = 1; |
|
207 | - $response['error_message'] = $wpdb->last_error/*."--".$wpdb->last_query*/; |
|
206 | + $response['error'] = 1; |
|
207 | + $response['error_message'] = $wpdb->last_error/*."--".$wpdb->last_query*/; |
|
208 | 208 | |
209 | - } |
|
209 | + } |
|
210 | 210 | |
211 | - $scheduler->update_wp_cron_hooks(); |
|
211 | + $scheduler->update_wp_cron_hooks(); |
|
212 | 212 | $response['finished'] = 1; |
213 | 213 | |
214 | 214 | $this->send_response($response); |
@@ -882,14 +882,14 @@ discard block |
||
882 | 882 | $tar->close(); |
883 | 883 | |
884 | 884 | if (file_exists($tmp_file)) { |
885 | - header('Content-Description: File Transfer'); |
|
886 | - header('Content-Type: application/octet-stream'); |
|
887 | - header('Content-Disposition: attachment; filename="'.basename($tmp_file).'"'); |
|
888 | - header('Expires: 0'); |
|
889 | - header('Cache-Control: must-revalidate'); |
|
890 | - header('Pragma: public'); |
|
891 | - header('Content-Length: ' . filesize($tmp_file)); |
|
892 | - readfile($tmp_file); |
|
885 | + header('Content-Description: File Transfer'); |
|
886 | + header('Content-Type: application/octet-stream'); |
|
887 | + header('Content-Disposition: attachment; filename="'.basename($tmp_file).'"'); |
|
888 | + header('Expires: 0'); |
|
889 | + header('Cache-Control: must-revalidate'); |
|
890 | + header('Pragma: public'); |
|
891 | + header('Content-Length: ' . filesize($tmp_file)); |
|
892 | + readfile($tmp_file); |
|
893 | 893 | |
894 | 894 | } |
895 | 895 | |
@@ -916,24 +916,24 @@ discard block |
||
916 | 916 | |
917 | 917 | |
918 | 918 | header('Pragma: public'); |
919 | - header('Expires: 0'); |
|
920 | - header('Cache-Control: must-revalidate, post-check=0, pre-check=0'); |
|
921 | - header('Cache-Control: private', false); |
|
922 | - header('Content-Transfer-Encoding: binary'); |
|
923 | - header('Content-Disposition: attachment; filename="'.$metadata['path'].'";'); |
|
924 | - header('Content-Type: application/octet-stream'); |
|
925 | - header('Content-Length: ' . $metadata['size']); |
|
919 | + header('Expires: 0'); |
|
920 | + header('Cache-Control: must-revalidate, post-check=0, pre-check=0'); |
|
921 | + header('Cache-Control: private', false); |
|
922 | + header('Content-Transfer-Encoding: binary'); |
|
923 | + header('Content-Disposition: attachment; filename="'.$metadata['path'].'";'); |
|
924 | + header('Content-Type: application/octet-stream'); |
|
925 | + header('Content-Length: ' . $metadata['size']); |
|
926 | 926 | |
927 | - @ob_end_clean(); |
|
927 | + @ob_end_clean(); |
|
928 | 928 | |
929 | - $chunkSize = 1024 * 1024; |
|
930 | - while (!feof($read_stream)) |
|
931 | - { |
|
932 | - $buffer = fread($read_stream, $chunkSize); |
|
933 | - echo $buffer; |
|
934 | - } |
|
935 | - fclose($read_stream); |
|
936 | - exit; |
|
929 | + $chunkSize = 1024 * 1024; |
|
930 | + while (!feof($read_stream)) |
|
931 | + { |
|
932 | + $buffer = fread($read_stream, $chunkSize); |
|
933 | + echo $buffer; |
|
934 | + } |
|
935 | + fclose($read_stream); |
|
936 | + exit; |
|
937 | 937 | |
938 | 938 | } |
939 | 939 |