WP-DBManager - Version 2.73

Version Description

N/A

Download this release

Release Info

Developer GamerZ
Plugin Icon WP-DBManager
Version 2.73
Comparing to
See all releases

Code changes from version 2.72 to 2.73

Files changed (4) hide show
  1. database-backup.php +5 -4
  2. database-manage.php +4 -4
  3. readme.txt +4 -1
  4. wp-dbmanager.php +5 -5
database-backup.php CHANGED
@@ -33,21 +33,22 @@ if(!empty($_POST['do'])) {
33
  $db_host = explode(':', DB_HOST);
34
  $backup['host'] = $db_host[0];
35
  if(intval($db_host[1]) != 0) {
36
- $backup['port'] = ' --port="'.intval($db_host[1]).'"';
37
  } else {
38
- $backup['sock'] = ' --socket="'.$db_host[1].'"';
39
  }
40
  }
41
  $gzip = intval($_POST['gzip']);
42
  if($gzip == 1) {
43
  $backup['filename'] = $backup['date'].'_-_'.DB_NAME.'.sql.gz';
44
  $backup['filepath'] = $backup['path'].'/'.$backup['filename'];
45
- $backup['command'] = escapeshellcmd( $brace.$backup['mysqldumppath'].$brace.' --force --host="'.$backup['host'].'" --user="'.DB_USER.'" --password="'.$backup['password'].'"'.$backup['port'].$backup['sock'].$backup['charset'].' --add-drop-table --skip-lock-tables '.DB_NAME ).' | gzip > '.escapeshellcmd( $brace.$backup['filepath'].$brace );
46
  } else {
47
  $backup['filename'] = $backup['date'].'_-_'.DB_NAME.'.sql';
48
  $backup['filepath'] = $backup['path'].'/'.$backup['filename'];
49
- $backup['command'] = escapeshellcmd( $brace.$backup['mysqldumppath'].$brace.' --force --host="'.$backup['host'].'" --user="'.DB_USER.'" --password="'.$backup['password'].'"'.$backup['port'].$backup['sock'].$backup['charset'].' --add-drop-table --skip-lock-tables '.DB_NAME ).' > '.escapeshellcmd( $brace.$backup['filepath'].$brace );
50
  }
 
51
  $error = execute_backup($backup['command']);
52
  if(!is_writable($backup['path'])) {
53
  $text = '<p style="color: red;">'.sprintf(__('Database Failed To Backup On \'%s\'. Backup Folder Not Writable.', 'wp-dbmanager'), $current_date).'</p>';
33
  $db_host = explode(':', DB_HOST);
34
  $backup['host'] = $db_host[0];
35
  if(intval($db_host[1]) != 0) {
36
+ $backup['port'] = ' --port=' . escapeshellarg( intval( $db_host[1] ) );
37
  } else {
38
+ $backup['sock'] = ' --socket=' . escapeshellarg( $db_host[1] );
39
  }
40
  }
41
  $gzip = intval($_POST['gzip']);
42
  if($gzip == 1) {
43
  $backup['filename'] = $backup['date'].'_-_'.DB_NAME.'.sql.gz';
44
  $backup['filepath'] = $backup['path'].'/'.$backup['filename'];
45
+ $backup['command'] = escapeshellcmd( $brace . $backup['mysqldumppath'] . $brace ) . ' --force --host=' . escapeshellarg( $backup['host'] ) . ' --user=' . escapeshellarg( DB_USER ) . ' --password=' . escapeshellarg( $backup['password'] ) . $backup['port'] . $backup['sock'] . $backup['charset'] . ' --add-drop-table --skip-lock-tables ' . DB_NAME . ' | gzip > ' . escapeshellcmd( $brace . $backup['filepath'] . $brace );
46
  } else {
47
  $backup['filename'] = $backup['date'].'_-_'.DB_NAME.'.sql';
48
  $backup['filepath'] = $backup['path'].'/'.$backup['filename'];
49
+ $backup['command'] = escapeshellcmd( $brace . $backup['mysqldumppath'] . $brace ) . ' --force --host=' . escapeshellarg( $backup['host'] ) . ' --user=' . escapeshellarg( DB_USER ) . ' --password=' . escapeshellarg( $backup['password'] ) . $backup['port'] . $backup['sock'] . $backup['charset'] . ' --add-drop-table --skip-lock-tables ' . DB_NAME . ' > ' . escapeshellcmd( $brace . $backup['filepath'] . $brace );
50
  }
51
+
52
  $error = execute_backup($backup['command']);
53
  if(!is_writable($backup['path'])) {
54
  $text = '<p style="color: red;">'.sprintf(__('Database Failed To Backup On \'%s\'. Backup Folder Not Writable.', 'wp-dbmanager'), $current_date).'</p>';
database-manage.php CHANGED
@@ -38,15 +38,15 @@ if( !empty( $_POST['do'] ) ) {
38
  $db_host = explode(':', DB_HOST);
39
  $backup['host'] = $db_host[0];
40
  if(intval($db_host[1]) != 0) {
41
- $backup['port'] = ' --port="'.intval($db_host[1]).'"';
42
  } else {
43
- $backup['sock'] = ' --socket="'.$db_host[1].'"';
44
  }
45
  }
46
  if(stristr($database_file, '.gz')) {
47
- $backup['command'] = 'gunzip < '.escapeshellcmd( $brace.$backup['path'].'/'.$database_file.$brace ).' | '.escapeshellcmd( $brace.$backup['mysqlpath'].$brace.' --host="'.$backup['host'].'" --user="'.DB_USER.'" --password="'.$backup['password'].'"'.$backup['port'].$backup['sock'].$backup['charset'].' '.DB_NAME );
48
  } else {
49
- $backup['command'] = escapeshellcmd( $brace.$backup['mysqlpath'].$brace.' --host="'.$backup['host'].'" --user="'.DB_USER.'" --password="'.$backup['password'].'"'.$backup['port'].$backup['sock'].$backup['charset'].' '.DB_NAME ).' < '.escapeshellcmd( $brace.$backup['path'].'/'.$database_file.$brace );
50
  }
51
  if( realpath( $backup['path'] ) === false ) {
52
  $text = '<p style="color: red;">' . sprintf(__('%s is not a valid backup path', 'wp-dbmanager'), stripslashes( $backup['path'] ) ) . '</p>';
38
  $db_host = explode(':', DB_HOST);
39
  $backup['host'] = $db_host[0];
40
  if(intval($db_host[1]) != 0) {
41
+ $backup['port'] = ' --port=' . escapeshellarg( intval( $db_host[1] ) );
42
  } else {
43
+ $backup['sock'] = ' --socket=' . escapeshellarg( $db_host[1] );
44
  }
45
  }
46
  if(stristr($database_file, '.gz')) {
47
+ $backup['command'] = 'gunzip < ' . escapeshellcmd( $brace . $backup['path'] . '/' . $database_file . $brace ) .' | '. escapeshellcmd( $brace . $backup['mysqlpath'] . $brace ) . ' --host=' . escapeshellarg( $backup['host'] ) . ' --user=' . escapeshellarg( DB_USER ) . ' --password=' . escapeshellarg( $backup['password'] ) . $backup['port'] . $backup['sock'] . $backup['charset'] . ' ' . DB_NAME;
48
  } else {
49
+ $backup['command'] = escapeshellcmd( $brace . $backup['mysqlpath'] . $brace ) . ' --host=' . escapeshellarg( $backup['host'] ) . ' --user=' . escapeshellarg( DB_USER ) . ' --password=' . escapeshellarg( $backup['password'] ) . $backup['port'] . $backup['sock'] . $backup['charset'] . ' ' . DB_NAME . ' < '.escapeshellcmd( $brace . $backup['path'] . '/' . $database_file . $brace );
50
  }
51
  if( realpath( $backup['path'] ) === false ) {
52
  $text = '<p style="color: red;">' . sprintf(__('%s is not a valid backup path', 'wp-dbmanager'), stripslashes( $backup['path'] ) ) . '</p>';
readme.txt CHANGED
@@ -4,7 +4,7 @@ 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: 3.9
6
  Tested up to: 4.0
7
- Stable tag: 2.72
8
 
9
  Manages your WordPress database.
10
 
@@ -33,6 +33,9 @@ Allows you to optimize database, repair database, backup database, restore datab
33
  * 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/).
34
 
35
  == Changelog ==
 
 
 
36
  = Version 2.72 =
37
  * FIXED: Uses escapeshellcmd() to escape shell commands. Props Larry W. Cashdollari.
38
  * FIXED: Do not allow LOAD_FILE to be run. Props Larry W. Cashdollari.
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: 3.9
6
  Tested up to: 4.0
7
+ Stable tag: 2.73
8
 
9
  Manages your WordPress database.
10
 
33
  * 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/).
34
 
35
  == Changelog ==
36
+ = Version 2.73 =
37
+ * FIXED: Unable to backup/restore database if user database password has certain special characters in them
38
+
39
  = Version 2.72 =
40
  * FIXED: Uses escapeshellcmd() to escape shell commands. Props Larry W. Cashdollari.
41
  * FIXED: Do not allow LOAD_FILE to be run. Props Larry W. Cashdollari.
wp-dbmanager.php CHANGED
@@ -3,7 +3,7 @@
3
  Plugin Name: WP-DBManager
4
  Plugin URI: http://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.72
7
  Author: Lester 'GaMerZ' Chan
8
  Author URI: http://lesterchan.net
9
  Text Domain: wp-dbmanager
@@ -76,9 +76,9 @@ function cron_dbmanager_backup() {
76
  $db_host = explode(':', DB_HOST);
77
  $backup['host'] = $db_host[0];
78
  if(intval($db_host[1]) != 0) {
79
- $backup['port'] = ' --port="'.intval($db_host[1]).'"';
80
  } else {
81
- $backup['sock'] = ' --socket="'.$db_host[1].'"';
82
  }
83
  }
84
  $backup['command'] = '';
@@ -86,11 +86,11 @@ function cron_dbmanager_backup() {
86
  if(intval($backup_options['backup_gzip']) == 1) {
87
  $backup['filename'] = $backup['date'].'_-_'.DB_NAME.'.sql.gz';
88
  $backup['filepath'] = $backup['path'].'/'.$backup['filename'];
89
- $backup['command'] = escapeshellcmd( $brace.$backup['mysqldumppath'].$brace.' --force --host="'.$backup['host'].'" --user="'.DB_USER.'" --password="'.$backup['password'].'"'.$backup['port'].$backup['sock'].' --add-drop-table --skip-lock-tables '.DB_NAME ). ' | gzip > '.escapeshellcmd( $brace.$backup['filepath'].$brace );
90
  } else {
91
  $backup['filename'] = $backup['date'].'_-_'.DB_NAME.'.sql';
92
  $backup['filepath'] = $backup['path'].'/'.$backup['filename'];
93
- $backup['command'] = escapeshellcmd( $brace.$backup['mysqldumppath'].$brace.' --force --host="'.$backup['host'].'" --user="'.DB_USER.'" --password="'.$backup['password'].'"'.$backup['port'].$backup['sock'].' --add-drop-table --skip-lock-tables '.DB_NAME ). ' > '.escapeshellcmd( $brace.$backup['filepath'].$brace );
94
  }
95
  execute_backup($backup['command']);
96
  if( ! empty( $backup_email ) )
3
  Plugin Name: WP-DBManager
4
  Plugin URI: http://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.73
7
  Author: Lester 'GaMerZ' Chan
8
  Author URI: http://lesterchan.net
9
  Text Domain: wp-dbmanager
76
  $db_host = explode(':', DB_HOST);
77
  $backup['host'] = $db_host[0];
78
  if(intval($db_host[1]) != 0) {
79
+ $backup['port'] = ' --port=' . escapeshellarg( intval( $db_host[1] ) );
80
  } else {
81
+ $backup['sock'] = ' --socket=' . escapeshellarg( $db_host[1] );
82
  }
83
  }
84
  $backup['command'] = '';
86
  if(intval($backup_options['backup_gzip']) == 1) {
87
  $backup['filename'] = $backup['date'].'_-_'.DB_NAME.'.sql.gz';
88
  $backup['filepath'] = $backup['path'].'/'.$backup['filename'];
89
+ $backup['command'] = escapeshellcmd( $brace . $backup['mysqldumppath'] . $brace ) . ' --force --host=' . escapeshellarg( $backup['host'] ).' --user=' . escapeshellarg( DB_USER ) . ' --password=' . escapeshellarg( $backup['password'] ) . $backup['port'] . $backup['sock'] . ' --add-drop-table --skip-lock-tables ' . DB_NAME . ' | gzip > '.escapeshellcmd( $brace . $backup['filepath'] . $brace );
90
  } else {
91
  $backup['filename'] = $backup['date'].'_-_'.DB_NAME.'.sql';
92
  $backup['filepath'] = $backup['path'].'/'.$backup['filename'];
93
+ $backup['command'] = escapeshellcmd( $brace . $backup['mysqldumppath'] . $brace ) . ' --force --host=' . escapeshellarg( $backup['host'] ).' --user=' . escapeshellarg( DB_USER ). ' --password=' . escapeshellarg( $backup['password'] ) . $backup['port'] . $backup['sock'] . ' --add-drop-table --skip-lock-tables ' . DB_NAME . ' > '.escapeshellcmd( $brace . $backup['filepath'] . $brace );
94
  }
95
  execute_backup($backup['command']);
96
  if( ! empty( $backup_email ) )