PluginProbe
WP Database Backup – Unlimited Database & Files Backup by Backup for WP / 6.11
WP Database Backup – Unlimited Database & Files Backup by Backup for WP v6.11
7.13 7.12 trunk 1.1 2.1.1 5.9 6.0 6.1 6.10 6.11 6.12 6.12.1 6.2 6.3 6.4 6.5 6.5.1 6.6 6.7 6.8 6.9 7.0 7.0.1 7.1 7.10 All 34 releases
wp-database-backup / includes / admin / Destination / FTP / sendaway.php

sendaway.php in WP Database Backup – Unlimited Database & Files Backup by Backup for WP 6.11, at includes/admin/Destination/FTP/sendaway.php

46 lines 1.4 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * Destination ftp
4 *
5 * @package wpdbbkp
6 */
7
8 // Set up variables.
9 $host = get_option( 'backupbreeze_ftp_host' );
10 $user = get_option( 'backupbreeze_ftp_user' );
11 $pass = get_option( 'backupbreeze_ftp_pass' );
12 $subdir = get_option( 'backupbreeze_ftp_subdir' );
13 $wp_upload_dir = wp_upload_dir();
14
15 $wp_upload_dir['basedir'] = str_replace( '\\', '/', $wp_upload_dir['basedir'] );
16 $remotefile = $subdir . '/' . $filename;
17 $localfile = trailingslashit( $wp_upload_dir['basedir'] . '/db-backup' ) . $filename;
18 if ( isset( $host ) && ! empty( $host ) && isset( $user ) && ! empty( $user ) && isset( $pass ) && ! empty( $pass ) ) {
19 // See if port option is blank and set it to 21 if it isn't.
20 if ( ! get_option( 'backupbreeze_ftp_port' ) ) {
21 $port = '21';
22 } else {
23 $port = get_option( 'backupbreeze_ftp_port' );
24 }
25 $conn = ftp_connect( $host, $port );
26 if ( $conn ) {
27 $result = ftp_login( $conn, $user, $pass );
28 if ( $result ) {
29 // Switch to passive mode.
30 ftp_pasv( $conn, true );
31 // Upload file.
32 $success = ftp_put( $conn, $remotefile, $localfile, FTP_BINARY );
33 if ( $success ) {
34 $args[2] = $args[2] . '<br> Upload Database Backup on FTP ' . $host;
35 $args[4] = $args[4] .= 'FTP, ';
36 }
37 }
38 }
39 // Close connection to host.
40 if(!is_bool($conn)){
41 ftp_quit( $conn );
42 }
43
44 }
45
46