WP-DBManager - Version 2.76

Version Description

N/A

Download this release

Release Info

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

Code changes from version 2.75 to 2.76

Files changed (4) hide show
  1. database-backup.php +3 -0
  2. database-manage.php +2 -0
  3. readme.txt +14 -11
  4. wp-dbmanager.php +6 -4
database-backup.php CHANGED
@@ -38,13 +38,16 @@ if(!empty($_POST['do'])) {
38
  }
39
  }
40
  $gzip = intval($_POST['gzip']);
 
41
  if($gzip == 1) {
42
  $backup['filename'] = $backup['date'].'_-_'.DB_NAME.'.sql.gz';
43
  $backup['filepath'] = $backup['path'].'/'.$backup['filename'];
 
44
  $backup['command'] = escapeshellcmd( $brace . $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 > ' . escapeshellcmd( $brace . $backup['filepath'] . $brace );
45
  } else {
46
  $backup['filename'] = $backup['date'].'_-_'.DB_NAME.'.sql';
47
  $backup['filepath'] = $backup['path'].'/'.$backup['filename'];
 
48
  $backup['command'] = escapeshellcmd( $brace . $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 . ' > ' . escapeshellcmd( $brace . $backup['filepath'] . $brace );
49
  }
50
  $error = execute_backup( $backup['command'] );
38
  }
39
  }
40
  $gzip = intval($_POST['gzip']);
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' );
46
  $backup['command'] = escapeshellcmd( $brace . $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 > ' . escapeshellcmd( $brace . $backup['filepath'] . $brace );
47
  } else {
48
  $backup['filename'] = $backup['date'].'_-_'.DB_NAME.'.sql';
49
  $backup['filepath'] = $backup['path'].'/'.$backup['filename'];
50
+ do_action( 'wp_dbmanager_before_escapeshellcmd' );
51
  $backup['command'] = escapeshellcmd( $brace . $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 . ' > ' . escapeshellcmd( $brace . $backup['filepath'] . $brace );
52
  }
53
  $error = execute_backup( $backup['command'] );
database-manage.php CHANGED
@@ -43,8 +43,10 @@ if( !empty( $_POST['do'] ) ) {
43
  }
44
  }
45
  if(stristr($database_file, '.gz')) {
 
46
  $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( DB_PASSWORD ) . $backup['port'] . $backup['sock'] . $backup['charset'] . ' ' . DB_NAME;
47
  } else {
 
48
  $backup['command'] = escapeshellcmd( $brace . $backup['mysqlpath'] . $brace ) . ' --host=' . escapeshellarg( $backup['host'] ) . ' --user=' . escapeshellarg( DB_USER ) . ' --password=' . escapeshellarg( DB_PASSWORD ) . $backup['port'] . $backup['sock'] . $backup['charset'] . ' ' . DB_NAME . ' < '.escapeshellcmd( $brace . $backup['path'] . '/' . $database_file . $brace );
49
  }
50
  if( realpath( $backup['path'] ) === false ) {
43
  }
44
  }
45
  if(stristr($database_file, '.gz')) {
46
+ do_action( 'wp_dbmanager_before_escapeshellcmd' );
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( DB_PASSWORD ) . $backup['port'] . $backup['sock'] . $backup['charset'] . ' ' . DB_NAME;
48
  } else {
49
+ do_action( 'wp_dbmanager_before_escapeshellcmd' );
50
  $backup['command'] = escapeshellcmd( $brace . $backup['mysqlpath'] . $brace ) . ' --host=' . escapeshellarg( $backup['host'] ) . ' --user=' . escapeshellarg( DB_USER ) . ' --password=' . escapeshellarg( DB_PASSWORD ) . $backup['port'] . $backup['sock'] . $backup['charset'] . ' ' . DB_NAME . ' < '.escapeshellcmd( $brace . $backup['path'] . '/' . $database_file . $brace );
51
  }
52
  if( realpath( $backup['path'] ) === false ) {
readme.txt CHANGED
@@ -3,8 +3,8 @@ 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: 3.9
6
- Tested up to: 4.1
7
- Stable tag: 2.75
8
 
9
  Manages your WordPress database.
10
 
@@ -24,7 +24,7 @@ Allows you to optimize database, repair database, backup database, restore datab
24
  * Plugin icon by [Freepik](http://www.freepik.com) from [Flaticon](http://www.flaticon.com)
25
 
26
  = Donations =
27
- * 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 appericiate it. If not feel free to use it without any obligations.
28
 
29
  = Disclaimer =
30
  * 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.
@@ -33,6 +33,10 @@ 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.75 =
37
  * FIXED: When activating the plugin, copy index.php to the backup folder
38
  * 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
@@ -165,13 +169,12 @@ Allows you to optimize database, repair database, backup database, restore datab
165
  1. Open `wp-content/plugins` Folder
166
  2. Put: `Folder: wp-dbmanager`
167
  3. Activate `WP-DBManager` Plugin
168
- 4. Rename `htaccess.txt` to `.htaccess` file in `Folder: wp-content/plugins/wp-dbmanager`
169
- 5. 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
170
- 6. Open `Folder: wp-content/backup-db`
171
- 7. If you are on Apache, move the `htaccess.txt` file from `Folder: wp-content/plugins/wp-dbmanager` to `Folder: wp-content/backup-db/.htaccess` if it is not there already
172
- 8. If you are on IIS, move the `Web.config.txt` file from `Folder: wp-content/plugins/wp-dbmanager` to `Folder: wp-content/backup-db/Web.config` if it is not there already
173
- 9. 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
174
- 10. Go to `WP-Admin -> Database -> DB Options` to configure the database options
175
 
176
  == Upgrading ==
177
 
@@ -202,7 +205,7 @@ N/A
202
  = My database is not backed up / My backup file is 0Kb =
203
  * Ensure that your host allows you to access mysqldump. You can try to narrow the problem by Debugging via SSH:
204
  1. In `wp-dbmanager.php`
205
- 2. Find `check_backup_files();` on line 210
206
  3. Add below it `echo $command;`
207
  4. Go to `WP-Admin -> Database -> Backup`
208
  5. Click `Backup`
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: 3.9
6
+ Tested up to: 4.2
7
+ Stable tag: 2.76
8
 
9
  Manages your WordPress database.
10
 
24
  * Plugin icon by [Freepik](http://www.freepik.com) from [Flaticon](http://www.flaticon.com)
25
 
26
  = Donations =
27
+ * 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.
28
 
29
  = Disclaimer =
30
  * 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.
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.76 =
37
+ * NEW: Add wp_dbmanager_before_escapeshellcmd action just before escapeshellcmd()
38
+ * FIXED: Missing / for Windows
39
+
40
  = Version 2.75 =
41
  * FIXED: When activating the plugin, copy index.php to the backup folder
42
  * 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
169
  1. Open `wp-content/plugins` Folder
170
  2. Put: `Folder: wp-dbmanager`
171
  3. Activate `WP-DBManager` Plugin
172
+ 4. 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
173
+ 5. Open `Folder: wp-content/backup-db`
174
+ 6. If you are on Apache, move the `htaccess.txt` file from `Folder: wp-content/plugins/wp-dbmanager` to `Folder: wp-content/backup-db/.htaccess` if it is not there already
175
+ 7. If you are on IIS, move the `Web.config.txt` file from `Folder: wp-content/plugins/wp-dbmanager` to `Folder: wp-content/backup-db/Web.config` if it is not there already
176
+ 8. 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
177
+ 9. Go to `WP-Admin -> Database -> DB Options` to configure the database options
 
178
 
179
  == Upgrading ==
180
 
205
  = My database is not backed up / My backup file is 0Kb =
206
  * Ensure that your host allows you to access mysqldump. You can try to narrow the problem by Debugging via SSH:
207
  1. In `wp-dbmanager.php`
208
+ 2. Find `check_backup_files();` on line 230
209
  3. Add below it `echo $command;`
210
  4. Go to `WP-Admin -> Database -> Backup`
211
  5. Click `Backup`
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.75
7
  Author: Lester 'GaMerZ' Chan
8
  Author URI: http://lesterchan.net
9
  Text Domain: wp-dbmanager
@@ -11,7 +11,7 @@ Text Domain: wp-dbmanager
11
 
12
 
13
  /*
14
- Copyright 2014 Lester Chan (email : lesterchan@gmail.com)
15
 
16
  This program is free software; you can redistribute it and/or modify
17
  it under the terms of the GNU General Public License as published by
@@ -85,10 +85,12 @@ function cron_dbmanager_backup() {
85
  if(intval($backup_options['backup_gzip']) == 1) {
86
  $backup['filename'] = $backup['date'].'_-_'.DB_NAME.'.sql.gz';
87
  $backup['filepath'] = $backup['path'].'/'.$backup['filename'];
 
88
  $backup['command'] = escapeshellcmd( $brace . $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 > '.escapeshellcmd( $brace . $backup['filepath'] . $brace );
89
  } else {
90
  $backup['filename'] = $backup['date'].'_-_'.DB_NAME.'.sql';
91
  $backup['filepath'] = $backup['path'].'/'.$backup['filename'];
 
92
  $backup['command'] = escapeshellcmd( $brace . $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 . ' > '.escapeshellcmd( $brace . $backup['filepath'] . $brace );
93
  }
94
  execute_backup($backup['command']);
@@ -196,8 +198,8 @@ function detect_mysql() {
196
  $mysql_install = $wpdb->get_row("SHOW VARIABLES LIKE 'basedir'");
197
  if($mysql_install) {
198
  $install_path = str_replace('\\', '/', $mysql_install->Value);
199
- $paths['mysql'] = $install_path.'bin/mysql.exe';
200
- $paths['mysqldump'] = $install_path.'bin/mysqldump.exe';
201
  } else {
202
  $paths['mysql'] = 'mysql.exe';
203
  $paths['mysqldump'] = 'mysqldump.exe';
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.76
7
  Author: Lester 'GaMerZ' Chan
8
  Author URI: http://lesterchan.net
9
  Text Domain: wp-dbmanager
11
 
12
 
13
  /*
14
+ Copyright 2015 Lester Chan (email : lesterchan@gmail.com)
15
 
16
  This program is free software; you can redistribute it and/or modify
17
  it under the terms of the GNU General Public License as published by
85
  if(intval($backup_options['backup_gzip']) == 1) {
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'] = escapeshellcmd( $brace . $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 > '.escapeshellcmd( $brace . $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'] = escapeshellcmd( $brace . $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 . ' > '.escapeshellcmd( $brace . $backup['filepath'] . $brace );
95
  }
96
  execute_backup($backup['command']);
198
  $mysql_install = $wpdb->get_row("SHOW VARIABLES LIKE 'basedir'");
199
  if($mysql_install) {
200
  $install_path = str_replace('\\', '/', $mysql_install->Value);
201
+ $paths['mysql'] = $install_path.'/bin/mysql.exe';
202
+ $paths['mysqldump'] = $install_path.'/bin/mysqldump.exe';
203
  } else {
204
  $paths['mysql'] = 'mysql.exe';
205
  $paths['mysqldump'] = 'mysqldump.exe';