Version Description
Download this release
Release Info
Developer | GamerZ |
Plugin | WP-DBManager |
Version | 2.80 |
Comparing to | |
See all releases |
Code changes from version 2.79.2 to 2.80
- database-backup.php +5 -4
- database-manage.php +18 -10
- index.php +2 -0
- readme.txt +5 -2
- wp-dbmanager.php +7 -9
database-backup.php
CHANGED
@@ -51,15 +51,16 @@ if(!empty($_POST['do'])) {
|
|
51 |
$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;
|
52 |
}
|
53 |
$error = execute_backup( $backup['command'] );
|
54 |
-
if(!is_writable( $backup['path'] ) ) {
|
55 |
$text = '<p style="color: red;">'.sprintf(__('Database Failed To Backup On \'%s\'. Backup Folder Not Writable.', 'wp-dbmanager'), $current_date).'</p>';
|
56 |
-
} elseif( is_file( $backup['filepath'] ) && filesize( $backup['filepath'] ) === 0 ) {
|
57 |
$text = '<p style="color: red;">'.sprintf(__('Database Failed To Backup On \'%s\'. Backup File Size Is 0KB.', 'wp-dbmanager'), $current_date).'</p>';
|
58 |
-
} elseif( ! is_file( $backup['filepath'] ) ) {
|
59 |
$text = '<p style="color: red;">'.sprintf(__('Database Failed To Backup On \'%s\'. Invalid Backup File Path.', 'wp-dbmanager'), $current_date).'</p>';
|
60 |
-
} elseif( $error ) {
|
61 |
$text = '<p style="color: red;">'.sprintf(__('Database Failed To Backup On \'%s\'.', 'wp-dbmanager'), $current_date).'</p>';
|
62 |
} else {
|
|
|
63 |
$text = '<p style="color: green;">'.sprintf(__('Database Backed Up Successfully On \'%s\'.', 'wp-dbmanager'), $current_date).'</p>';
|
64 |
}
|
65 |
break;
|
51 |
$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;
|
52 |
}
|
53 |
$error = execute_backup( $backup['command'] );
|
54 |
+
if ( ! is_writable( $backup['path'] ) ) {
|
55 |
$text = '<p style="color: red;">'.sprintf(__('Database Failed To Backup On \'%s\'. Backup Folder Not Writable.', 'wp-dbmanager'), $current_date).'</p>';
|
56 |
+
} elseif ( is_file( $backup['filepath'] ) && filesize( $backup['filepath'] ) === 0 ) {
|
57 |
$text = '<p style="color: red;">'.sprintf(__('Database Failed To Backup On \'%s\'. Backup File Size Is 0KB.', 'wp-dbmanager'), $current_date).'</p>';
|
58 |
+
} elseif ( ! is_file( $backup['filepath'] ) ) {
|
59 |
$text = '<p style="color: red;">'.sprintf(__('Database Failed To Backup On \'%s\'. Invalid Backup File Path.', 'wp-dbmanager'), $current_date).'</p>';
|
60 |
+
} elseif ( $error ) {
|
61 |
$text = '<p style="color: red;">'.sprintf(__('Database Failed To Backup On \'%s\'.', 'wp-dbmanager'), $current_date).'</p>';
|
62 |
} else {
|
63 |
+
rename( $backup['filepath'], $backup['path'] . '/' . md5_file( $backup['filepath'] ) . '_-_' . $backup['filename'] );
|
64 |
$text = '<p style="color: green;">'.sprintf(__('Database Backed Up Successfully On \'%s\'.', 'wp-dbmanager'), $current_date).'</p>';
|
65 |
}
|
66 |
break;
|
database-manage.php
CHANGED
@@ -113,6 +113,7 @@ if( !empty( $_POST['do'] ) ) {
|
|
113 |
<thead>
|
114 |
<tr>
|
115 |
<th><?php _e('No.', 'wp-dbmanager'); ?></th>
|
|
|
116 |
<th><?php _e('Database File', 'wp-dbmanager'); ?></th>
|
117 |
<th><?php _e('Date/Time', 'wp-dbmanager'); ?></th>
|
118 |
<th><?php _e('Size', 'wp-dbmanager'); ?></th>
|
@@ -139,23 +140,30 @@ if( !empty( $_POST['do'] ) ) {
|
|
139 |
$style = ' class="alternate"';
|
140 |
}
|
141 |
$no++;
|
142 |
-
$
|
143 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
144 |
$size_text = filesize($backup['path'].'/'.$database_files[$i]);
|
145 |
-
echo
|
146 |
-
echo '<td>'.number_format_i18n($no).'</td>';
|
147 |
-
echo
|
148 |
-
echo
|
149 |
-
echo '<td>'.
|
150 |
-
echo
|
|
|
151 |
$totalsize += $size_text;
|
152 |
}
|
153 |
} else {
|
154 |
-
echo '<tr><td align="center" colspan="
|
155 |
}
|
156 |
?>
|
157 |
<tr class="thead">
|
158 |
-
<th colspan="
|
159 |
<th><?php echo format_size($totalsize); ?></th>
|
160 |
<th> </th>
|
161 |
</tr>
|
113 |
<thead>
|
114 |
<tr>
|
115 |
<th><?php _e('No.', 'wp-dbmanager'); ?></th>
|
116 |
+
<th><?php _e('MD5 Checksum', 'wp-dbmanager'); ?></th>
|
117 |
<th><?php _e('Database File', 'wp-dbmanager'); ?></th>
|
118 |
<th><?php _e('Date/Time', 'wp-dbmanager'); ?></th>
|
119 |
<th><?php _e('Size', 'wp-dbmanager'); ?></th>
|
140 |
$style = ' class="alternate"';
|
141 |
}
|
142 |
$no++;
|
143 |
+
$file_parts = explode( '_-_', $database_files[$i] );
|
144 |
+
if ( count( $file_parts ) > 2 ) {
|
145 |
+
list( $checksum_text, $date, $database_text ) = $file_parts;
|
146 |
+
} else {
|
147 |
+
$checksum_text = '-';
|
148 |
+
list( $date, $database_text ) = $file_parts;
|
149 |
+
}
|
150 |
+
$date_text = mysql2date( sprintf( __( '%s @ %s', 'wp-dbmanager' ), get_option( 'date_format' ), get_option( 'time_format' ) ), gmdate( 'Y-m-d H:i:s', $date));
|
151 |
$size_text = filesize($backup['path'].'/'.$database_files[$i]);
|
152 |
+
echo '<tr'. $style .'>';
|
153 |
+
echo '<td>' . number_format_i18n( $no ) . '</td>';
|
154 |
+
echo '<td>' . $checksum_text . '</td>';
|
155 |
+
echo '<td>' . $database_text .'</td>';
|
156 |
+
echo '<td>' . $date_text . '</td>';
|
157 |
+
echo '<td>' . format_size( $size_text ) . '</td>';
|
158 |
+
echo '<td><input type="radio" name="database_file" value="'. esc_attr( $database_files[$i] ) .'" /></td></tr>';
|
159 |
$totalsize += $size_text;
|
160 |
}
|
161 |
} else {
|
162 |
+
echo '<tr><td align="center" colspan="6">'.__('There Are No Database Backup Files Available.', 'wp-dbmanager').'</td></tr>';
|
163 |
}
|
164 |
?>
|
165 |
<tr class="thead">
|
166 |
+
<th colspan="4"><?php printf(_n('%s Backup File', '%s Backup Files', $no, 'wp-dbmanager'), number_format_i18n($no)); ?></th>
|
167 |
<th><?php echo format_size($totalsize); ?></th>
|
168 |
<th> </th>
|
169 |
</tr>
|
index.php
CHANGED
@@ -0,0 +1,2 @@
|
|
|
|
|
1 |
+
<?php
|
2 |
+
// Silence is golden.
|
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: 4.0
|
6 |
-
Tested up to:
|
7 |
-
Stable tag: 2.
|
8 |
|
9 |
Manages your WordPress database.
|
10 |
|
@@ -42,6 +42,9 @@ Allows you to optimize database, repair database, backup database, restore datab
|
|
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.2
|
46 |
* FIXED: Arbitrary file delete bug by sanitizing filename. Props [RIPS Technologies](https://www.ripstech.com).
|
47 |
|
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: 5.3
|
7 |
+
Stable tag: 2.80
|
8 |
|
9 |
Manages your WordPress database.
|
10 |
|
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.80
|
46 |
+
* NEW: Prefix MD5 checksum to the database backup file to prevent user from guessing the filename.
|
47 |
+
|
48 |
### Version 2.79.2
|
49 |
* FIXED: Arbitrary file delete bug by sanitizing filename. Props [RIPS Technologies](https://www.ripstech.com).
|
50 |
|
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.
|
7 |
Author: Lester 'GaMerZ' Chan
|
8 |
Author URI: https://lesterchan.net
|
9 |
Text Domain: wp-dbmanager
|
@@ -11,7 +11,7 @@ Text Domain: wp-dbmanager
|
|
11 |
|
12 |
|
13 |
/*
|
14 |
-
Copyright
|
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
|
@@ -101,13 +101,13 @@ function cron_dbmanager_backup() {
|
|
101 |
do_action( 'wp_dbmanager_before_escapeshellcmd' );
|
102 |
$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;
|
103 |
}
|
104 |
-
execute_backup($backup['command']);
|
105 |
-
|
106 |
-
|
107 |
-
|
|
|
108 |
}
|
109 |
}
|
110 |
-
return;
|
111 |
}
|
112 |
function cron_dbmanager_optimize() {
|
113 |
global $wpdb;
|
@@ -121,7 +121,6 @@ function cron_dbmanager_optimize() {
|
|
121 |
}
|
122 |
$wpdb->query('OPTIMIZE TABLE '.implode(',', $optimize_tables));
|
123 |
}
|
124 |
-
return;
|
125 |
}
|
126 |
function cron_dbmanager_repair() {
|
127 |
global $wpdb;
|
@@ -135,7 +134,6 @@ function cron_dbmanager_repair() {
|
|
135 |
}
|
136 |
$wpdb->query('REPAIR TABLE '.implode(',', $repair_tables));
|
137 |
}
|
138 |
-
return;
|
139 |
}
|
140 |
function cron_dbmanager_reccurences($schedules) {
|
141 |
$backup_options = get_option( 'dbmanager_options' );
|
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.80
|
7 |
Author: Lester 'GaMerZ' Chan
|
8 |
Author URI: https://lesterchan.net
|
9 |
Text Domain: wp-dbmanager
|
11 |
|
12 |
|
13 |
/*
|
14 |
+
Copyright 2019 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
|
101 |
do_action( 'wp_dbmanager_before_escapeshellcmd' );
|
102 |
$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;
|
103 |
}
|
104 |
+
execute_backup( $backup['command'] );
|
105 |
+
$new_filepath = $backup['path'] . '/' . md5_file( $backup['filepath'] ) . '_-_' . $backup['filename'];
|
106 |
+
rename( $backup['filepath'], $new_filepath );
|
107 |
+
if ( ! empty( $backup_email ) ) {
|
108 |
+
dbmanager_email_backup( $backup_email, $new_filepath );
|
109 |
}
|
110 |
}
|
|
|
111 |
}
|
112 |
function cron_dbmanager_optimize() {
|
113 |
global $wpdb;
|
121 |
}
|
122 |
$wpdb->query('OPTIMIZE TABLE '.implode(',', $optimize_tables));
|
123 |
}
|
|
|
124 |
}
|
125 |
function cron_dbmanager_repair() {
|
126 |
global $wpdb;
|
134 |
}
|
135 |
$wpdb->query('REPAIR TABLE '.implode(',', $repair_tables));
|
136 |
}
|
|
|
137 |
}
|
138 |
function cron_dbmanager_reccurences($schedules) {
|
139 |
$backup_options = get_option( 'dbmanager_options' );
|