Version Description
Download this release
Release Info
Developer | GamerZ |
Plugin | WP-DBManager |
Version | 2.79.1 |
Comparing to | |
See all releases |
Code changes from version 2.79 to 2.79.1
- database-backup.php +6 -6
- readme.txt +34 -31
- wp-dbmanager.php +10 -9
database-backup.php
CHANGED
@@ -24,22 +24,22 @@ if(!empty($_POST['do'])) {
|
|
24 |
switch($_POST['do']) {
|
25 |
case __('Backup', 'wp-dbmanager'):
|
26 |
check_admin_referer('wp-dbmanager_backup');
|
27 |
-
$brace = (
|
28 |
$backup['host'] = DB_HOST;
|
29 |
$backup['port'] = '';
|
30 |
$backup['sock'] = '';
|
31 |
-
if(strpos(DB_HOST, ':') !== false) {
|
32 |
$db_host = explode(':', DB_HOST);
|
33 |
$backup['host'] = $db_host[0];
|
34 |
-
if(
|
35 |
-
$backup['port'] = ' --port=' . escapeshellarg(
|
36 |
} else {
|
37 |
$backup['sock'] = ' --socket=' . escapeshellarg( $db_host[1] );
|
38 |
}
|
39 |
}
|
40 |
-
$gzip =
|
41 |
|
42 |
-
if($gzip
|
43 |
$backup['filename'] = $backup['date'].'_-_'.DB_NAME.'.sql.gz';
|
44 |
$backup['filepath'] = $backup['path'].'/'.$backup['filename'];
|
45 |
do_action( 'wp_dbmanager_before_escapeshellcmd' );
|
24 |
switch($_POST['do']) {
|
25 |
case __('Backup', 'wp-dbmanager'):
|
26 |
check_admin_referer('wp-dbmanager_backup');
|
27 |
+
$brace = 0 === strpos( PHP_OS, 'WIN' ) ? '"' : '';
|
28 |
$backup['host'] = DB_HOST;
|
29 |
$backup['port'] = '';
|
30 |
$backup['sock'] = '';
|
31 |
+
if ( strpos( DB_HOST, ':' ) !== false ) {
|
32 |
$db_host = explode(':', DB_HOST);
|
33 |
$backup['host'] = $db_host[0];
|
34 |
+
if ( (int) $db_host[1] !== 0) {
|
35 |
+
$backup['port'] = ' --port=' . escapeshellarg( (int) $db_host[1] );
|
36 |
} else {
|
37 |
$backup['sock'] = ' --socket=' . escapeshellarg( $db_host[1] );
|
38 |
}
|
39 |
}
|
40 |
+
$gzip = isset( $_POST['gzip'] ) ? (int) $_POST['gzip'] : 0;
|
41 |
|
42 |
+
if ( $gzip === 1 ) {
|
43 |
$backup['filename'] = $backup['date'].'_-_'.DB_NAME.'.sql.gz';
|
44 |
$backup['filepath'] = $backup['path'].'/'.$backup['filename'];
|
45 |
do_action( 'wp_dbmanager_before_escapeshellcmd' );
|
readme.txt
CHANGED
@@ -1,17 +1,17 @@
|
|
1 |
-
|
2 |
Contributors: GamerZ
|
3 |
Donate link: http://lesterchan.net/site/donation/
|
4 |
Tags: database, manage, wp-dbmanager, manager, table, optimize, backup, queries, query, drop, empty, tables, table, run, repair, cron, schedule, scheduling, automatic
|
5 |
Requires at least: 4.0
|
6 |
-
Tested up to: 4.
|
7 |
-
Stable tag: 2.79
|
8 |
|
9 |
Manages your WordPress database.
|
10 |
|
11 |
-
|
12 |
Allows you to optimize database, repair database, backup database, restore database, delete backup database , drop/empty tables and run selected queries. Supports automatic scheduling of backing up, optimizing and repairing of database.
|
13 |
|
14 |
-
|
15 |
1. Activate `WP-DBManager` Plugin
|
16 |
1. The script will automatically create a folder called `backup-db` in the wp-content folder if that folder is writable. If it is not created, please create the folder and ensure that the folder is writable
|
17 |
1. Open `Folder: wp-content/backup-db`
|
@@ -20,68 +20,71 @@ Allows you to optimize database, repair database, backup database, restore datab
|
|
20 |
1. Move `index.php` file from `Folder: wp-content/plugins/wp-dbmanager` to `Folder: wp-content/backup-db/index.php` if it is not there already
|
21 |
1. Go to `WP-Admin -> Database -> DB Options` to configure the database options
|
22 |
|
23 |
-
|
24 |
[![Build Status](https://travis-ci.org/lesterchan/wp-dbmanager.svg?branch=master)](https://travis-ci.org/lesterchan/wp-dbmanager)
|
25 |
|
26 |
-
|
27 |
* [https://github.com/lesterchan/wp-dbmanager](https://github.com/lesterchan/wp-dbmanager "https://github.com/lesterchan/wp-dbmanager")
|
28 |
|
29 |
-
|
30 |
* [http://dev.wp-plugins.org/browser/wp-dbmanager/i18n/](http://dev.wp-plugins.org/browser/wp-dbmanager/i18n/ "http://dev.wp-plugins.org/browser/wp-dbmanager/i18n/")
|
31 |
|
32 |
-
|
33 |
* Plugin icon by [Freepik](http://www.freepik.com) from [Flaticon](http://www.flaticon.com)
|
34 |
|
35 |
-
|
36 |
* I spent most of my free time creating, updating, maintaining and supporting these plugins, if you really love my plugins and could spare me a couple of bucks, I will really appreciate it. If not feel free to use it without any obligations.
|
37 |
|
38 |
-
|
39 |
* Note that this plugin passes your datababase password via --password in the command line of mysqldump. This is convenient but as a trade off, it is insecure.
|
40 |
* On some systems, your password becomes visible to system status programs such as ps that may be invoked by other users to display command lines. MySQL clients typically overwrite the command-line password argument with zeros during their initialization sequence. However, there is still a brief interval during which the value is visible. Also, on some systems this overwriting strategy is ineffective and the password remains visible to ps. Source: [End-User Guidelines for Password Security](http://dev.mysql.com/doc/refman/5.5/en/password-security-user.html)
|
41 |
* If this is a concern to you, I recommend another database backup plugin called [WP-DB-Backup](https://wordpress.org/plugins/wp-db-backup/)
|
42 |
* To know about the difference between WP-DBManager and WP-DB-backup, checkout __What is the difference between WP-DBManager and WP-DB-Backup?__ in the [FAQ section](https://wordpress.org/plugins/wp-dbmanager/faq/).
|
43 |
|
44 |
-
|
45 |
-
|
|
|
|
|
|
|
46 |
* FIXED: Proper check for disabled functions
|
47 |
|
48 |
-
|
49 |
* NEW: Bump WordPress 4.7
|
50 |
* FIXED: Undefined index: repair and repair_period
|
51 |
|
52 |
-
|
53 |
* FIXED: escapeshellcmd on Windows. Props Gregory Karpinsky.
|
54 |
* FIXED: Move wp_mkdir_p() up before if check. Props Scott Allen.
|
55 |
|
56 |
-
|
57 |
* FIXED: Blank screen downloading backup
|
58 |
* FIXED: Remove MySQL Version check to display tables stats
|
59 |
|
60 |
-
|
61 |
* NEW: Add wp_dbmanager_before_escapeshellcmd action just before escapeshellcmd()
|
62 |
* FIXED: Missing / for Windows
|
63 |
|
64 |
-
|
65 |
* FIXED: When activating the plugin, copy index.php to the backup folder
|
66 |
* FIXED: If you are on Apache, .htaccess will be copied to the backup folder, if you are on IIS, Web.config will be copied to the backup folder
|
67 |
* FIXED: When choosing 1 Month(s) for Backup/Optimize/Repair, the next date calculation is wrong
|
68 |
|
69 |
-
|
70 |
* FIXED: escapeshellarg() already escape $, no need to double escape it
|
71 |
|
72 |
-
|
73 |
* FIXED: Unable to backup/restore database if user database password has certain special characters in them
|
74 |
|
75 |
-
|
76 |
* FIXED: Use escapeshellcmd() to escape shell commands. Props Larry W. Cashdollari.
|
77 |
* FIXED: Do not allow LOAD_FILE to be run. Props Larry W. Cashdollari.
|
78 |
* FIXED: Uses dbmanager_is_valid_path() to check for mysql and mysqldump path. Fixes arbitrary command injection using backup path. Props Larry W. Cashdollari.
|
79 |
* FIXED: Uses realpath() to check for backup path. Fixes arbitrary command injection using backup path. Props Larry W. Cashdollari.
|
80 |
|
81 |
-
|
82 |
* NEW: Bump to 4.0
|
83 |
|
84 |
-
|
85 |
* New: Uses WordPress 3.9 Dashicons
|
86 |
* NEW: Allow you to hide admin notices in the DB Options page
|
87 |
* NEW: Allow Multisite Network Activate
|
@@ -91,17 +94,17 @@ Allows you to optimize database, repair database, backup database, restore datab
|
|
91 |
* FIXED: Issues with email from field if site title contains , (comma)
|
92 |
* FIXED: Notices
|
93 |
|
94 |
-
|
95 |
* FIXED: Set default character set to UTF-8. Props Karsonito
|
96 |
|
97 |
-
|
98 |
* FIXED: Use intval() instead of is_int() when checking for port number. Props [Webby Scots](http://webbyscots.com/ "Webby Scots")
|
99 |
|
100 |
-
|
101 |
* NEW: Added Auto Repair Functionality
|
102 |
* NEW: Added nonce To All Forms For Added Security
|
103 |
|
104 |
-
|
105 |
|
106 |
1. Admin - Backup DB
|
107 |
2. Admin - Empty/Drop Tables In DB
|
@@ -113,9 +116,9 @@ Allows you to optimize database, repair database, backup database, restore datab
|
|
113 |
8. Admin - Repair DB
|
114 |
9. Admin - Run Query in DB
|
115 |
|
116 |
-
|
117 |
|
118 |
-
|
119 |
* Ensure that your host allows you to access mysqldump. You can try to narrow the problem by Debugging via SSH:
|
120 |
1. In `wp-dbmanager.php`
|
121 |
2. Find `check_backup_files();` on line 246
|
@@ -126,11 +129,11 @@ Allows you to optimize database, repair database, backup database, restore datab
|
|
126 |
7. Copy that line than run it in SSH
|
127 |
8. If you need help on SSH contact your host or google for more info
|
128 |
|
129 |
-
|
130 |
* WP-DBManager uses `mysqldump` application to generate the backup and `mysql` application to restore them via shell.
|
131 |
* WP-DB-Backup uses PHP to generate the backup. In some cases WP-DB-Backup will work better for you because it requires less permissions. Not all host allows you to access mysqldump/mysql directly via shell.
|
132 |
* WP-DBManager allows you to have automatic optimizing and repairing of database on top of backing up of database.
|
133 |
|
134 |
-
|
135 |
* Ensure that you have renamed `htaccess.txt` to `.htaccess` and placed it in your backup folder (defaults to `wp-content/backup-db/`)
|
136 |
* If you are 100% sure you have did that and have verfied that the folder no longer is accessible to the public by visiting the URL `http://yousite.com/wp-content/backup-db/`, you can safely disable the notice by going to `WP-Admin -> Database -> DB Options` and set `Hide Admin Notices` to `Yes`.
|
1 |
+
# WP-DBManager
|
2 |
Contributors: GamerZ
|
3 |
Donate link: http://lesterchan.net/site/donation/
|
4 |
Tags: database, manage, wp-dbmanager, manager, table, optimize, backup, queries, query, drop, empty, tables, table, run, repair, cron, schedule, scheduling, automatic
|
5 |
Requires at least: 4.0
|
6 |
+
Tested up to: 4.9
|
7 |
+
Stable tag: 2.79.1
|
8 |
|
9 |
Manages your WordPress database.
|
10 |
|
11 |
+
## Description
|
12 |
Allows you to optimize database, repair database, backup database, restore database, delete backup database , drop/empty tables and run selected queries. Supports automatic scheduling of backing up, optimizing and repairing of database.
|
13 |
|
14 |
+
## General Usage
|
15 |
1. Activate `WP-DBManager` Plugin
|
16 |
1. The script will automatically create a folder called `backup-db` in the wp-content folder if that folder is writable. If it is not created, please create the folder and ensure that the folder is writable
|
17 |
1. Open `Folder: wp-content/backup-db`
|
20 |
1. Move `index.php` file from `Folder: wp-content/plugins/wp-dbmanager` to `Folder: wp-content/backup-db/index.php` if it is not there already
|
21 |
1. Go to `WP-Admin -> Database -> DB Options` to configure the database options
|
22 |
|
23 |
+
### Build Status
|
24 |
[![Build Status](https://travis-ci.org/lesterchan/wp-dbmanager.svg?branch=master)](https://travis-ci.org/lesterchan/wp-dbmanager)
|
25 |
|
26 |
+
### Development
|
27 |
* [https://github.com/lesterchan/wp-dbmanager](https://github.com/lesterchan/wp-dbmanager "https://github.com/lesterchan/wp-dbmanager")
|
28 |
|
29 |
+
### Translations
|
30 |
* [http://dev.wp-plugins.org/browser/wp-dbmanager/i18n/](http://dev.wp-plugins.org/browser/wp-dbmanager/i18n/ "http://dev.wp-plugins.org/browser/wp-dbmanager/i18n/")
|
31 |
|
32 |
+
### Credits
|
33 |
* Plugin icon by [Freepik](http://www.freepik.com) from [Flaticon](http://www.flaticon.com)
|
34 |
|
35 |
+
### Donations
|
36 |
* I spent most of my free time creating, updating, maintaining and supporting these plugins, if you really love my plugins and could spare me a couple of bucks, I will really appreciate it. If not feel free to use it without any obligations.
|
37 |
|
38 |
+
### Disclaimer
|
39 |
* Note that this plugin passes your datababase password via --password in the command line of mysqldump. This is convenient but as a trade off, it is insecure.
|
40 |
* On some systems, your password becomes visible to system status programs such as ps that may be invoked by other users to display command lines. MySQL clients typically overwrite the command-line password argument with zeros during their initialization sequence. However, there is still a brief interval during which the value is visible. Also, on some systems this overwriting strategy is ineffective and the password remains visible to ps. Source: [End-User Guidelines for Password Security](http://dev.mysql.com/doc/refman/5.5/en/password-security-user.html)
|
41 |
* If this is a concern to you, I recommend another database backup plugin called [WP-DB-Backup](https://wordpress.org/plugins/wp-db-backup/)
|
42 |
* To know about the difference between WP-DBManager and WP-DB-backup, checkout __What is the difference between WP-DBManager and WP-DB-Backup?__ in the [FAQ section](https://wordpress.org/plugins/wp-dbmanager/faq/).
|
43 |
|
44 |
+
## Changelog
|
45 |
+
### Version 2.79.1
|
46 |
+
* FIXED: Added default utf8 charset
|
47 |
+
|
48 |
+
### Version 2.79
|
49 |
* FIXED: Proper check for disabled functions
|
50 |
|
51 |
+
### Version 2.78.1
|
52 |
* NEW: Bump WordPress 4.7
|
53 |
* FIXED: Undefined index: repair and repair_period
|
54 |
|
55 |
+
### Version 2.78
|
56 |
* FIXED: escapeshellcmd on Windows. Props Gregory Karpinsky.
|
57 |
* FIXED: Move wp_mkdir_p() up before if check. Props Scott Allen.
|
58 |
|
59 |
+
### Version 2.77
|
60 |
* FIXED: Blank screen downloading backup
|
61 |
* FIXED: Remove MySQL Version check to display tables stats
|
62 |
|
63 |
+
### Version 2.76
|
64 |
* NEW: Add wp_dbmanager_before_escapeshellcmd action just before escapeshellcmd()
|
65 |
* FIXED: Missing / for Windows
|
66 |
|
67 |
+
### Version 2.75
|
68 |
* FIXED: When activating the plugin, copy index.php to the backup folder
|
69 |
* FIXED: If you are on Apache, .htaccess will be copied to the backup folder, if you are on IIS, Web.config will be copied to the backup folder
|
70 |
* FIXED: When choosing 1 Month(s) for Backup/Optimize/Repair, the next date calculation is wrong
|
71 |
|
72 |
+
### Version 2.74
|
73 |
* FIXED: escapeshellarg() already escape $, no need to double escape it
|
74 |
|
75 |
+
### Version 2.73
|
76 |
* FIXED: Unable to backup/restore database if user database password has certain special characters in them
|
77 |
|
78 |
+
### Version 2.72
|
79 |
* FIXED: Use escapeshellcmd() to escape shell commands. Props Larry W. Cashdollari.
|
80 |
* FIXED: Do not allow LOAD_FILE to be run. Props Larry W. Cashdollari.
|
81 |
* FIXED: Uses dbmanager_is_valid_path() to check for mysql and mysqldump path. Fixes arbitrary command injection using backup path. Props Larry W. Cashdollari.
|
82 |
* FIXED: Uses realpath() to check for backup path. Fixes arbitrary command injection using backup path. Props Larry W. Cashdollari.
|
83 |
|
84 |
+
### Version 2.71
|
85 |
* NEW: Bump to 4.0
|
86 |
|
87 |
+
### Version 2.70
|
88 |
* New: Uses WordPress 3.9 Dashicons
|
89 |
* NEW: Allow you to hide admin notices in the DB Options page
|
90 |
* NEW: Allow Multisite Network Activate
|
94 |
* FIXED: Issues with email from field if site title contains , (comma)
|
95 |
* FIXED: Notices
|
96 |
|
97 |
+
### Version 2.65
|
98 |
* FIXED: Set default character set to UTF-8. Props Karsonito
|
99 |
|
100 |
+
### Version 2.64
|
101 |
* FIXED: Use intval() instead of is_int() when checking for port number. Props [Webby Scots](http://webbyscots.com/ "Webby Scots")
|
102 |
|
103 |
+
### Version 2.63 (03-05-2011)
|
104 |
* NEW: Added Auto Repair Functionality
|
105 |
* NEW: Added nonce To All Forms For Added Security
|
106 |
|
107 |
+
## Screenshots
|
108 |
|
109 |
1. Admin - Backup DB
|
110 |
2. Admin - Empty/Drop Tables In DB
|
116 |
8. Admin - Repair DB
|
117 |
9. Admin - Run Query in DB
|
118 |
|
119 |
+
## Frequently Asked Questions
|
120 |
|
121 |
+
### My database is not backed up / My backup file is 0Kb
|
122 |
* Ensure that your host allows you to access mysqldump. You can try to narrow the problem by Debugging via SSH:
|
123 |
1. In `wp-dbmanager.php`
|
124 |
2. Find `check_backup_files();` on line 246
|
129 |
7. Copy that line than run it in SSH
|
130 |
8. If you need help on SSH contact your host or google for more info
|
131 |
|
132 |
+
### What is the difference between WP-DBManager and WP-DB-Backup?
|
133 |
* WP-DBManager uses `mysqldump` application to generate the backup and `mysql` application to restore them via shell.
|
134 |
* WP-DB-Backup uses PHP to generate the backup. In some cases WP-DB-Backup will work better for you because it requires less permissions. Not all host allows you to access mysqldump/mysql directly via shell.
|
135 |
* WP-DBManager allows you to have automatic optimizing and repairing of database on top of backing up of database.
|
136 |
|
137 |
+
### Why do I get the message "Warning: Your backup folder MIGHT be visible to the public!"?
|
138 |
* Ensure that you have renamed `htaccess.txt` to `.htaccess` and placed it in your backup folder (defaults to `wp-content/backup-db/`)
|
139 |
* If you are 100% sure you have did that and have verfied that the folder no longer is accessible to the public by visiting the URL `http://yousite.com/wp-content/backup-db/`, you can safely disable the notice by going to `WP-Admin -> Database -> DB Options` and set `Hide Admin Notices` to `Yes`.
|
wp-dbmanager.php
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
Plugin Name: WP-DBManager
|
4 |
Plugin URI: https://lesterchan.net/portfolio/programming/php/
|
5 |
Description: Manages your WordPress database. Allows you to optimize database, repair database, backup database, restore database, delete backup database , drop/empty tables and run selected queries. Supports automatic scheduling of backing up, optimizing and repairing of database.
|
6 |
-
Version: 2.79
|
7 |
Author: Lester 'GaMerZ' Chan
|
8 |
Author URI: https://lesterchan.net
|
9 |
Text Domain: wp-dbmanager
|
@@ -62,36 +62,37 @@ add_action('dbmanager_cron_repair', 'cron_dbmanager_repair');
|
|
62 |
function cron_dbmanager_backup() {
|
63 |
$backup_options = get_option('dbmanager_options');
|
64 |
$backup_email = stripslashes($backup_options['backup_email']);
|
65 |
-
if(
|
66 |
$backup = array();
|
67 |
$backup['date'] = current_time('timestamp');
|
68 |
$backup['mysqldumppath'] = $backup_options['mysqldumppath'];
|
69 |
$backup['mysqlpath'] = $backup_options['mysqlpath'];
|
70 |
$backup['path'] = $backup_options['path'];
|
|
|
71 |
$backup['host'] = DB_HOST;
|
72 |
$backup['port'] = '';
|
73 |
$backup['sock'] = '';
|
74 |
-
if(strpos(DB_HOST, ':') !== false) {
|
75 |
$db_host = explode(':', DB_HOST);
|
76 |
$backup['host'] = $db_host[0];
|
77 |
-
if(
|
78 |
-
$backup['port'] = ' --port=' . escapeshellarg(
|
79 |
} else {
|
80 |
$backup['sock'] = ' --socket=' . escapeshellarg( $db_host[1] );
|
81 |
}
|
82 |
}
|
83 |
$backup['command'] = '';
|
84 |
-
$brace = (
|
85 |
-
if(
|
86 |
$backup['filename'] = $backup['date'].'_-_'.DB_NAME.'.sql.gz';
|
87 |
$backup['filepath'] = $backup['path'].'/'.$backup['filename'];
|
88 |
do_action( 'wp_dbmanager_before_escapeshellcmd' );
|
89 |
-
$backup['command'] = $brace . escapeshellcmd( $backup['mysqldumppath'] ) . $brace . ' --force --host=' . escapeshellarg( $backup['host'] ).' --user=' . escapeshellarg( DB_USER ) . ' --password=' . escapeshellarg( DB_PASSWORD ) . $backup['port'] . $backup['sock'] . ' --add-drop-table --skip-lock-tables ' . DB_NAME . ' | gzip > '. $brace . escapeshellcmd( $backup['filepath'] ) . $brace;
|
90 |
} else {
|
91 |
$backup['filename'] = $backup['date'].'_-_'.DB_NAME.'.sql';
|
92 |
$backup['filepath'] = $backup['path'].'/'.$backup['filename'];
|
93 |
do_action( 'wp_dbmanager_before_escapeshellcmd' );
|
94 |
-
$backup['command'] = $brace . escapeshellcmd( $backup['mysqldumppath'] ) . $brace . ' --force --host=' . escapeshellarg( $backup['host'] ).' --user=' . escapeshellarg( DB_USER ). ' --password=' . escapeshellarg( DB_PASSWORD ) . $backup['port'] . $backup['sock'] . ' --add-drop-table --skip-lock-tables ' . DB_NAME . ' > ' . $brace . escapeshellcmd( $backup['filepath'] ) . $brace;
|
95 |
}
|
96 |
execute_backup($backup['command']);
|
97 |
if( ! empty( $backup_email ) )
|
3 |
Plugin Name: WP-DBManager
|
4 |
Plugin URI: https://lesterchan.net/portfolio/programming/php/
|
5 |
Description: Manages your WordPress database. Allows you to optimize database, repair database, backup database, restore database, delete backup database , drop/empty tables and run selected queries. Supports automatic scheduling of backing up, optimizing and repairing of database.
|
6 |
+
Version: 2.79.1
|
7 |
Author: Lester 'GaMerZ' Chan
|
8 |
Author URI: https://lesterchan.net
|
9 |
Text Domain: wp-dbmanager
|
62 |
function cron_dbmanager_backup() {
|
63 |
$backup_options = get_option('dbmanager_options');
|
64 |
$backup_email = stripslashes($backup_options['backup_email']);
|
65 |
+
if ( (int) $backup_options['backup_period'] > 0 ) {
|
66 |
$backup = array();
|
67 |
$backup['date'] = current_time('timestamp');
|
68 |
$backup['mysqldumppath'] = $backup_options['mysqldumppath'];
|
69 |
$backup['mysqlpath'] = $backup_options['mysqlpath'];
|
70 |
$backup['path'] = $backup_options['path'];
|
71 |
+
$backup['charset'] = ' --default-character-set="utf8"';
|
72 |
$backup['host'] = DB_HOST;
|
73 |
$backup['port'] = '';
|
74 |
$backup['sock'] = '';
|
75 |
+
if ( strpos( DB_HOST, ':' ) !== false ) {
|
76 |
$db_host = explode(':', DB_HOST);
|
77 |
$backup['host'] = $db_host[0];
|
78 |
+
if ( (int) $db_host[1] !== 0 ) {
|
79 |
+
$backup['port'] = ' --port=' . escapeshellarg( (int) $db_host[1] );
|
80 |
} else {
|
81 |
$backup['sock'] = ' --socket=' . escapeshellarg( $db_host[1] );
|
82 |
}
|
83 |
}
|
84 |
$backup['command'] = '';
|
85 |
+
$brace = 0 === strpos( PHP_OS, 'WIN' ) ? '"' : '';
|
86 |
+
if ( (int) $backup_options['backup_gzip'] === 1 ) {
|
87 |
$backup['filename'] = $backup['date'].'_-_'.DB_NAME.'.sql.gz';
|
88 |
$backup['filepath'] = $backup['path'].'/'.$backup['filename'];
|
89 |
do_action( 'wp_dbmanager_before_escapeshellcmd' );
|
90 |
+
$backup['command'] = $brace . escapeshellcmd( $backup['mysqldumppath'] ) . $brace . ' --force --host=' . escapeshellarg( $backup['host'] ).' --user=' . escapeshellarg( DB_USER ) . ' --password=' . escapeshellarg( DB_PASSWORD ) . $backup['port'] . $backup['sock'] . $backup['charset'] . ' --add-drop-table --skip-lock-tables ' . DB_NAME . ' | gzip > '. $brace . escapeshellcmd( $backup['filepath'] ) . $brace;
|
91 |
} else {
|
92 |
$backup['filename'] = $backup['date'].'_-_'.DB_NAME.'.sql';
|
93 |
$backup['filepath'] = $backup['path'].'/'.$backup['filename'];
|
94 |
do_action( 'wp_dbmanager_before_escapeshellcmd' );
|
95 |
+
$backup['command'] = $brace . escapeshellcmd( $backup['mysqldumppath'] ) . $brace . ' --force --host=' . escapeshellarg( $backup['host'] ).' --user=' . escapeshellarg( DB_USER ). ' --password=' . escapeshellarg( DB_PASSWORD ) . $backup['port'] . $backup['sock'] . $backup['charset'] . ' --add-drop-table --skip-lock-tables ' . DB_NAME . ' > ' . $brace . escapeshellcmd( $backup['filepath'] ) . $brace;
|
96 |
}
|
97 |
execute_backup($backup['command']);
|
98 |
if( ! empty( $backup_email ) )
|