├── .editorconfig
├── .travis.yml
├── README.md
├── Web.config.txt
├── database-backup.php
├── database-empty.php
├── database-manage.php
├── database-manager.php
├── database-optimize.php
├── database-repair.php
├── database-run.php
├── htaccess.txt
├── index.php
├── uninstall.php
├── wp-dbmanager.php
└── wp-dbmanager.pot
/.editorconfig:
--------------------------------------------------------------------------------
1 | # This file is for unifying the coding style for different editors and IDEs
2 | # editorconfig.org
3 |
4 | # WordPress Coding Standards
5 | # https://make.wordpress.org/core/handbook/coding-standards/
6 |
7 | root = true
8 |
9 | [*]
10 | charset = utf-8
11 | end_of_line = lf
12 | insert_final_newline = true
13 | trim_trailing_whitespace = true
14 | indent_style = tab
15 |
16 | [{.jshintrc,*.json,*.yml}]
17 | indent_style = space
18 | indent_size = 2
19 |
20 | [{*.txt,wp-config-sample.php}]
21 | end_of_line = crlf
--------------------------------------------------------------------------------
/.travis.yml:
--------------------------------------------------------------------------------
1 | language: php
2 | php:
3 | - "7.3"
4 | - "7.2"
5 | - "7.1"
6 | - "7.0"
7 | - "5.6"
8 |
9 | script:
10 | - find . \( -name '*.php' \) -exec php -lf {} \;
11 |
12 | notifications:
13 | email: false
14 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
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: 6.7
7 | Stable tag: 2.80.10
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`
18 | 1. 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
19 | 1. 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
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 | [](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.80.10
46 | * FIXED: Don't throw fatal error if unknown .sql files are inside the database backup folder.
47 |
48 | ### Version 2.80.9
49 | * FIXED: Handle folder permissions properly
50 |
51 | ### Version 2.80.8
52 | * FIXED: Miss out database-backup.php.
53 |
54 | ### Version 2.80.7
55 | * FIXED: Changed 'edit_files' capability to 'install_plugins' instead.
56 |
57 | ### Version 2.80.6
58 | * FIXED: Remove 'manage_database' and use 'edit_files' to check for capability instead.
59 |
60 | ### Version 2.80.5
61 | * FIXED: Changed utf8 to utf8mb4 for backing up
62 |
63 | ### Version 2.80.4
64 | * FIXED: Clear WP-DBManager cron jobs on uninstall
65 |
66 | ### Version 2.80.3
67 | * FIXED: Poly fill array_key_first() for PHP < 7.3
68 |
69 | ### Version 2.80.2
70 | * FIXED: Newer backup is being replaced instead of older backup
71 |
72 | ### Version 2.80.1
73 | * FIXED: 1970 date issues.
74 | * FIXED: Sorting order of backup files.
75 |
76 | ### Version 2.80
77 | * NEW: Prefix MD5 checksum to the database backup file to prevent user from guessing the filename.
78 |
79 | ### Version 2.79.2
80 | * FIXED: Arbitrary file delete bug by sanitizing filename. Props [RIPS Technologies](https://www.ripstech.com).
81 |
82 | ### Version 2.79.1
83 | * FIXED: Added default utf8 charset
84 |
85 | ### Version 2.79
86 | * FIXED: Proper check for disabled functions
87 |
88 | ### Version 2.78.1
89 | * NEW: Bump WordPress 4.7
90 | * FIXED: Undefined index: repair and repair_period
91 |
92 | ### Version 2.78
93 | * FIXED: escapeshellcmd on Windows. Props Gregory Karpinsky.
94 | * FIXED: Move wp_mkdir_p() up before if check. Props Scott Allen.
95 |
96 | ### Version 2.77
97 | * FIXED: Blank screen downloading backup
98 | * FIXED: Remove MySQL Version check to display tables stats
99 |
100 | ### Version 2.76
101 | * NEW: Add wp_dbmanager_before_escapeshellcmd action just before escapeshellcmd()
102 | * FIXED: Missing / for Windows
103 |
104 | ### Version 2.75
105 | * FIXED: When activating the plugin, copy index.php to the backup folder
106 | * 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
107 | * FIXED: When choosing 1 Month(s) for Backup/Optimize/Repair, the next date calculation is wrong
108 |
109 | ### Version 2.74
110 | * FIXED: escapeshellarg() already escape $, no need to double escape it
111 |
112 | ### Version 2.73
113 | * FIXED: Unable to backup/restore database if user database password has certain special characters in them
114 |
115 | ### Version 2.72
116 | * FIXED: Use escapeshellcmd() to escape shell commands. Props Larry W. Cashdollari.
117 | * FIXED: Do not allow LOAD_FILE to be run. Props Larry W. Cashdollari.
118 | * FIXED: Uses dbmanager_is_valid_path() to check for mysql and mysqldump path. Fixes arbitrary command injection using backup path. Props Larry W. Cashdollari.
119 | * FIXED: Uses realpath() to check for backup path. Fixes arbitrary command injection using backup path. Props Larry W. Cashdollari.
120 |
121 | ### Version 2.71
122 | * NEW: Bump to 4.0
123 |
124 | ### Version 2.70
125 | * New: Uses WordPress 3.9 Dashicons
126 | * NEW: Allow you to hide admin notices in the DB Options page
127 | * NEW: Allow Multisite Network Activate
128 | * NEW: Uses WordPress uninstall.php file to uninstall the plugin
129 | * NEW: Uses wp_mail() to send email instead of PHP mail()
130 | * NEW: New From E-mail, From Name & Subject template
131 | * FIXED: Issues with email from field if site title contains , (comma)
132 | * FIXED: Notices
133 |
134 | ### Version 2.65
135 | * FIXED: Set default character set to UTF-8. Props Karsonito
136 |
137 | ### Version 2.64
138 | * FIXED: Use intval() instead of is_int() when checking for port number. Props [Webby Scots](http://webbyscots.com/ "Webby Scots")
139 |
140 | ### Version 2.63 (03-05-2011)
141 | * NEW: Added Auto Repair Functionality
142 | * NEW: Added nonce To All Forms For Added Security
143 |
144 | ## Screenshots
145 |
146 | 1. Admin - Backup DB
147 | 2. Admin - Empty/Drop Tables In DB
148 | 3. Admin - DB Information
149 | 4. Admin - Manage DB
150 | 5. Admin - Optimize DB
151 | 6. Admin - DB Options
152 | 7. Admin - DB Options
153 | 8. Admin - Repair DB
154 | 9. Admin - Run Query in DB
155 |
156 | ## Frequently Asked Questions
157 |
158 | ### My database is not backed up / My backup file is 0Kb
159 | * Ensure that your host allows you to access mysqldump. You can try to narrow the problem by Debugging via SSH:
160 | 1. In `wp-dbmanager.php`
161 | 2. Find `check_backup_files();` on line 246
162 | 3. Add below it `echo $command;`
163 | 4. Go to `WP-Admin -> Database -> Backup`
164 | 5. Click `Backup`
165 | 6. It should print some debugging statements
166 | 7. Copy that line than run it in SSH
167 | 8. If you need help on SSH contact your host or google for more info
168 |
169 | ### What is the difference between WP-DBManager and WP-DB-Backup?
170 | * WP-DBManager uses `mysqldump` application to generate the backup and `mysql` application to restore them via shell.
171 | * 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.
172 | * WP-DBManager allows you to have automatic optimizing and repairing of database on top of backing up of database.
173 |
174 | ### Why do I get the message "Warning: Your backup folder MIGHT be visible to the public!"?
175 | * Ensure that you have renamed `htaccess.txt` to `.htaccess` and placed it in your backup folder (defaults to `wp-content/backup-db/`)
176 | * 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`.
177 |
--------------------------------------------------------------------------------
/Web.config.txt:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
--------------------------------------------------------------------------------
/database-backup.php:
--------------------------------------------------------------------------------
1 | ' . $brace . escapeshellcmd( $backup['filepath'] ) . $brace;
47 | } else {
48 | $backup['filepath'] = $backup['path'] . '/' . $backup['filename'];
49 | do_action( 'wp_dbmanager_before_escapeshellcmd' );
50 | $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;
51 | }
52 | $error = execute_backup( $backup['command'] );
53 | if ( ! is_writable( $backup['path'] ) ) {
54 | $text = '
'.sprintf(__('Database Failed To Backup On \'%s\'. Backup Folder Not Writable.', 'wp-dbmanager'), $current_date).'
';
55 | } elseif ( is_file( $backup['filepath'] ) && filesize( $backup['filepath'] ) === 0 ) {
56 | $text = ''.sprintf(__('Database Failed To Backup On \'%s\'. Backup File Size Is 0KB.', 'wp-dbmanager'), $current_date).'
';
57 | } elseif ( ! is_file( $backup['filepath'] ) ) {
58 | $text = ''.sprintf(__('Database Failed To Backup On \'%s\'. Invalid Backup File Path.', 'wp-dbmanager'), $current_date).'
';
59 | } elseif ( $error ) {
60 | $text = ''.sprintf(__('Database Failed To Backup On \'%s\'.', 'wp-dbmanager'), $current_date).'
';
61 | } else {
62 | rename( $backup['filepath'], $backup['path'] . '/' . md5_file( $backup['filepath'] ) . '_-_' . $backup['filename'] );
63 | $text = ''.sprintf(__('Database Backed Up Successfully On \'%s\'.', 'wp-dbmanager'), $current_date).'
';
64 | }
65 | break;
66 | }
67 | }
68 |
69 | ### Backup File Name
70 | $backup['filename'] = $backup['date'].'_-_'.DB_NAME.'.sql';
71 | $backup_path = stripslashes( $backup['path'] );
72 |
73 | ### MYSQL Base Dir
74 | $has_error = false;
75 | $disabled_function = false;
76 | ?>
77 | '.$text.''; } ?>
78 |
79 |
80 |
81 |
82 |
83 | ' . sprintf( __( 'Web.config is missing from %s', 'wp-dbmanager' ), $backup_path ) . '
';
87 | $has_error = true;
88 | } else {
89 | echo '
' . sprintf( __( 'Web.config is present in %s', 'wp-dbmanager' ), $backup_path ) . '
';
90 | }
91 | } else {
92 | if( ! is_file( $backup_path . '/.htaccess' ) ) {
93 | echo '
' . sprintf( __( '.htaccess is missing from %s', 'wp-dbmanager' ), $backup_path ) . '
';
94 | $has_error = true;
95 | } else {
96 | echo '
' . sprintf( __( '.htaccess is present in %s', 'wp-dbmanager' ), $backup_path ) . '
';
97 | }
98 | }
99 | if( ! is_file( $backup_path . '/index.php' ) ) {
100 | echo '
' . sprintf( __( 'index.php is missing from %s', 'wp-dbmanager' ), $backup_path ) . '
';
101 | $has_error = true;
102 | } else {
103 | echo '
' . sprintf( __( 'index.php is present in %s', 'wp-dbmanager' ), $backup_path ) . '
';
104 | }
105 | ?>
106 |
107 |
108 |
109 | ( ) ...
110 | ' . sprintf( __( '%s is not a valid backup path', 'wp-dbmanager' ), $backup_path ) . '
';
113 | $has_error = true;
114 | } else {
115 | if ( @is_dir( $backup_path ) ) {
116 | echo '
' . __('Backup folder exists', 'wp-dbmanager') . '
';
117 | } else {
118 | echo '
' . sprintf(__('Backup folder does NOT exist. Please create \'backup-db\' folder in \'%s\' folder and CHMOD it to \'777\' or change the location of the backup folder under DB Option.', 'wp-dbmanager'), WP_CONTENT_DIR) . '
';
119 | $has_error = true;
120 | }
121 | if ( @is_writable( $backup_path ) ) {
122 | echo '
' . __('Backup folder is writable', 'wp-dbmanager') . '
';
123 | } else {
124 | echo '
' . __('Backup folder is NOT writable. Please CHMOD it to \'777\'.', 'wp-dbmanager') . '
';
125 | $has_error = true;
126 | }
127 | }
128 | ?>
129 |
130 |
131 | ' . sprintf( __( '%s is not a valid backup mysqldump path', 'wp-dbmanager' ), stripslashes( $backup['mysqldumppath'] ) ) . '
';
134 | $has_error = true;
135 | } else {
136 | if ( @file_exists( stripslashes( $backup['mysqldumppath'] ) ) ) {
137 | echo __('Checking MYSQL Dump Path', 'wp-dbmanager') . '
(' . stripslashes( $backup['mysqldumppath'] ) . ' ) ...
';
138 | echo '
' . __('MYSQL dump path exists.', 'wp-dbmanager') . '
';
139 | } else {
140 | echo __('Checking MYSQL Dump Path', 'wp-dbmanager') . ' ...
';
141 | echo '
' . __('MYSQL dump path does NOT exist. Please check your mysqldump path under DB Options. If uncertain, contact your server administrator.', 'wp-dbmanager') . '
';
142 | $has_error = true;
143 | }
144 | }
145 | ?>
146 |
147 |
148 | ' . sprintf( __( '%s is not a valid backup mysql path', 'wp-dbmanager' ), stripslashes( $backup['mysqlpath'] ) ) . '
';
151 | $has_error = true;
152 | } else {
153 | if ( @file_exists( stripslashes($backup['mysqlpath'] ) ) ) {
154 | echo __('Checking MYSQL Path', 'wp-dbmanager') . '
(' . stripslashes($backup['mysqlpath']) . ' ) ...
';
155 | echo '
' . __('MYSQL path exists.', 'wp-dbmanager') . '
';
156 | } else {
157 | echo __('Checking MYSQL Path', 'wp-dbmanager') . ' ...
';
158 | echo '
' . __('MYSQL path does NOT exist. Please check your mysql path under DB Options. If uncertain, contact your server administrator.', 'wp-dbmanager') . '
';
159 | $has_error = true;
160 | }
161 | }
162 | ?>
163 |
164 |
165 | (passthru() , system() exec() ) ...
166 | passthru() '.__('disabled', 'wp-dbmanager').'.
';
169 | $disabled_function = true;
170 | } else if( ! function_exists( 'passthru' ) ) {
171 | echo '
passthru() '.__('missing', 'wp-dbmanager').'.
';
172 | $disabled_function = true;
173 | } else {
174 | echo '
passthru() '.__('enabled', 'wp-dbmanager').'.
';
175 | }
176 | if( dbmanager_is_function_disabled( 'system' ) ) {
177 | echo '
system() '.__('disabled', 'wp-dbmanager').'.
';
178 | $disabled_function = true;
179 | } else if( ! function_exists( 'system' ) ) {
180 | echo '
system() '.__('missing', 'wp-dbmanager').'.
';
181 | $disabled_function = true;
182 | } else {
183 | echo '
system() '.__('enabled', 'wp-dbmanager').'.
';
184 | }
185 | if( dbmanager_is_function_disabled( 'exec' ) ) {
186 | echo '
exec() '.__('disabled', 'wp-dbmanager').'.
';
187 | $disabled_function = true;
188 | } else if( ! function_exists( 'exec' ) ) {
189 | echo '
exec() '.__('missing', 'wp-dbmanager').'.
';
190 | $disabled_function = true;
191 | } else {
192 | echo '
exec() '.__('enabled', 'wp-dbmanager').'.
';
193 | }
194 | ?>
195 |
196 |
197 |
' . __( 'I\'m sorry, your server administrator has disabled passthru(), system() and/or exec(), thus you cannot use this plugin. Please find an alternative plugin.', 'wp-dbmanager' ) . '
';
200 | } else if( ! $has_error ) {
201 | echo '
'.__('Excellent. You Are Good To Go.', 'wp-dbmanager').'
';
202 | } else {
203 | echo '
'.__('Please Rectify The Error Highlighted In Red Before Proceeding On.', 'wp-dbmanager').'
';
204 | }
205 | ?>
206 |
207 |
208 |
209 |
210 |
256 |
--------------------------------------------------------------------------------
/database-empty.php:
--------------------------------------------------------------------------------
1 | $value) {
33 | if($value == 'empty') {
34 | $empty_tables[] = $key;
35 | } elseif($value == 'drop') {
36 | $drop_tables .= ', '.$key;
37 | }
38 | }
39 | } else {
40 | $text = ''.__('No Tables Selected.', 'wp-dbmanager').'
';
41 | }
42 | $drop_tables = substr($drop_tables, 2);
43 | if(!empty($empty_tables)) {
44 | foreach($empty_tables as $empty_table) {
45 | $empty_query = $wpdb->query("TRUNCATE $empty_table");
46 | $text .= ''.sprintf(__('Table \'%s\' Emptied', 'wp-dbmanager'), $empty_table).'
';
47 | }
48 | }
49 | if(!empty($drop_tables)) {
50 | $drop_query = $wpdb->query("DROP TABLE $drop_tables");
51 | $text = ''.sprintf(__('Table(s) \'%s\' Dropped', 'wp-dbmanager'), $drop_tables).'
';
52 | }
53 | break;
54 | }
55 | }
56 |
57 |
58 | ### Show Tables
59 | $tables = $wpdb->get_col("SHOW TABLES");
60 | ?>
61 | '; } ?>
62 |
63 |
--------------------------------------------------------------------------------
/database-manage.php:
--------------------------------------------------------------------------------
1 | ' . sprintf(__('%s is not a valid backup path', 'wp-dbmanager'), stripslashes( $backup['path'] ) ) . '';
55 | } else if( dbmanager_is_valid_path( $backup['mysqlpath'] ) === 0 ) {
56 | $text = '' . sprintf(__('%s is not a valid mysql path', 'wp-dbmanager'), stripslashes( $backup['mysqlpath'] ) ) . '
';
57 | } else {
58 | passthru( $backup['command'], $error );
59 | }
60 | if($error) {
61 | $text = '' . sprintf( __( 'Database On \'%s\' Failed To Restore', 'wp-dbmanager' ), $file['formatted_date'] ) . '
';
62 | } else {
63 | $text = '' . sprintf( __( 'Database On \'%s\' Restored Successfully', 'wp-dbmanager' ), $file['formatted_date'] ) . '
';
64 | }
65 | } else {
66 | $text = '' . __('No Backup Database File Selected', 'wp-dbmanager' ) . '
';
67 | }
68 | break;
69 | case __('E-Mail', 'wp-dbmanager'):
70 | if(!empty($database_file)) {
71 | $to = ( !empty( $_POST['email_to'] ) ? sanitize_email( $_POST['email_to'] ) : get_option( 'admin_email' ) );
72 |
73 | if( dbmanager_email_backup( $to, $backup['path'] . '/' . $database_file ) ) {
74 | $text .= '' . sprintf( __( 'Database Backup File For \'%s\' Successfully E-Mailed To \'%s\'', 'wp-dbmanager' ), $file['formatted_date'], $to) . '
';
75 | } else {
76 | $text = '' . sprintf( __( 'Unable To E-Mail Database Backup File For \'%s\' To \'%s\'', 'wp-dbmanager' ), $file['formatted_date'], $to ) . '
';
77 | }
78 | } else {
79 | $text = '' . __('No Backup Database File Selected', 'wp-dbmanager' ) . '
';
80 | }
81 | break;
82 | case __('Download', 'wp-dbmanager'):
83 | if(empty($database_file)) {
84 | $text = '' . __( 'No Backup Database File Selected', 'wp-dbmanager' ) . '
';
85 | }
86 | break;
87 | case __('Delete', 'wp-dbmanager'):
88 | if ( ! empty( $database_file ) ) {
89 | if ( is_file( $backup['path'] . '/' . $database_file ) ) {
90 | if ( ! unlink( $backup['path'] . '/' . $database_file ) ) {
91 | $text .= '' . sprintf( __( 'Unable To Delete Database Backup File On \'%s\'', 'wp-dbmanager' ), $file['formatted_date'] ) . '
';
92 | } else {
93 | $text .= '' . sprintf( __( 'Database Backup File On \'%s\' Deleted Successfully', 'wp-dbmanager' ), $file['formatted_date'] ) . '
';
94 | }
95 | } else {
96 | $text = '' . sprintf( __( 'Invalid Database Backup File On \'%s\'', 'wp-dbmanager' ), $file['formatted_date'] ) . '
';
97 | }
98 | } else {
99 | $text = '' . __( 'No Backup Database File Selected', 'wp-dbmanager' ) . '
';
100 | }
101 | break;
102 | }
103 | }
104 | ?>
105 | '.$text.'
'; } ?>
106 |
107 |
176 |
--------------------------------------------------------------------------------
/database-manager.php:
--------------------------------------------------------------------------------
1 | get_var("SELECT VERSION() AS version");
21 | ?>
22 | '; } ?>
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 | MYSQL
50 |
51 |
52 |
53 | v
54 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 | get_results("SHOW TABLE STATUS");
80 | foreach($tablesstatus as $tablestatus) {
81 | if($no%2 == 0) {
82 | $style = '';
83 | } else {
84 | $style = ' class="alternate"';
85 | }
86 | $no++;
87 | echo "\n";
88 | echo ''.number_format_i18n($no).' '."\n";
89 | echo "$tablestatus->Name \n";
90 | echo ''.number_format_i18n($tablestatus->Rows).' '."\n";
91 | echo ''.format_size($tablestatus->Data_length).' '."\n";
92 | echo ''.format_size($tablestatus->Index_length).' '."\n";;
93 | echo ''.format_size($tablestatus->Data_free).' '."\n";
94 | $row_usage += $tablestatus->Rows;
95 | $data_usage += $tablestatus->Data_length;
96 | $index_usage += $tablestatus->Index_length;
97 | $overhead_usage += $tablestatus->Data_free;
98 | echo ' '."\n";
99 | }
100 | echo ''."\n";
101 | echo ''.__('Total:', 'wp-dbmanager').' '."\n";
102 | echo ''.sprintf(_n('%s Table', '%s Tables', $no, 'wp-dbmanager'), number_format_i18n($no)).' '."\n";
103 | echo ''.sprintf(_n('%s Record', '%s Records', $row_usage, 'wp-dbmanager'), number_format_i18n($row_usage)).' '."\n";
104 | echo ''.format_size($data_usage).' '."\n";
105 | echo ''.format_size($index_usage).' '."\n";
106 | echo ''.format_size($overhead_usage).' '."\n";
107 | echo ' ';
108 | ?>
109 |
110 |
--------------------------------------------------------------------------------
/database-optimize.php:
--------------------------------------------------------------------------------
1 | $value) {
24 | if($value == 'yes') {
25 | $tables_string .= '`, `'.$key;
26 | }
27 | }
28 | } else {
29 | $text = ''.__('No Tables Selected', 'wp-dbmanager').'
';
30 | }
31 | $selected_tables = substr($tables_string, 3);
32 | $selected_tables .= '`';
33 | if(!empty($selected_tables)) {
34 | $optimize2 = $wpdb->query("OPTIMIZE TABLE $selected_tables");
35 | if(!$optimize2) {
36 | $text = ''.sprintf(__('Table(s) \'%s\' NOT Optimized', 'wp-dbmanager'), str_replace('`', '', $selected_tables)).'
';
37 | } else {
38 | $text = ''.sprintf(__('Table(s) \'%s\' Optimized', 'wp-dbmanager'), str_replace('`', '', $selected_tables)).'
';
39 | }
40 | }
41 | break;
42 | }
43 | }
44 |
45 |
46 | ### Show Tables
47 | $tables = $wpdb->get_col("SHOW TABLES");
48 | ?>
49 | '; } ?>
50 |
51 |
85 |
--------------------------------------------------------------------------------
/database-repair.php:
--------------------------------------------------------------------------------
1 | $value) {
25 | if($value == 'yes') {
26 | $tables_string .= '`, `'.$key;
27 | }
28 | }
29 | } else {
30 | $text = ''.__('No Tables Selected', 'wp-dbmanager').'
';
31 | }
32 | $selected_tables = substr($tables_string, 2);
33 | $selected_tables .= '`';
34 | if(!empty($selected_tables)) {
35 | $repair2 = $wpdb->query("REPAIR TABLE $selected_tables");
36 | if(!$repair2) {
37 | $text = ''.sprintf(__('Table(s) \'%s\' NOT Repaired', 'wp-dbmanager'), str_replace('`', '', $selected_tables)).'
';
38 | } else {
39 | $text = ''.sprintf(__('Table(s) \'%s\' Repaired', 'wp-dbmanager'), str_replace('`', '', $selected_tables)).'
';
40 | }
41 | }
42 | break;
43 | }
44 | }
45 |
46 |
47 | ### Show Tables
48 | $tables = $wpdb->get_col("SHOW TABLES");
49 | ?>
50 | '; } ?>
51 |
52 |
--------------------------------------------------------------------------------
/database-run.php:
--------------------------------------------------------------------------------
1 | $sql_query";
43 | $totalquerycount++;
44 | } elseif( preg_match( "/^\\s*(select|drop|show|grant) /i", $sql_query ) ) {
45 | $text .= "$sql_query
";
46 | $totalquerycount++;
47 | } else if ( preg_match( "/^\\s*(insert|update|replace|delete|create|alter) /i", $sql_query ) ) {
48 | $run_query = $wpdb->query( $sql_query );
49 | if( ! $run_query ) {
50 | $text .= "$sql_query
";
51 | } else {
52 | $successquery++;
53 | $text .= "$sql_query
";
54 | }
55 | $totalquerycount++;
56 | }
57 | }
58 | $text .= ''.number_format_i18n($successquery).'/'.number_format_i18n($totalquerycount).' '.__('Query(s) Executed Successfully', 'wp-dbmanager').'
';
59 | } else {
60 | $text = ''.__('Empty Query', 'wp-dbmanager').'
';
61 | }
62 | } else {
63 | $text = ''.__('Empty Query', 'wp-dbmanager').'
';
64 | }
65 | break;
66 | }
67 | }
68 | ?>
69 | '; } ?>
70 |
71 |
95 |
--------------------------------------------------------------------------------
/htaccess.txt:
--------------------------------------------------------------------------------
1 |
2 | order allow,deny
3 | deny from all
4 |
--------------------------------------------------------------------------------
/index.php:
--------------------------------------------------------------------------------
1 | blog_id : $ms_site['blog_id'];
16 | switch_to_blog( $blog_id );
17 | plugin_uninstalled();
18 | }
19 | }
20 |
21 | restore_current_blog();
22 | } else {
23 | plugin_uninstalled();
24 | }
25 |
26 | /**
27 | * Delete plugin data when uninstalled
28 | *
29 | * @access public
30 | * @return void
31 | */
32 | function plugin_uninstalled() {
33 | $option_name = 'dbmanager_options';
34 |
35 | delete_option( $option_name );
36 |
37 | wp_clear_scheduled_hook( 'dbmanager_cron_backup' );
38 | wp_clear_scheduled_hook( 'dbmanager_cron_optimize' );
39 | wp_clear_scheduled_hook( 'dbmanager_cron_repair' );
40 | }
41 |
--------------------------------------------------------------------------------
/wp-dbmanager.php:
--------------------------------------------------------------------------------
1 | 0 ) {
78 | $backup = array();
79 | $backup['date'] = current_time('timestamp');
80 | $backup['mysqldumppath'] = $backup_options['mysqldumppath'];
81 | $backup['mysqlpath'] = $backup_options['mysqlpath'];
82 | $backup['path'] = $backup_options['path'];
83 | $backup['charset'] = ' --default-character-set="utf8mb4"';
84 | $backup['host'] = DB_HOST;
85 | $backup['port'] = '';
86 | $backup['sock'] = '';
87 | if ( strpos( DB_HOST, ':' ) !== false ) {
88 | $db_host = explode(':', DB_HOST);
89 | $backup['host'] = $db_host[0];
90 | if ( (int) $db_host[1] !== 0 ) {
91 | $backup['port'] = ' --port=' . escapeshellarg( (int) $db_host[1] );
92 | } else {
93 | $backup['sock'] = ' --socket=' . escapeshellarg( $db_host[1] );
94 | }
95 | }
96 | $backup['command'] = '';
97 | $backup['filename'] = $backup['date'] . '_-_' . DB_NAME . '.sql';
98 | $brace = 0 === strpos( PHP_OS, 'WIN' ) ? '"' : '';
99 | if ( (int) $backup_options['backup_gzip'] === 1 ) {
100 | $backup['filename'] .= '.gz';
101 | $backup['filepath'] = $backup['path'] . '/'. $backup['filename'];
102 | do_action( 'wp_dbmanager_before_escapeshellcmd' );
103 | $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;
104 | } else {
105 | $backup['filepath'] = $backup['path'] . '/'. $backup['filename'];
106 | do_action( 'wp_dbmanager_before_escapeshellcmd' );
107 | $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;
108 | }
109 | execute_backup( $backup['command'] );
110 | $new_filepath = $backup['path'] . '/' . md5_file( $backup['filepath'] ) . '_-_' . $backup['filename'];
111 | rename( $backup['filepath'], $new_filepath );
112 | $backup_email = stripslashes( $backup_options['backup_email'] );
113 | if ( ! empty( $backup_email ) ) {
114 | dbmanager_email_backup( $backup_email, $new_filepath );
115 | }
116 | }
117 | }
118 |
119 | function cron_dbmanager_optimize() {
120 | global $wpdb;
121 | $backup_options = get_option('dbmanager_options');
122 | $optimize_period = (int) $backup_options['optimize_period'];
123 | if($optimize_period > 0) {
124 | $optimize_tables = array();
125 | $tables = $wpdb->get_col("SHOW TABLES");
126 | foreach($tables as $table_name) {
127 | $optimize_tables[] = '`'.$table_name.'`';
128 | }
129 | $wpdb->query('OPTIMIZE TABLE '.implode(',', $optimize_tables));
130 | }
131 | }
132 |
133 | function cron_dbmanager_repair() {
134 | global $wpdb;
135 | $backup_options = get_option('dbmanager_options');
136 | $repair_period = (int) $backup_options['repair_period'];
137 | if($repair_period > 0) {
138 | $repair_tables = array();
139 | $tables = $wpdb->get_col("SHOW TABLES");
140 | foreach($tables as $table_name) {
141 | $repair_tables[] = '`'.$table_name.'`';
142 | }
143 | $wpdb->query('REPAIR TABLE '.implode(',', $repair_tables));
144 | }
145 | }
146 |
147 | function cron_dbmanager_reccurences($schedules) {
148 | $backup_options = get_option( 'dbmanager_options' );
149 |
150 | if( isset( $backup_options['backup'] ) && isset( $backup_options['backup_period'] ) ) {
151 | $backup = (int) $backup_options['backup'] * (int) $backup_options['backup_period'];
152 | } else {
153 | $backup = 0;
154 | }
155 | if( isset( $backup_options['optimize'] ) && isset( $backup_options['optimize_period'] ) ) {
156 | $optimize = (int) $backup_options['optimize'] * (int) $backup_options['optimize_period'];
157 | } else {
158 | $optimize = 0;
159 | }
160 | if( isset( $backup_options['repair'] ) && isset( $backup_options['repair_period'] ) ) {
161 | $repair = (int) $backup_options['repair'] * (int) $backup_options['repair_period'];
162 | } else {
163 | $repair = 0;
164 | }
165 |
166 | if( $backup === 0 ) {
167 | $backup = 31536000;
168 | }
169 | if( $optimize === 0 ) {
170 | $optimize = 31536000;
171 | }
172 | if( $repair === 0 ) {
173 | $repair = 31536000;
174 | }
175 | $schedules['dbmanager_backup'] = array( 'interval' => $backup, 'display' => __( 'WP-DBManager Backup Schedule', 'wp-dbmanager' ) );
176 | $schedules['dbmanager_optimize'] = array( 'interval' => $optimize, 'display' => __( 'WP-DBManager Optimize Schedule', 'wp-dbmanager' ) );
177 | $schedules['dbmanager_repair'] = array( 'interval' => $repair, 'display' => __( 'WP-DBManager Repair Schedule', 'wp-dbmanager' ) );
178 | return $schedules;
179 | }
180 |
181 |
182 | ### Function: Ensure .htaccess Is In The Backup Folder
183 | add_action( 'admin_notices', 'dbmanager_admin_notices' );
184 | function dbmanager_admin_notices() {
185 | $backup_options = get_option( 'dbmanager_options' );
186 | $backup_folder_writable = ( is_dir( $backup_options['path'] ) && wp_is_writable( $backup_options['path'] ) );
187 | $htaccess_exists = file_exists( $backup_options['path'] . '/.htaccess' );
188 | $webconfig_exists = file_exists( $backup_options['path'] . '/Web.config' );
189 | $index_exists = file_exists( $backup_options['path'] . '/index.php' );
190 |
191 | if( ! isset( $backup_options['hide_admin_notices'] ) || (int) $backup_options['hide_admin_notices'] === 0 )
192 | {
193 | if( ! $backup_folder_writable || ! $index_exists || ( is_iis() && ! $webconfig_exists ) || ( ! is_iis() && ! $htaccess_exists ) ) {
194 |
195 | echo '';
196 | if( !$backup_folder_writable ) {
197 | echo '
' . __( 'Your backup folder is NOT writable', 'wp-postratings') . '
';
198 | echo '
'.sprintf( __( 'To correct this issue, make the folder %s writable.', 'wp-dbmanager' ), $backup_options['path'] ).'
';
199 | }
200 | if( ! $index_exists || ( is_iis() && ! $webconfig_exists ) || ( ! is_iis() && ! $htaccess_exists ) ) {
201 | echo '
'.__( 'Your backup folder MIGHT be visible to the public', 'wp-dbmanager' ).'
';
202 | }
203 | if( is_iis() ) {
204 | if( ! $webconfig_exists ) {
205 | echo '
'.sprintf( __( 'To correct this issue, move the file from %s to %s ', 'wp-dbmanager'), plugin_dir_path( __FILE__ ) . 'Web.config.txt', $backup_options['path'] .'/Web.config' ).'
';
206 | }
207 | } else {
208 | if( ! $htaccess_exists ) {
209 | echo '
'.sprintf( __( 'To correct this issue, move the file from %s to %s ', 'wp-dbmanager'), plugin_dir_path( __FILE__ ) . 'htaccess.txt', $backup_options['path'] .'/.htaccess' ).'
';
210 | }
211 | }
212 | if( ! $index_exists ) {
213 | echo '
'.sprintf( __( 'To correct this issue, move the file from %s to %s ', 'wp-dbmanager'), plugin_dir_path( __FILE__ ) . 'index.php', $backup_options['path'] .'/index.php' ).'
';
214 | }
215 | echo '
' . sprintf( __( 'Click here to let WP-DBManager try to fix it', 'wp-dbmanager' ), wp_nonce_url( admin_url( 'admin.php?page=wp-dbmanager/database-backup.php&try_fix=1' ), 'wp-dbmanager_fix' ) ) . '
';
216 | echo '
';
217 | }
218 | }
219 | }
220 |
221 |
222 | ### Function: Auto Detect MYSQL and MYSQL Dump Paths
223 | function detect_mysql() {
224 | global $wpdb;
225 | $paths = array('mysq' => '', 'mysqldump' => '');
226 | if ( substr( PHP_OS,0,3 ) === 'WIN' ) {
227 | $mysql_install = $wpdb->get_row("SHOW VARIABLES LIKE 'basedir'");
228 | if($mysql_install) {
229 | $install_path = trailingslashit( str_replace('\\', '/', $mysql_install->Value) );
230 | $paths['mysql'] = $install_path.'bin/mysql.exe';
231 | $paths['mysqldump'] = $install_path.'bin/mysqldump.exe';
232 | } else {
233 | $paths['mysql'] = 'mysql.exe';
234 | $paths['mysqldump'] = 'mysqldump.exe';
235 | }
236 | } else {
237 | if(function_exists('exec')) {
238 | $paths['mysql'] = @exec('which mysql');
239 | $paths['mysqldump'] = @exec('which mysqldump');
240 | } else {
241 | $paths['mysql'] = 'mysql';
242 | $paths['mysqldump'] = 'mysqldump';
243 | }
244 | }
245 | return $paths;
246 | }
247 |
248 | ### Function: Check if WordPress is installed on IIS
249 | function is_iis() {
250 | $server_software = strtolower( $_SERVER['SERVER_SOFTWARE'] );
251 | if ( strpos( $server_software, 'microsoft-iis') !== false ) {
252 | return true;
253 | }
254 |
255 | return false;
256 | }
257 |
258 | ### Executes OS-Dependent mysqldump Command (By: Vlad Sharanhovich)
259 | function execute_backup($command) {
260 | $backup_options = get_option('dbmanager_options');
261 | check_backup_files();
262 |
263 | if( realpath( $backup_options['path'] ) === false ) {
264 | return sprintf( __( '%s is not a valid backup path', 'wp-dbmanager' ), stripslashes( $backup_options['path'] ) );
265 | } else if( dbmanager_is_valid_path( $backup_options['mysqldumppath'] ) === 0 ) {
266 | return sprintf( __( '%s is not a valid mysqldump path', 'wp-dbmanager' ), stripslashes( $backup_options['mysqldumppath'] ) );
267 | } else if( dbmanager_is_valid_path( $backup_options['mysqlpath'] ) === 0 ) {
268 | return sprintf( __( '%s is not a valid mysql path', 'wp-dbmanager' ), stripslashes( $backup_options['mysqlpath'] ) );
269 | }
270 |
271 | if( substr( PHP_OS, 0, 3 ) === 'WIN' ) {
272 | $writable_dir = $backup_options['path'];
273 | $tmpnam = $writable_dir.'/wp-dbmanager.bat';
274 | $fp = fopen( $tmpnam, 'w' );
275 | fwrite ($fp, $command );
276 | fclose( $fp );
277 | system( $tmpnam.' > NUL', $error );
278 | unlink( $tmpnam );
279 | } else {
280 | passthru( $command, $error );
281 | }
282 | return $error;
283 | }
284 |
285 | ### Function: Check for valid file path
286 | function dbmanager_is_valid_path( $path ) {
287 | return preg_match( '/^[^*?"<>|;]*$/', $path );
288 | }
289 |
290 | ### Functionn : Breakdown the file name into array
291 | function dbmanager_parse_filename( $filename ) {
292 | $file_parts = explode( '_-_', $filename );
293 | if ( count( $file_parts ) > 2 ) {
294 | $file = array(
295 | 'checksum' => $file_parts[0],
296 | 'timestamp' => $file_parts[1],
297 | 'database' => $file_parts[2],
298 | );
299 | } else {
300 | $file = array(
301 | 'checksum' => '-',
302 | 'timestamp' => $file_parts[0],
303 | 'database' => ! empty( $file_parts[1] ) ? $file_parts[1] : $filename,
304 | );
305 | }
306 |
307 | $file['name'] = $filename;
308 |
309 | if ( is_numeric( $file['timestamp'] ) ) {
310 | $file['formatted_date'] = mysql2date( sprintf( __( '%s @ %s', 'wp-dbmanager' ), get_option( 'date_format' ), get_option( 'time_format' ) ), gmdate( 'Y-m-d H:i:s', $file['timestamp'] ) );
311 | } else {
312 | $file['formatted_date'] = '-';
313 | }
314 |
315 | return $file;
316 | }
317 |
318 | ### Functionn : Return extra information like file size and nice date of the file
319 | function dbmanager_parse_file( $filepath ) {
320 | $filename = basename( $filepath );
321 | $file_parts = dbmanager_parse_filename( $filename );
322 | $file_parts['path'] = dirname( $filepath );
323 | $file_parts['size'] = filesize( $filepath );
324 | $file_parts['formatted_size'] = format_size( $file_parts['size'] );
325 |
326 | return $file_parts;
327 | }
328 |
329 | ### Function: Email database backup
330 | function dbmanager_email_backup( $to, $backup_file_path ) {
331 | $to = ( !empty( $to ) ? $to : get_option( 'admin_email' ) );
332 |
333 | if( is_email( $to ) && file_exists( $backup_file_path ) ) {
334 | $backup_options = get_option( 'dbmanager_options' );
335 |
336 | $file = dbmanager_parse_file( $backup_file_path );
337 | $file_gmt_date = gmdate( 'Y-m-d H:i:s', $file['timestamp'] );
338 |
339 | $subject = ( ! empty( $backup_options['backup_email_subject'] ) ? $backup_options['backup_email_subject'] : dbmanager_default_options( 'backup_email_subject' ) );
340 | $subject = str_replace(
341 | array(
342 | '%SITE_NAME%',
343 | '%POST_DATE%',
344 | '%POST_TIME%'
345 | ),
346 | array(
347 | wp_specialchars_decode( get_bloginfo( 'name' ), ENT_QUOTES ),
348 | mysql2date( get_option( 'date_format' ), $file_gmt_date ),
349 | mysql2date( get_option( 'time_format' ), $file_gmt_date )
350 | )
351 | , $subject
352 | );
353 | $message = __( 'Website Name:', 'wp-dbmanager' ) . ' ' . wp_specialchars_decode( get_bloginfo( 'name' ), ENT_QUOTES ) . "\n" .
354 | __( 'Website URL:', 'wp-dbmanager' ) . ' '. get_bloginfo( 'url' ) . "\n\n" .
355 | __( 'Backup File Name:', 'wp-dbmanager' ) . ' ' . $file['name'] . "\n" .
356 | __( 'Backup File MD5 Checksum:', 'wp-dbmanager' ) . ' ' . $file['checksum'] . "\n" .
357 | __( 'Backup File Date:', 'wp-dbmanager' ) . ' ' . $file['formatted_date'] . "\n" .
358 | __( 'Backup File Size:', 'wp-dbmanager' ) . ' ' . $file['formatted_size'] . "\n\n" .
359 | __( 'With Regards,', 'wp-dbmanager' )."\n".
360 | wp_specialchars_decode( get_bloginfo( 'name' ), ENT_QUOTES ) . ' ' . __('Administrator', 'wp-dbmanager' ) . "\n" .
361 | get_bloginfo( 'url' );
362 |
363 | $from = ( ! empty( $backup_options['backup_email_from'] ) ? $backup_options['backup_email_from'] : dbmanager_default_options( 'backup_email_from' ) );
364 | $from_name = ( ! empty( $backup_options['backup_email_from_name'] ) ? $backup_options['backup_email_from_name'] : dbmanager_default_options( 'backup_email_from_name' ) );
365 | $headers[] = 'From: "' . wp_specialchars_decode( stripslashes_deep( $from_name ), ENT_QUOTES ) . '" <' . $from . '>';
366 |
367 | return wp_mail( $to, $subject, $message, $headers, $backup_file_path );
368 | }
369 |
370 | return false;
371 | }
372 |
373 |
374 | ### Function: Format Bytes Into KB/MB
375 | if(!function_exists('format_size')) {
376 | function format_size($rawSize) {
377 | if($rawSize / 1073741824 > 1)
378 | return number_format_i18n($rawSize/1048576, 1) . ' '.__('GiB', 'wp-dbmanager');
379 | else if ($rawSize / 1048576 > 1)
380 | return number_format_i18n($rawSize/1048576, 1) . ' '.__('MiB', 'wp-dbmanager');
381 | else if ($rawSize / 1024 > 1)
382 | return number_format_i18n($rawSize/1024, 1) . ' '.__('KiB', 'wp-dbmanager');
383 | else
384 | return number_format_i18n($rawSize, 0) . ' '.__('bytes', 'wp-dbmanager');
385 | }
386 | }
387 |
388 |
389 | ### Function: Get File Extension
390 | if(!function_exists('file_ext')) {
391 | function file_ext($file_name) {
392 | return substr(strrchr($file_name, '.'), 1);
393 | }
394 | }
395 |
396 |
397 | ### Function: Check Folder Whether There Are Any Files Inside
398 | function dbmanager_is_folder_valid( $folder ){
399 | // Check folder whether it is readable
400 | if ( ! is_readable( $folder ) ) {
401 | return false;
402 | }
403 |
404 | // Ensure folder is a directory
405 | if ( ! is_dir( $folder ) ) {
406 | return false;
407 | }
408 |
409 | // Ensure folder is not empty. 2 because it includes '.' and '..'
410 | if ( scandir( $folder ) <= 2 ) {
411 | return false;
412 | }
413 |
414 | return true;
415 | }
416 |
417 |
418 | ### Function: Make Sure Maximum Number Of Database Backup Files Does Not Exceed
419 | function check_backup_files() {
420 | $backup_options = get_option( 'dbmanager_options' );
421 | $database_files = array();
422 | if ( dbmanager_is_folder_valid( $backup_options['path'] ) ) {
423 | if ( $handle = opendir($backup_options['path'] ) ) {
424 | while ( false !== ( $file = readdir( $handle ) ) ) {
425 | if ( $file !== '.' && $file !== '..' && ( file_ext( $file ) === 'sql' || file_ext( $file ) === 'gz' ) ) {
426 | $database_files[ filemtime( $backup_options['path'] . '/' . $file ) ] = $file;
427 | }
428 | }
429 | closedir( $handle );
430 | ksort( $database_files );
431 | }
432 | }
433 | if ( sizeof( $database_files ) >= $backup_options['max_backup'] ) {
434 | @unlink( $backup_options['path'] . '/' . $database_files[ array_key_first( $database_files ) ] );
435 | }
436 | }
437 |
438 |
439 | ### Function: DBManager Default Options
440 | function dbmanager_default_options( $option_name )
441 | {
442 | switch( $option_name ) {
443 | case 'backup_email_from':
444 | return get_option( 'admin_email' );
445 | break;
446 | case 'backup_email_from_name':
447 | return wp_specialchars_decode( get_bloginfo( 'name' ), ENT_QUOTES ) .' '.__( 'Administrator', 'wp-dbmanager' );
448 | break;
449 | case 'backup_email_subject':
450 | return __( '%SITE_NAME% Database Backup File For %POST_DATE% @ %POST_TIME%', 'wp-dbmanager' );
451 | break;
452 | case 'hide_admin_notices':
453 | return 0;
454 | break;
455 | }
456 | }
457 |
458 | ### Function: Acticate Plugin
459 | register_activation_hook( __FILE__, 'dbmanager_activation' );
460 | function dbmanager_activation( $network_wide ) {
461 | $auto = detect_mysql();
462 | // Add Options
463 | $option_name = 'dbmanager_options';
464 | $option = array(
465 | 'mysqldumppath' => $auto['mysqldump']
466 | , 'mysqlpath' => $auto['mysql']
467 | , 'path' => str_replace( '\\', '/', WP_CONTENT_DIR ).'/backup-db'
468 | , 'max_backup' => 10
469 | , 'backup' => 1
470 | , 'backup_gzip' => 0
471 | , 'backup_period' => 604800
472 | , 'backup_email' => get_option( 'admin_email' )
473 | , 'backup_email_from' => dbmanager_default_options( 'backup_email_from' )
474 | , 'backup_email_from_name' => dbmanager_default_options( 'backup_email_from_name' )
475 | , 'backup_email_subject' => dbmanager_default_options( 'backup_email_subject' )
476 | , 'optimize' => 3
477 | , 'optimize_period' => 86400
478 | , 'repair' => 2
479 | , 'repair_period' => 604800
480 | , 'hide_admin_notices' => 0
481 | );
482 |
483 | if ( is_multisite() && $network_wide ) {
484 | $ms_sites = function_exists( 'get_sites' ) ? get_sites() : wp_get_sites();
485 |
486 | if( 0 < sizeof( $ms_sites ) ) {
487 | foreach ( $ms_sites as $ms_site ) {
488 | $blog_id = class_exists( 'WP_Site' ) ? $ms_site->blog_id : $ms_site['blog_id'];
489 | switch_to_blog( $blog_id );
490 | add_option( $option_name, $option );
491 | dbmanager_activate();
492 | }
493 | }
494 |
495 | restore_current_blog();
496 | } else {
497 | add_option( $option_name, $option );
498 | dbmanager_activate();
499 | }
500 | }
501 |
502 | function dbmanager_activate() {
503 | dbmanager_create_backup_folder();
504 |
505 | // Remove 'manage_database', we use 'install_plugins' from 2.80.6
506 | $role = get_role( 'administrator' );
507 | if( $role->has_cap( 'manage_database') ) {
508 | $role->remove_cap( 'manage_database' );
509 | }
510 | }
511 |
512 | function dbmanager_create_backup_folder() {
513 | $plugin_path = plugin_dir_path( __FILE__ );
514 | $backup_path = WP_CONTENT_DIR . '/backup-db';
515 | $backup_options = get_option( 'dbmanager_options' );
516 |
517 | if( ! empty( $backup_options['path'] ) ) {
518 | $backup_path = $backup_options['path'];
519 | }
520 |
521 | // Create Backup Folder
522 | wp_mkdir_p( $backup_path );
523 | if( is_dir( $backup_path ) && wp_is_writable( $backup_path ) ) {
524 | if( is_iis() ) {
525 | if ( ! is_file( $backup_path . '/Web.config' ) ) {
526 | @copy( $plugin_path . 'Web.config.txt', $backup_path . '/Web.config' );
527 | }
528 | } else {
529 | if( ! is_file( $backup_path . '/.htaccess' ) ) {
530 | @copy( $plugin_path . 'htaccess.txt', $backup_path . '/.htaccess' );
531 | }
532 | }
533 | if( ! is_file( $backup_path . '/index.php' ) ) {
534 | @copy( $plugin_path . 'index.php', $backup_path . '/index.php' );
535 | }
536 | @chmod( $backup_path, 0750 );
537 | }
538 | }
539 |
540 | add_action( 'init', 'dbmanager_try_fix' );
541 | function dbmanager_try_fix() {
542 | if ( ! empty( $_GET['try_fix'] ) && (int) $_GET['try_fix'] === 1 ) {
543 | check_admin_referer( 'wp-dbmanager_fix' );
544 | dbmanager_create_backup_folder();
545 | }
546 | }
547 |
548 |
549 | ### Function: Download Database
550 | add_action( 'init', 'download_database' );
551 | function download_database() {
552 | if( isset( $_POST['do'] ) && $_POST['do'] === __( 'Download', 'wp-dbmanager' ) && ! empty( $_POST['database_file'] ) ) {
553 | check_admin_referer( 'wp-dbmanager_manage' );
554 | $database_file = trim( $_POST['database_file'] );
555 | if( substr( $database_file, strlen( $database_file ) -4, 4 ) === '.sql' || substr( $database_file, strlen( $database_file ) -7, 7 ) === '.sql.gz' ) {
556 | $backup_options = get_option( 'dbmanager_options' );
557 | $clean_file_name = sanitize_file_name( $database_file );
558 | $clean_file_name = str_replace( 'sql_.gz', 'sql.gz', $clean_file_name );
559 | $file_path = $backup_options['path'] . '/' . $clean_file_name;
560 | header( 'Pragma: public' );
561 | header( 'Expires: 0' );
562 | header( 'Cache-Control: must-revalidate, post-check=0, pre-check=0' );
563 | header( 'Content-Type: application/force-download' );
564 | header( 'Content-Type: application/octet-stream' );
565 | header( 'Content-Type: application/download' );
566 | header( 'Content-Disposition: attachment; filename=' . basename( $file_path ) . ';' );
567 | header( 'Content-Transfer-Encoding: binary' );
568 | header( 'Content-Length: ' . filesize( $file_path ) );
569 | @readfile( $file_path );
570 | }
571 | exit();
572 | }
573 | }
574 |
575 | ### Function: Check whether a function is disabled.
576 | function dbmanager_is_function_disabled( $function_name ) {
577 | return in_array( $function_name, array_map( 'trim', explode( ',', ini_get( 'disable_functions' ) ) ), true );
578 | }
579 |
580 | ### Function: Polyfill array_key_first() for PHP < 7.3
581 | if ( ! function_exists( 'array_key_first' ) ) {
582 | function array_key_first( $arr ) {
583 | foreach( $arr as $key => $unused ) {
584 | return $key;
585 | }
586 | return null;
587 | }
588 | }
589 |
590 | ### Function: Database Options
591 | function dbmanager_options() {
592 | $text = '';
593 | $backup_options = get_option('dbmanager_options');
594 | $old_backup_options = $backup_options;
595 | if(!empty($_POST['Submit'])) {
596 | check_admin_referer('wp-dbmanager_options');
597 | $backup_options['mysqldumppath'] = ! empty( $_POST['db_mysqldumppath'] ) ? sanitize_text_field( $_POST['db_mysqldumppath'] ) : '';
598 | $backup_options['mysqlpath'] = ! empty ( $_POST['db_mysqlpath'] ) ? sanitize_text_field( $_POST['db_mysqlpath'] ) : '';
599 | $backup_options['path'] = ! empty ( $_POST['db_path'] ) ? sanitize_text_field( $_POST['db_path'] ) : '';
600 | $backup_options['max_backup'] = ! empty( $_POST['db_max_backup'] ) ? (int) $_POST['db_max_backup'] : 0;
601 | $backup_options['backup'] = ! empty ( $_POST['db_backup'] ) ? (int) $_POST['db_backup'] : 0;
602 | $backup_options['backup_gzip'] = ! empty( $_POST['db_backup_gzip'] ) ? (int) $_POST['db_backup_gzip'] : 0;
603 | $backup_options['backup_period'] = ! empty( $_POST['db_backup_period'] ) ? (int) $_POST['db_backup_period'] : 0;
604 | $backup_options['backup_email'] = ! empty( $_POST['db_backup_email'] ) ? sanitize_email( $_POST['db_backup_email'] ) : '';
605 | $backup_options['backup_email_from'] = ! empty( $_POST['db_backup_email_from'] ) ? sanitize_email( $_POST['db_backup_email_from'] ) : '';
606 | $backup_options['backup_email_from_name'] = ! empty( $_POST['db_backup_email_from_name'] ) ? sanitize_text_field( $_POST['db_backup_email_from_name'] ) : '';
607 | $backup_options['backup_email_subject'] = ! empty( $_POST['db_backup_email_subject'] ) ? sanitize_text_field( $_POST['db_backup_email_subject'] ) : '';
608 | $backup_options['optimize'] = ! empty( $_POST['db_optimize'] ) ? (int) $_POST['db_optimize'] : 0;
609 | $backup_options['optimize_period'] = ! empty( $_POST['db_optimize_period'] ) ? (int) $_POST['db_optimize_period'] : 0;
610 | $backup_options['repair'] = ! empty( $_POST['db_repair'] ) ? (int) $_POST['db_repair'] : 0;
611 | $backup_options['repair_period'] = ! empty( $_POST['db_repair_period'] ) ? (int) $_POST['db_repair_period'] : 0;
612 | $backup_options['hide_admin_notices'] = ! empty( $_POST['db_hide_admin_notices'] ) ? (int) $_POST['db_hide_admin_notices'] : 0;
613 |
614 | if( realpath( $backup_options['path'] ) === false ) {
615 | $text = '' . sprintf( __( '%s is not a valid backup path', 'wp-dbmanager' ), stripslashes( $backup_options['path'] ) ) . '
';
616 | $backup_options['path'] = $old_backup_options['path'];
617 | } else if( dbmanager_is_valid_path( $backup_options['mysqldumppath'] ) === 0 ) {
618 | $text = '' . sprintf( __( '%s is not a valid mysqldump path', 'wp-dbmanager' ), stripslashes( $backup_options['mysqldumppath'] ) ) . '
';
619 | $backup_options['mysqldumppath'] = $old_backup_options['mysqldumppath'];
620 | } else if( dbmanager_is_valid_path( $backup_options['mysqlpath'] ) === 0 ) {
621 | $text = '' . sprintf( __( '%s is not a valid mysql path', 'wp-dbmanager' ), stripslashes( $backup_options['mysqlpath'] ) ) . '
';
622 | $backup_options['mysqlpath'] = $old_backup_options['mysqlpath'];
623 | }
624 |
625 | $update_db_options = update_option( 'dbmanager_options', $backup_options );
626 | if( $update_db_options ) {
627 | $text = '' . __( 'Database Options Updated', 'wp-dbmanager' ) . '
';
628 | }
629 | if( empty( $text ) ) {
630 | $text = '' . __( 'No Database Option Updated', 'wp-dbmanager' ) . '
';
631 | }
632 | wp_clear_scheduled_hook( 'dbmanager_cron_backup' );
633 | if( $backup_options['backup_period'] > 0 ) {
634 | if ( ! wp_next_scheduled( 'dbmanager_cron_backup' ) ) {
635 | wp_schedule_event( time(), 'dbmanager_backup', 'dbmanager_cron_backup' );
636 | }
637 | }
638 | wp_clear_scheduled_hook( 'dbmanager_cron_optimize' );
639 | if( $backup_options['optimize_period'] > 0 ) {
640 | if ( ! wp_next_scheduled('dbmanager_cron_optimize' ) ) {
641 | wp_schedule_event( time(), 'dbmanager_optimize', 'dbmanager_cron_optimize' );
642 | }
643 | }
644 | wp_clear_scheduled_hook( 'dbmanager_cron_repair' );
645 | if( $backup_options['repair_period'] > 0 ) {
646 | if ( ! wp_next_scheduled( 'dbmanager_cron_repair' ) ) {
647 | wp_schedule_event( time(), 'dbmanager_repair', 'dbmanager_cron_repair' );
648 | }
649 | }
650 | }
651 | $path = detect_mysql();
652 |
653 | // Default Options
654 | if( !isset( $backup_options['backup_email_from'] ) )
655 | {
656 | $backup_options['backup_email_from'] = dbmanager_default_options( 'backup_email_from' );
657 | }
658 | if( !isset( $backup_options['backup_email_from_name'] ) )
659 | {
660 | $backup_options['backup_email_from_name'] = dbmanager_default_options( 'backup_email_from_name' );
661 | }
662 | if( !isset( $backup_options['backup_email_subject'] ) )
663 | {
664 | $backup_options['backup_email_subject'] = dbmanager_default_options( 'backup_email_subject' );
665 | }
666 | if( !isset( $backup_options['hide_admin_notices'] ) )
667 | {
668 | $backup_options['hide_admin_notices'] = dbmanager_default_options( 'hide_admin_notices' );
669 | }
670 |
671 | ?>
672 |
682 |
683 |
684 |
685 |
686 |
687 |
688 |
689 |
719 |
720 |
721 |
743 |
744 |
745 |
827 |
828 |
829 |
859 |
860 |
861 |
872 |
873 |
874 |
875 |
876 |
877 |
878 |
881 |
--------------------------------------------------------------------------------
/wp-dbmanager.pot:
--------------------------------------------------------------------------------
1 | msgid ""
2 | msgstr ""
3 | "Project-Id-Version: WP-DBManager\n"
4 | "POT-Creation-Date: 2014-02-19 09:48+0800\n"
5 | "PO-Revision-Date: 2014-02-19 09:49+0800\n"
6 | "Last-Translator: Lester Chan \n"
7 | "Language-Team: Lester Chan \n"
8 | "Language: en_US\n"
9 | "MIME-Version: 1.0\n"
10 | "Content-Type: text/plain; charset=UTF-8\n"
11 | "Content-Transfer-Encoding: 8bit\n"
12 | "X-Generator: Poedit 1.6.4\n"
13 | "X-Poedit-Basepath: ..\n"
14 | "X-Poedit-SourceCharset: UTF-8\n"
15 | "X-Poedit-KeywordsList: __;_e;_n:1,2;_x:1,2c;_ex:1,2c;_nx:4c,1,2;esc_attr__;"
16 | "esc_attr_e;esc_attr_x:1,2c;esc_html__;esc_html_e;esc_html_x:1,2c;_n_noop:1,2;"
17 | "_nx_noop:3c,1,2;__ngettext_noop:1,2\n"
18 | "Plural-Forms: nplurals=2; plural=(n != 1);\n"
19 | "X-Poedit-SearchPath-0: .\n"
20 |
21 | #: database-backup.php:11 database-backup.php:184 database-manage.php:26
22 | #: database-manage.php:136 wp-dbmanager.php:77 wp-dbmanager.php:248
23 | #: wp-dbmanager.php:627 wp-dbmanager.php:657 wp-dbmanager.php:682
24 | #, php-format
25 | msgid "%s @ %s"
26 | msgstr ""
27 |
28 | #: database-backup.php:26 database-backup.php:203
29 | msgid "Backup"
30 | msgstr ""
31 |
32 | #: database-backup.php:53
33 | #, php-format
34 | msgid "Database Failed To Backup On '%s'. Backup Folder Not Writable."
35 | msgstr ""
36 |
37 | #: database-backup.php:56
38 | #, php-format
39 | msgid "Database Failed To Backup On '%s'. Backup File Size Is 0KB."
40 | msgstr ""
41 |
42 | #: database-backup.php:58
43 | #, php-format
44 | msgid "Database Failed To Backup On '%s'. Invalid Backup File Path."
45 | msgstr ""
46 |
47 | #: database-backup.php:60
48 | #, php-format
49 | msgid "Database Failed To Backup On '%s'."
50 | msgstr ""
51 |
52 | #: database-backup.php:62
53 | #, php-format
54 | msgid "Database Backed Up Successfully On '%s'."
55 | msgstr ""
56 |
57 | #: database-backup.php:81 database-backup.php:165
58 | msgid "Backup Database"
59 | msgstr ""
60 |
61 | #: database-backup.php:82
62 | msgid "Checking Backup Status"
63 | msgstr ""
64 |
65 | #: database-backup.php:84
66 | msgid "Checking Backup Folder"
67 | msgstr ""
68 |
69 | #: database-backup.php:87
70 | msgid "Backup folder exists"
71 | msgstr ""
72 |
73 | #: database-backup.php:90
74 | #, php-format
75 | msgid ""
76 | "Backup folder does NOT exist. Please create 'backup-db' folder in '%s' "
77 | "folder and CHMOD it to '777' or change the location of the backup folder "
78 | "under DB Option."
79 | msgstr ""
80 |
81 | #: database-backup.php:93
82 | msgid "Backup folder is writable"
83 | msgstr ""
84 |
85 | #: database-backup.php:96
86 | msgid "Backup folder is NOT writable. Please CHMOD it to '777'."
87 | msgstr ""
88 |
89 | #: database-backup.php:103 database-backup.php:107
90 | msgid "Checking MYSQL Dump Path"
91 | msgstr ""
92 |
93 | #: database-backup.php:104
94 | msgid "MYSQL dump path exists."
95 | msgstr ""
96 |
97 | #: database-backup.php:108
98 | msgid ""
99 | "MYSQL dump path does NOT exist. Please check your mysqldump path under DB "
100 | "Options. If uncertain, contact your server administrator."
101 | msgstr ""
102 |
103 | #: database-backup.php:115 database-backup.php:119
104 | msgid "Checking MYSQL Path"
105 | msgstr ""
106 |
107 | #: database-backup.php:116
108 | msgid "MYSQL path exists."
109 | msgstr ""
110 |
111 | #: database-backup.php:120
112 | msgid ""
113 | "MYSQL path does NOT exist. Please check your mysql path under DB Options. If "
114 | "uncertain, contact your server administrator."
115 | msgstr ""
116 |
117 | #: database-backup.php:125
118 | msgid "Checking PHP Functions"
119 | msgstr ""
120 |
121 | #: database-backup.php:125
122 | msgid "and"
123 | msgstr ""
124 |
125 | #: database-backup.php:128 database-backup.php:135 database-backup.php:141
126 | msgid "enabled"
127 | msgstr ""
128 |
129 | #: database-backup.php:131 database-backup.php:137 database-backup.php:143
130 | msgid "disabled"
131 | msgstr ""
132 |
133 | #: database-backup.php:151
134 | msgid "Excellent. You Are Good To Go."
135 | msgstr ""
136 |
137 | #: database-backup.php:153
138 | msgid ""
139 | "I'm sorry, your server administrator has disabled passthru(), system() and "
140 | "exec(), thus you cannot use this backup script. You may consider using the "
141 | "default WordPress database backup script instead."
142 | msgstr ""
143 |
144 | #: database-backup.php:155
145 | msgid "Please Rectify The Error Highlighted In Red Before Proceeding On."
146 | msgstr ""
147 |
148 | #: database-backup.php:159
149 | msgid ""
150 | "Note: The checking of backup status is still undergoing testing, it may not "
151 | "be accurate."
152 | msgstr ""
153 |
154 | #: database-backup.php:170
155 | msgid "Option"
156 | msgstr ""
157 |
158 | #: database-backup.php:171 database-manager.php:33
159 | msgid "Value"
160 | msgstr ""
161 |
162 | #: database-backup.php:175
163 | msgid "Database Name:"
164 | msgstr ""
165 |
166 | #: database-backup.php:179
167 | msgid "Database Backup To:"
168 | msgstr ""
169 |
170 | #: database-backup.php:183
171 | msgid "Database Backup Date:"
172 | msgstr ""
173 |
174 | #: database-backup.php:187
175 | msgid "Database Backup File Name:"
176 | msgstr ""
177 |
178 | #: database-backup.php:191
179 | msgid "Database Backup Type:"
180 | msgstr ""
181 |
182 | #: database-backup.php:192
183 | msgid "Full (Structure and Data)"
184 | msgstr ""
185 |
186 | #: database-backup.php:195
187 | msgid "MYSQL Dump Location:"
188 | msgstr ""
189 |
190 | #: database-backup.php:199
191 | msgid "GZIP Database Backup File?"
192 | msgstr ""
193 |
194 | #: database-backup.php:200 database-optimize.php:74 database-repair.php:75
195 | #: wp-dbmanager.php:645 wp-dbmanager.php:741
196 | msgid "Yes"
197 | msgstr ""
198 |
199 | #: database-backup.php:200 database-optimize.php:74 database-repair.php:75
200 | #: wp-dbmanager.php:644 wp-dbmanager.php:742
201 | msgid "No"
202 | msgstr ""
203 |
204 | #: database-backup.php:203 database-empty.php:99 database-manage.php:168
205 | #: database-optimize.php:81 database-repair.php:79 database-run.php:83
206 | msgid "Cancel"
207 | msgstr ""
208 |
209 | #: database-empty.php:27 database-empty.php:99
210 | msgid "Empty/Drop"
211 | msgstr ""
212 |
213 | #: database-empty.php:40
214 | msgid "No Tables Selected."
215 | msgstr ""
216 |
217 | #: database-empty.php:46
218 | #, php-format
219 | msgid "Table '%s' Emptied"
220 | msgstr ""
221 |
222 | #: database-empty.php:51
223 | #, php-format
224 | msgid "Table(s) '%s' Dropped"
225 | msgstr ""
226 |
227 | #: database-empty.php:67 wp-dbmanager.php:50
228 | msgid "Empty/Drop Tables"
229 | msgstr ""
230 |
231 | #: database-empty.php:72 database-manager.php:67 database-optimize.php:60
232 | #: database-repair.php:61
233 | msgid "Tables"
234 | msgstr ""
235 |
236 | #: database-empty.php:73 database-empty.php:87
237 | msgid "Empty"
238 | msgstr ""
239 |
240 | #: database-empty.php:73
241 | msgid "1"
242 | msgstr ""
243 |
244 | #: database-empty.php:74 database-empty.php:88
245 | msgid "Drop"
246 | msgstr ""
247 |
248 | #: database-empty.php:74
249 | msgid "2"
250 | msgstr ""
251 |
252 | #: database-empty.php:93
253 | msgid ""
254 | "1. EMPTYING a table means all the rows in the table will be deleted. This "
255 | "action is not REVERSIBLE."
256 | msgstr ""
257 |
258 | #: database-empty.php:95
259 | msgid ""
260 | "2. DROPPING a table means deleting the table. This action is not REVERSIBLE."
261 | msgstr ""
262 |
263 | #: database-empty.php:99
264 | msgid ""
265 | "You Are About To Empty Or Drop The Selected Databases.\\nThis Action Is Not "
266 | "Reversible.\\n\\n Choose [Cancel] to stop, [Ok] to delete."
267 | msgstr ""
268 |
269 | #: database-manage.php:31 database-manage.php:166
270 | msgid "Restore"
271 | msgstr ""
272 |
273 | #: database-manage.php:53
274 | #, php-format
275 | msgid "Database On '%s' Failed To Restore"
276 | msgstr ""
277 |
278 | #: database-manage.php:55
279 | #, php-format
280 | msgid "Database On '%s' Restored Successfully"
281 | msgstr ""
282 |
283 | #: database-manage.php:58 database-manage.php:71 database-manage.php:76
284 | #: database-manage.php:91
285 | msgid "No Backup Database File Selected"
286 | msgstr ""
287 |
288 | #: database-manage.php:61 database-manage.php:161
289 | msgid "E-Mail"
290 | msgstr ""
291 |
292 | #: database-manage.php:66
293 | #, php-format
294 | msgid "Database Backup File For '%s' Successfully E-Mailed To '%s'"
295 | msgstr ""
296 |
297 | #: database-manage.php:68
298 | #, php-format
299 | msgid "Unable To E-Mail Database Backup File For '%s' To '%s'"
300 | msgstr ""
301 |
302 | #: database-manage.php:74 database-manage.php:165 wp-dbmanager.php:451
303 | msgid "Download"
304 | msgstr ""
305 |
306 | #: database-manage.php:79 database-manage.php:167
307 | msgid "Delete"
308 | msgstr ""
309 |
310 | #: database-manage.php:83
311 | #, php-format
312 | msgid "Unable To Delete Database Backup File On '%s'"
313 | msgstr ""
314 |
315 | #: database-manage.php:85
316 | #, php-format
317 | msgid "Database Backup File On '%s' Deleted Successfully"
318 | msgstr ""
319 |
320 | #: database-manage.php:88
321 | #, php-format
322 | msgid "Invalid Database Backup File On '%s'"
323 | msgstr ""
324 |
325 | #: database-manage.php:103
326 | msgid "Manage Backup Database"
327 | msgstr ""
328 |
329 | #: database-manage.php:104
330 | msgid "Choose A Backup Date To E-Mail, Restore, Download Or Delete"
331 | msgstr ""
332 |
333 | #: database-manage.php:108 database-manager.php:66
334 | msgid "No."
335 | msgstr ""
336 |
337 | #: database-manage.php:109
338 | msgid "Database File"
339 | msgstr ""
340 |
341 | #: database-manage.php:110
342 | msgid "Date/Time"
343 | msgstr ""
344 |
345 | #: database-manage.php:111
346 | msgid "Size"
347 | msgstr ""
348 |
349 | #: database-manage.php:112
350 | msgid "Select"
351 | msgstr ""
352 |
353 | #: database-manage.php:147 database-manage.php:150
354 | msgid "There Are No Database Backup Files Available."
355 | msgstr ""
356 |
357 | #: database-manage.php:154
358 | #, php-format
359 | msgid "%s Backup File"
360 | msgid_plural "%s Backup Files"
361 | msgstr[0] ""
362 | msgstr[1] ""
363 |
364 | #: database-manage.php:161
365 | msgid "E-mail database backup file to:"
366 | msgstr ""
367 |
368 | #: database-manage.php:166
369 | msgid ""
370 | "You Are About To Restore A Database.\\nThis Action Is Not Reversible.\\nAny "
371 | "Data Inserted After The Backup Date Will Be Gone.\\n\\n Choose [Cancel] to "
372 | "stop, [Ok] to restore."
373 | msgstr ""
374 |
375 | #: database-manage.php:167
376 | msgid ""
377 | "You Are About To Delete The Selected Database Backup Files.\\nThis Action Is "
378 | "Not Reversible.\\n\\n Choose [Cancel] to stop, [Ok] to delete."
379 | msgstr ""
380 |
381 | #: database-manager.php:26 wp-dbmanager.php:43
382 | msgid "Database"
383 | msgstr ""
384 |
385 | #: database-manager.php:27
386 | msgid "Database Information"
387 | msgstr ""
388 |
389 | #: database-manager.php:32
390 | msgid "Setting"
391 | msgstr ""
392 |
393 | #: database-manager.php:37
394 | msgid "Database Host"
395 | msgstr ""
396 |
397 | #: database-manager.php:41
398 | msgid "Database Name"
399 | msgstr ""
400 |
401 | #: database-manager.php:45
402 | msgid "Database User"
403 | msgstr ""
404 |
405 | #: database-manager.php:49
406 | msgid "Database Type"
407 | msgstr ""
408 |
409 | #: database-manager.php:53
410 | msgid "Database Version"
411 | msgstr ""
412 |
413 | #: database-manager.php:61
414 | msgid "Tables Information"
415 | msgstr ""
416 |
417 | #: database-manager.php:68
418 | msgid "Records"
419 | msgstr ""
420 |
421 | #: database-manager.php:69
422 | msgid "Data Usage"
423 | msgstr ""
424 |
425 | #: database-manager.php:70
426 | msgid "Index Usage"
427 | msgstr ""
428 |
429 | #: database-manager.php:71
430 | msgid "Overhead"
431 | msgstr ""
432 |
433 | #: database-manager.php:104
434 | msgid "Total:"
435 | msgstr ""
436 |
437 | #: database-manager.php:105
438 | #, php-format
439 | msgid "%s Table"
440 | msgid_plural "%s Tables"
441 | msgstr[0] ""
442 | msgstr[1] ""
443 |
444 | #: database-manager.php:106
445 | #, php-format
446 | msgid "%s Record"
447 | msgid_plural "%s Records"
448 | msgstr[0] ""
449 | msgstr[1] ""
450 |
451 | #: database-manager.php:112
452 | msgid ""
453 | "Could Not Show Table Status Due To Your MYSQL Version Is Lower Than 3.23."
454 | msgstr ""
455 |
456 | #: database-optimize.php:19 database-optimize.php:81
457 | msgid "Optimize"
458 | msgstr ""
459 |
460 | #: database-optimize.php:29 database-repair.php:30
461 | msgid "No Tables Selected"
462 | msgstr ""
463 |
464 | #: database-optimize.php:36
465 | #, php-format
466 | msgid "Table(s) '%s' NOT Optimized"
467 | msgstr ""
468 |
469 | #: database-optimize.php:38
470 | #, php-format
471 | msgid "Table(s) '%s' Optimized"
472 | msgstr ""
473 |
474 | #: database-optimize.php:55
475 | msgid "Optimize Database"
476 | msgstr ""
477 |
478 | #: database-optimize.php:61 database-repair.php:62
479 | msgid "Options"
480 | msgstr ""
481 |
482 | #: database-optimize.php:78
483 | msgid "Database should be optimize once every month."
484 | msgstr ""
485 |
486 | #: database-repair.php:20 database-repair.php:79
487 | msgid "Repair"
488 | msgstr ""
489 |
490 | #: database-repair.php:37
491 | #, php-format
492 | msgid "Table(s) '%s' NOT Repaired"
493 | msgstr ""
494 |
495 | #: database-repair.php:39
496 | #, php-format
497 | msgid "Table(s) '%s' Repaired"
498 | msgstr ""
499 |
500 | #: database-repair.php:56
501 | msgid "Repair Database"
502 | msgstr ""
503 |
504 | #: database-run.php:24 database-run.php:83
505 | msgid "Run"
506 | msgstr ""
507 |
508 | #: database-run.php:55
509 | msgid "Query(s) Executed Successfully"
510 | msgstr ""
511 |
512 | #: database-run.php:57 database-run.php:60
513 | msgid "Empty Query"
514 | msgstr ""
515 |
516 | #: database-run.php:72 wp-dbmanager.php:51
517 | msgid "Run SQL Query"
518 | msgstr ""
519 |
520 | #: database-run.php:75
521 | msgid "Seperate Multiple Queries With A New Line"
522 | msgstr ""
523 |
524 | #: database-run.php:76
525 | msgid "Use Only INSERT, UPDATE, REPLACE, DELETE, CREATE and ALTER statements."
526 | msgstr ""
527 |
528 | #: database-run.php:87
529 | msgid ""
530 | "1. CREATE statement will return an error, which is perfectly normal due to "
531 | "the database class. To confirm that your table has been created check the "
532 | "Manage Database page."
533 | msgstr ""
534 |
535 | #: database-run.php:88
536 | msgid ""
537 | "2. UPDATE statement may return an error sometimes due to the newly updated "
538 | "value being the same as the previous value."
539 | msgstr ""
540 |
541 | #: database-run.php:89
542 | msgid ""
543 | "3. ALTER statement will return an error because there is no value returned."
544 | msgstr ""
545 |
546 | #: wp-dbmanager.php:46
547 | msgid "Backup DB"
548 | msgstr ""
549 |
550 | #: wp-dbmanager.php:47
551 | msgid "Manage Backup DB"
552 | msgstr ""
553 |
554 | #: wp-dbmanager.php:48
555 | msgid "Optimize DB"
556 | msgstr ""
557 |
558 | #: wp-dbmanager.php:49
559 | msgid "Repair DB"
560 | msgstr ""
561 |
562 | #: wp-dbmanager.php:52
563 | msgid "DB Options"
564 | msgstr ""
565 |
566 | #: wp-dbmanager.php:159
567 | msgid "WP-DBManager Backup Schedule"
568 | msgstr ""
569 |
570 | #: wp-dbmanager.php:160
571 | msgid "WP-DBManager Optimize Schedule"
572 | msgstr ""
573 |
574 | #: wp-dbmanager.php:161
575 | msgid "WP-DBManager Repair Schedule"
576 | msgstr ""
577 |
578 | #: wp-dbmanager.php:179
579 | msgid "Your backup folder is NOT writable"
580 | msgstr ""
581 |
582 | #: wp-dbmanager.php:180
583 | #, php-format
584 | msgid "To correct this issue, make the folder %s writable."
585 | msgstr ""
586 |
587 | #: wp-dbmanager.php:183
588 | msgid "Your backup folder MIGHT be visible to the public"
589 | msgstr ""
590 |
591 | #: wp-dbmanager.php:184
592 | #, php-format
593 | msgid ""
594 | "To correct this issue, move the file from %s to %s"
595 | "strong>"
596 | msgstr ""
597 |
598 | #: wp-dbmanager.php:266
599 | msgid "Website Name:"
600 | msgstr ""
601 |
602 | #: wp-dbmanager.php:267
603 | msgid "Website URL:"
604 | msgstr ""
605 |
606 | #: wp-dbmanager.php:268
607 | msgid "Backup File Name:"
608 | msgstr ""
609 |
610 | #: wp-dbmanager.php:269
611 | msgid "Backup File Date:"
612 | msgstr ""
613 |
614 | #: wp-dbmanager.php:270
615 | msgid "Backup File Size:"
616 | msgstr ""
617 |
618 | #: wp-dbmanager.php:271
619 | msgid "With Regards,"
620 | msgstr ""
621 |
622 | #: wp-dbmanager.php:272 wp-dbmanager.php:365
623 | msgid "Administrator"
624 | msgstr ""
625 |
626 | #: wp-dbmanager.php:290
627 | msgid "GiB"
628 | msgstr ""
629 |
630 | #: wp-dbmanager.php:292
631 | msgid "MiB"
632 | msgstr ""
633 |
634 | #: wp-dbmanager.php:294
635 | msgid "KiB"
636 | msgstr ""
637 |
638 | #: wp-dbmanager.php:296
639 | msgid "bytes"
640 | msgstr ""
641 |
642 | #: wp-dbmanager.php:368
643 | msgid "%SITE_NAME% Database Backup File For %POST_DATE% @ %POST_TIME%"
644 | msgstr ""
645 |
646 | #: wp-dbmanager.php:501
647 | msgid "Database Options Updated"
648 | msgstr ""
649 |
650 | #: wp-dbmanager.php:504
651 | msgid "No Database Option Updated"
652 | msgstr ""
653 |
654 | #: wp-dbmanager.php:562
655 | msgid "Database Options"
656 | msgstr ""
657 |
658 | #: wp-dbmanager.php:563
659 | msgid "Paths"
660 | msgstr ""
661 |
662 | #: wp-dbmanager.php:566
663 | msgid "Path To mysqldump:"
664 | msgstr ""
665 |
666 | #: wp-dbmanager.php:568 wp-dbmanager.php:575
667 | msgid "Auto Detect"
668 | msgstr ""
669 |
670 | #: wp-dbmanager.php:569
671 | msgid ""
672 | "The absolute path to mysqldump without trailing slash. If unsure, please "
673 | "email your server administrator about this."
674 | msgstr ""
675 |
676 | #: wp-dbmanager.php:573
677 | msgid "Path To mysql:"
678 | msgstr ""
679 |
680 | #: wp-dbmanager.php:576
681 | msgid ""
682 | "The absolute path to mysql without trailing slash. If unsure, please email "
683 | "your server administrator about this."
684 | msgstr ""
685 |
686 | #: wp-dbmanager.php:580
687 | msgid "Path To Backup:"
688 | msgstr ""
689 |
690 | #: wp-dbmanager.php:583
691 | msgid ""
692 | "The absolute path to your database backup folder without trailing slash. "
693 | "Make sure the folder is writable."
694 | msgstr ""
695 |
696 | #: wp-dbmanager.php:587
697 | msgid "Maximum Backup Files:"
698 | msgstr ""
699 |
700 | #: wp-dbmanager.php:590
701 | msgid ""
702 | "The maximum number of database backup files that is allowed in the backup "
703 | "folder as stated above. The oldest database backup file is always deleted in "
704 | "order to maintain this value. This is to prevent the backup folder from "
705 | "getting too large."
706 | msgstr ""
707 |
708 | #: wp-dbmanager.php:595 wp-dbmanager.php:613
709 | msgid "Note"
710 | msgstr ""
711 |
712 | #: wp-dbmanager.php:599
713 | msgid "Windows Server"
714 | msgstr ""
715 |
716 | #: wp-dbmanager.php:600
717 | msgid "For mysqldump path, you can try 'mysqldump.exe '."
718 | msgstr ""
719 |
720 | #: wp-dbmanager.php:601
721 | msgid "For mysql path, you can try 'mysql.exe '."
722 | msgstr ""
723 |
724 | #: wp-dbmanager.php:606
725 | msgid "Linux Server"
726 | msgstr ""
727 |
728 | #: wp-dbmanager.php:607
729 | msgid "For mysqldump path, normally is just 'mysqldump '."
730 | msgstr ""
731 |
732 | #: wp-dbmanager.php:608
733 | msgid "For mysql path, normally is just 'mysql '."
734 | msgstr ""
735 |
736 | #: wp-dbmanager.php:614
737 | msgid ""
738 | "The 'Auto Detect' function does not work for some servers. If it does not "
739 | "work for you, please contact your server administrator for the MYSQL and "
740 | "MYSQL DUMP paths."
741 | msgstr ""
742 |
743 | #: wp-dbmanager.php:619
744 | msgid "Automatic Scheduling"
745 | msgstr ""
746 |
747 | #: wp-dbmanager.php:622
748 | msgid "Automatic Backing Up Of DB:"
749 | msgstr ""
750 |
751 | #: wp-dbmanager.php:625
752 | msgid "Next backup date: "
753 | msgstr ""
754 |
755 | #: wp-dbmanager.php:629 wp-dbmanager.php:659 wp-dbmanager.php:684
756 | msgid "N/A"
757 | msgstr ""
758 |
759 | #: wp-dbmanager.php:633 wp-dbmanager.php:663 wp-dbmanager.php:688
760 | msgid "Every"
761 | msgstr ""
762 |
763 | #: wp-dbmanager.php:635 wp-dbmanager.php:665 wp-dbmanager.php:690
764 | msgid "Disable"
765 | msgstr ""
766 |
767 | #: wp-dbmanager.php:636 wp-dbmanager.php:666 wp-dbmanager.php:691
768 | msgid "Minutes(s)"
769 | msgstr ""
770 |
771 | #: wp-dbmanager.php:637 wp-dbmanager.php:667 wp-dbmanager.php:692
772 | msgid "Hour(s)"
773 | msgstr ""
774 |
775 | #: wp-dbmanager.php:638 wp-dbmanager.php:668 wp-dbmanager.php:693
776 | msgid "Day(s)"
777 | msgstr ""
778 |
779 | #: wp-dbmanager.php:639 wp-dbmanager.php:669 wp-dbmanager.php:694
780 | msgid "Week(s)"
781 | msgstr ""
782 |
783 | #: wp-dbmanager.php:640 wp-dbmanager.php:670 wp-dbmanager.php:695
784 | msgid "Month(s)"
785 | msgstr ""
786 |
787 | #: wp-dbmanager.php:642
788 | msgid "Gzip"
789 | msgstr ""
790 |
791 | #: wp-dbmanager.php:648
792 | msgid ""
793 | "WP-DBManager can automatically backup your database after a certain period."
794 | msgstr ""
795 |
796 | #: wp-dbmanager.php:652
797 | msgid "Automatic Optimizing Of DB:"
798 | msgstr ""
799 |
800 | #: wp-dbmanager.php:655
801 | msgid "Next optimize date: "
802 | msgstr ""
803 |
804 | #: wp-dbmanager.php:673
805 | msgid ""
806 | "WP-DBManager can automatically optimize your database after a certain period."
807 | msgstr ""
808 |
809 | #: wp-dbmanager.php:677
810 | msgid "Automatic Repairing Of DB:"
811 | msgstr ""
812 |
813 | #: wp-dbmanager.php:680
814 | msgid "Next repair date: "
815 | msgstr ""
816 |
817 | #: wp-dbmanager.php:698
818 | msgid ""
819 | "WP-DBManager can automatically repair your database after a certain period."
820 | msgstr ""
821 |
822 | #: wp-dbmanager.php:703
823 | msgid "Backup Email Options"
824 | msgstr ""
825 |
826 | #: wp-dbmanager.php:706
827 | msgid "To"
828 | msgstr ""
829 |
830 | #: wp-dbmanager.php:709
831 | msgid "To E-mail"
832 | msgstr ""
833 |
834 | #: wp-dbmanager.php:711
835 | msgid "(Leave blank to disable this feature)"
836 | msgstr ""
837 |
838 | #: wp-dbmanager.php:715
839 | msgid "From"
840 | msgstr ""
841 |
842 | #: wp-dbmanager.php:718
843 | msgid "From Name"
844 | msgstr ""
845 |
846 | #: wp-dbmanager.php:719
847 | msgid "From E-mail"
848 | msgstr ""
849 |
850 | #: wp-dbmanager.php:721 wp-dbmanager.php:730
851 | msgid "(Leave blank to use the default)"
852 | msgstr ""
853 |
854 | #: wp-dbmanager.php:725
855 | msgid "Subject:"
856 | msgstr ""
857 |
858 | #: wp-dbmanager.php:728
859 | msgid "Subject"
860 | msgstr ""
861 |
862 | #: wp-dbmanager.php:735
863 | msgid "Miscellaneous Options"
864 | msgstr ""
865 |
866 | #: wp-dbmanager.php:738
867 | msgid "Hide Admin Notices"
868 | msgstr ""
869 |
870 | #: wp-dbmanager.php:749
871 | msgid "Save Changes"
872 | msgstr ""
873 |
--------------------------------------------------------------------------------