WP-DBManager - Version 2.11

Version Description

Download this release

Release Info

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

Code changes from version 2.00 to 2.11

.htaccess ADDED
@@ -0,0 +1,4 @@
 
 
 
 
1
+ <Files ~ ".*\..*">
2
+ order allow,deny
3
+ deny from all
4
+ </Files>
database-manager.php DELETED
@@ -1,601 +0,0 @@
1
- <?php
2
- /*
3
- +----------------------------------------------------------------+
4
- | |
5
- | WordPress 2.0 Plugin: WP-DBManager 2.00 |
6
- | Copyright (c) 2005 Lester "GaMerZ" Chan |
7
- | |
8
- | File Written By: |
9
- | - Lester "GaMerZ" Chan |
10
- | - http://www.lesterchan.net |
11
- | |
12
- | File Information: |
13
- | - Manage Your WordPress Database |
14
- | - wp-admin/database-manager.php |
15
- | |
16
- +----------------------------------------------------------------+
17
- */
18
-
19
-
20
- ### Require Admin Header
21
- require_once('./admin.php');
22
-
23
-
24
- ### Variables Variables Variables
25
- $title = __('Manage Database');
26
- $this_file = 'database-manager.php';
27
- $parent_file = 'database-manager.php';
28
- $mode = trim($_GET['mode']);
29
- $backup = array();
30
- $backup['date'] = time();
31
- $backup['mysqldumppath'] = 'mysqldump';
32
- $backup['mysqlpath'] = 'mysql';
33
- $backup['path'] = ABSPATH.'wp-backup-db/';
34
-
35
-
36
- ### Cancel
37
- if(isset($_POST['cancel'])) {
38
- Header('Location: database-manager.php');
39
- exit();
40
- }
41
-
42
-
43
- ### Format Bytes Into KB/MB
44
- function format_size($rawSize) {
45
- if ($rawSize / 1048576 > 1)
46
- return round($rawSize/1048576, 1) . ' MB';
47
- else if ($rawSize / 1024 > 1)
48
- return round($rawSize/1024, 1) . ' KB';
49
- else
50
- return round($rawSize, 1) . ' bytes';
51
- }
52
-
53
-
54
- ### Check Folder Whether There Is Any File Inside
55
- function is_emtpy_folder($folder){
56
- if(is_dir($folder) ){
57
- $handle = opendir($folder);
58
- while( (gettype( $name = readdir($handle)) != 'boolean')){
59
- $name_array[] = $name;
60
- }
61
- foreach($name_array as $temp)
62
- $folder_content .= $temp;
63
-
64
- if($folder_content == '...')
65
- return true;
66
- else
67
- return false;
68
- closedir($handle);
69
- }
70
- else
71
- return true; // folder doesnt exist
72
- }
73
-
74
-
75
- ### Form Processing
76
- if($_POST['do']) {
77
- // Lets Prepare The Variables
78
- $database_file = trim($_POST['database_file']);
79
- $optimize = $_POST['optimize'];
80
- $delete = $_POST['delete'];
81
- $nice_file_date = date('l, jS F Y @ H:i', substr($database_file, 0, 10));
82
-
83
- // Decide What To Do
84
- switch($_POST['do']) {
85
- case 'Backup':
86
- $gzip = intval($_POST['gzip']);
87
- if($gzip == 1) {
88
- $backup['filename'] = $backup['date'].'_-_'.DB_NAME.'.sql.gz';
89
- $backup['filepath'] = $backup['path'].'/'.$backup['filename'];
90
- $backup['command'] = $backup['mysqldumppath'].' -h'.DB_HOST.' -u'.DB_USER.' -p'.DB_PASSWORD.' --add-drop-table '.DB_NAME.' | gzip > '.$backup['filepath'];
91
- } else {
92
- $backup['filename'] = $backup['date'].'_-_'.DB_NAME.'.sql';
93
- $backup['filepath'] = $backup['path'].'/'.$backup['filename'];
94
- $backup['command'] = $backup['mysqldumppath'].' -h'.DB_HOST.' -u'.DB_USER.' -p'.DB_PASSWORD.' --add-drop-table '.DB_NAME.' > '.$backup['filepath'];
95
- }
96
- passthru($backup['command'], $error);
97
- if(!is_writable($backup['path'])) {
98
- $text = "<font color=\"red\">Database Failed To Backup On '".date('l, jS F Y @ H:i')."'. Backup Folder Not Writable</font>";
99
- } elseif(filesize($backup['filepath']) == 0) {
100
- unlink($backup['filepath']);
101
- $text = "<font color=\"red\">Database Failed To Backup On '".date('l, jS F Y @ H:i')."'. Backup File Size Is 0KB</font>";
102
- } elseif(!is_file($backup['filepath'])) {
103
- $text = "<font color=\"red\">Database Failed To Backup On '".date('l, jS F Y @ H:i')."'. Invalid Backup File Path</font>";
104
- } elseif($error) {
105
- $text = "<font color=\"red\">Database Failed To Backup On '".date('l, jS F Y @ H:i')."'</font>";
106
- } else {
107
- $text = "<font color=\"green\">Database Backed Up Successfully On '".date('l, jS F Y @ H:i')."'</font>";
108
- }
109
- break;
110
- case 'Restore':
111
- if(!empty($database_file)) {
112
- if(stristr($database_file, '.gz')) {
113
- $backup['command'] = 'gunzip < '.$backup['path'].'/'.$database_file.' | '.$backup['mysqlpath'].' -h'.DB_HOST.' -u'.DB_USER.' -p'.DB_PASSWORD.' '.DB_NAME;
114
- } else {
115
- $backup['command'] = $backup['mysqlpath'].' -h'.DB_HOST.' -u'.DB_USER.' -p'.DB_PASSWORD.' '.DB_NAME.' < '.$backup['path'].'/'.$database_file;
116
- }
117
- passthru($backup['command'], $error);
118
- if($error) {
119
- $text = "<font color=\"red\">Database On '$nice_file_date' Failed To Restore</font>";
120
- } else {
121
- $text = "<font color=\"green\">Database On '$nice_file_date' Restored Successfully</font>";
122
- }
123
- } else {
124
- $text = '<font color="red">No Backup Database File Selected</font>';
125
- }
126
- break;
127
- case 'Delete':
128
- if(!empty($delete)) {
129
- foreach($delete as $dbbackup) {
130
- $nice_file_date = date('l, jS F Y @ H:i', substr($dbbackup, 0, 10));
131
- if(is_file($backup['path'].'/'.$dbbackup)) {
132
- if(!unlink($backup['path'].'/'.$dbbackup)) {
133
- $text .= "<font color=\"red\">Unable To Delete Database Backup File On '$nice_file_date'</font><br />";
134
- } else {
135
- $text .= "<font color=\"green\">Database Backup File On '$nice_file_date' Deleted Successfully</font><br />";
136
- }
137
- } else {
138
- $text = "<font color=\"red\">Invalid Database Backup File On '$nice_file_date'</font>";
139
- }
140
- }
141
- } else {
142
- $text = '<font color="red">No Backup Database File Selected</font>';
143
- }
144
- break;
145
- case 'Download':
146
- if(!empty($database_file)) {
147
- $file_path = $backup['path'].'/'.$database_file;
148
- $nice_file_name = date('jS_F_Y', substr($database_file, 0, 10)).'-'.substr($database_file, 13);
149
- header("Pragma: public");
150
- header("Expires: 0");
151
- header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
152
- header("Content-Type: application/force-download");
153
- header("Content-Type: application/octet-stream");
154
- header("Content-Type: application/download");
155
- header("Content-Disposition: attachment; filename=".basename($nice_file_name).";");
156
- header("Content-Transfer-Encoding: binary");
157
- header("Content-Length: ".filesize($file_path));
158
- @readfile($file_path);
159
- } else {
160
- $text = '<font color="red">No Backup Database File Selected</font>';
161
- }
162
- break;
163
- case 'Optimize':
164
- foreach($optimize as $key => $value) {
165
- if($value == 'yes') {
166
- $tables_string .= ', '.$key;
167
- }
168
- }
169
- $selected_tables = substr($tables_string, 2);
170
- if(!empty($selected_tables)) {
171
- $optimize2 = $wpdb->query("OPTIMIZE TABLE $selected_tables");
172
- if(!$optimize2) {
173
- $text = "<font color=\"red\">Table(s) '$selected_tables' Failed To Be Optimized</font>";
174
- } else {
175
- $text = "<font color=\"green\">Table(s) '$selected_tables' Optimized Successfully</font>";
176
- }
177
- } else {
178
- $text = '<font color="red">No Tables Selected</font>';
179
- }
180
- break;
181
- case 'Run':
182
- $sql_queries2 = trim($_POST['sql_query']);
183
- $totalquerycount = 0;
184
- $successquery = 0;
185
- if($sql_queries2) {
186
- $sql_queries = array();
187
- $sql_queries2 = explode("\n", $sql_queries2);
188
- foreach($sql_queries2 as $sql_query2) {
189
- $sql_query2 = trim(stripslashes($sql_query2));
190
- $sql_query2 = preg_replace("/[\r\n]+/", '', $sql_query2);
191
- if(!empty($sql_query2)) {
192
- $sql_queries[] = $sql_query2;
193
- }
194
- }
195
- if($sql_queries) {
196
- foreach($sql_queries as $sql_query) {
197
- if (preg_match("/^\\s*(insert|update|replace|delete|create) /i",$sql_query)) {
198
- $run_query = $wpdb->query($sql_query);
199
- if(!$run_query) {
200
- $text .= "<font color=\"red\">$sql_query</font><br />";
201
- } else {
202
- $successquery++;
203
- $text .= "<font color=\"green\">$sql_query</font><br />";
204
- }
205
- $totalquerycount++;
206
- } elseif (preg_match("/^\\s*(select|drop|show|grant) /i",$sql_query)) {
207
- $text .= "<font color=\"red\">$sql_query</font><br />";
208
- $totalquerycount++;
209
- }
210
- }
211
- $text .= "<font color=\"blue\">$successquery/$totalquerycount Query(s) Executed Successfully</font>";
212
- } else {
213
- $text = "<font color=\"red\">Empty Query</font>";
214
- }
215
- } else {
216
- $text = "<font color=\"red\">Empty Query</font>";
217
- }
218
- break;
219
- }
220
- }
221
-
222
-
223
- ### Switch $mode
224
- switch($mode) {
225
- // Backup Database
226
- case 'backup':
227
- $title = __('Backup Database');
228
- require("./admin-header.php");
229
- $backup['filename'] = $backup['date'].'_-_'.DB_NAME.'.sql';
230
- ?>
231
- <ul id="submenu">
232
- <li><a href="database-manager.php"><?php _e('Manage Database'); ?></a></li>
233
- <li><a href="database-manager.php?mode=backup" class="current"><?php _e('Backup DB'); ?></a></li>
234
- <li><a href="database-manager.php?mode=optimize"><?php _e('Optimize DB'); ?></a></li>
235
- <li><a href="database-manager.php?mode=restore"><?php _e('Restore/Download DB'); ?></a></li>
236
- <li><a href="database-manager.php?mode=delete"><?php _e('Delete Backup DB'); ?></a></li>
237
- <li class="last"><a href="database-manager.php?mode=run"><?php _e('Run SQL Query'); ?></a></li>
238
- </ul>
239
- <!-- Backup Database -->
240
- <div class="wrap">
241
- <h2>Backup Database</h2>
242
- <form action="<?=$_SERVER['PHP_SELF']?>" method="post">
243
- <table width="100%" cellspacing="3" cellpadding="3" border="0">
244
- <tr style='background-color: #eee'>
245
- <th align="left" scope="row">Database Name:</th>
246
- <td><?=DB_NAME?></td>
247
- </tr>
248
- <tr style='background-color: none'>
249
- <th align="left" scope="row">Database Backup To:</th>
250
- <td><?=$backup['path']?></td>
251
- </tr>
252
- <tr style='background-color: #eee'>
253
- <th align="left" scope="row">Database Backup Date:</th>
254
- <td><?=date('jS F Y', $backup['date'])?></td>
255
- </tr>
256
- <tr style='background-color: none'>
257
- <th align="left" scope="row">Database Backup File Name:</th>
258
- <td><?=$backup['filename']?> / <?=date('jS_F_Y', substr($backup['filename'], 0, 10)).'-'.substr($backup['filename'], 13);?></td>
259
- </tr>
260
- <tr style='background-color: #eee'>
261
- <th align="left" scope="row">Database Backup Type:</th>
262
- <td>Full (Structure and Data)</td>
263
- </tr>
264
- <tr style='background-color: none'>
265
- <th align="left" scope="row">MYSQL Dump Location</th>
266
- <td><?=$backup['mysqldumppath']?></td>
267
- </tr>
268
- <tr style='background-color: #eee'>
269
- <th align="left" scope="row">GZIP Database Backup File?</th>
270
- <td><input type="radio" name="gzip" value="1">Yes&nbsp;&nbsp;<input type="radio" name="gzip" value="0" CHECKED>No</td>
271
- </tr>
272
- <tr>
273
- <td colspan="2" align="center"><input type="submit" name="do" value="Backup" class="button">&nbsp;&nbsp;<input type="submit" name="cancel" Value="Cancel" class="button"></td>
274
- </tr>
275
- </table>
276
- </form>
277
- </div>
278
- <?php
279
- break;
280
- // Optimize Database
281
- case 'optimize':
282
- $title = __('Optimize Database');
283
- require("./admin-header.php");
284
- $tables = $wpdb->get_results("SHOW TABLES");
285
- ?>
286
- <ul id="submenu">
287
- <li><a href="database-manager.php"><?php _e('Manage Database'); ?></a></li>
288
- <li><a href="database-manager.php?mode=backup"><?php _e('Backup DB'); ?></a></li>
289
- <li><a href="database-manager.php?mode=optimize" class="current"><?php _e('Optimize DB'); ?></a></li>
290
- <li><a href="database-manager.php?mode=restore"><?php _e('Restore/Download DB'); ?></a></li>
291
- <li><a href="database-manager.php?mode=delete"><?php _e('Delete Backup DB'); ?></a></li>
292
- <li class="last"><a href="database-manager.php?mode=run"><?php _e('Run SQL Query'); ?></a></li>
293
- </ul>
294
- <!-- Optimize Database -->
295
- <div class="wrap">
296
- <h2>Optimize Database</h2>
297
- <form action="<?=$_SERVER['PHP_SELF']?>" method="post">
298
- <table width="100%" cellspacing="3" cellpadding="3" border="0">
299
- <tr>
300
- <th align="left" scope="col">Tables</th>
301
- <th align="left" scope="col">Options</th>
302
- </tr>
303
- <?php
304
- foreach($tables as $dbtable) {
305
- if($no%2 == 0) {
306
- $style = 'style=\'background-color: #eee\'';
307
- } else {
308
- $style = 'style=\'background-color: none\'';
309
- }
310
- $no++;
311
- $table_name = '$dbtable->Tables_in_'.DB_NAME;
312
- eval("\$table_name = \"$table_name\";");
313
- echo "<tr $style><th align=\"left\" scope=\"row\">$table_name</th>\n";
314
- echo "<td><input type=\"radio\" name=\"optimize[$table_name]\" value=\"no\">No&nbsp;&nbsp;<input type=\"radio\" name=\"optimize[$table_name]\" value=\"yes\" CHECKED>Yes</td></tr>";
315
- }
316
- ?>
317
- <tr>
318
- <td colspan="2" align="center">Database should be optimize once every month.</td>
319
- </tr>
320
- <tr>
321
- <td colspan="2" align="center"><input type="submit" name="do" value="Optimize" class="button">&nbsp;&nbsp;<input type="submit" name="cancel" Value="Cancel" class="button"></td>
322
- </tr>
323
- </table>
324
- </form>
325
- </div>
326
- <?php
327
- break;
328
- // Restore Database
329
- case 'restore':
330
- $title = __('Restore/Download Database');
331
- require("./admin-header.php");
332
- ?>
333
- <ul id="submenu">
334
- <li><a href="database-manager.php"><?php _e('Manage Database'); ?></a></li>
335
- <li><a href="database-manager.php?mode=backup"><?php _e('Backup DB'); ?></a></li>
336
- <li><a href="database-manager.php?mode=optimize"><?php _e('Optimize DB'); ?></a></li>
337
- <li><a href="database-manager.php?mode=restore" class="current"><?php _e('Restore/Download DB'); ?></a></li>
338
- <li><a href="database-manager.php?mode=delete"><?php _e('Delete Backup DB'); ?></a></li>
339
- <li class="last"><a href="database-manager.php?mode=run"><?php _e('Run SQL Query'); ?></a></li>
340
- </ul>
341
- <!-- Restore/Download Database -->
342
- <div class="wrap">
343
- <h2>Restore/Download Database</h2>
344
- <form action="<?=$_SERVER['PHP_SELF']?>" method="post">
345
- <table width="100%" cellspacing="3" cellpadding="3" border="0">
346
- <tr>
347
- <th align="left" scope="row" colspan="5">Choose A Backup Date To Restore Or Download</th>
348
- </tr>
349
- <tr>
350
- <th align="left" scope="col">No.</th>
351
- <th align="left" scope="col">Database File</th>
352
- <th align="left" scope="col">Date/Time</th>
353
- <th align="left" scope="col">Size</th>
354
- <th align="left" scope="col">Select</th>
355
- </tr>
356
- <?php
357
- if(!is_emtpy_folder($backup['path'])) {
358
- if ($handle = opendir($backup['path'])) {
359
- $database_files = array();
360
- while (false !== ($file = readdir($handle))) {
361
- if ($file != '.' && $file != '..') {
362
- $database_files[] = $file;
363
- }
364
- }
365
- closedir($handle);
366
- for($i = (sizeof($database_files)-1); $i > -1; $i--) {
367
- if($no%2 == 0) {
368
- $style = 'style=\'background-color: #eee\'';
369
- } else {
370
- $style = 'style=\'background-color: none\'';
371
- }
372
- $no++;
373
- $database_text = substr($database_files[$i], 13);
374
- $date_text = date('l, jS F Y @ H:i', substr($database_files[$i], 0, 10));
375
- $size_text = filesize($backup['path'].'/'.$database_files[$i]);
376
- echo "<tr $style>\n<td>$no</td>";
377
- echo "<td>$database_text</td>";
378
- echo "<td>$date_text</td>";
379
- echo '<td>'.format_size($size_text).'</td>';
380
- echo "<td><input type=\"radio\" name=\"database_file\" value=\"$database_files[$i]\" /></td>\n</tr>\n";
381
- $totalsize += $size_text;
382
- }
383
- } else {
384
- echo '<tr><td align="center" colspan="5">There Are No Database Backup Files Available</td></tr>';
385
- }
386
- } else {
387
- echo '<tr><td align="center" colspan="5">There Are No Database Backup Files Available</td></tr>';
388
- }
389
- ?>
390
- </tr>
391
- <tr>
392
- <th align="left" colspan="3"><?=$no?> Backup File(s)</th>
393
- <th align="left"><?=format_size($totalsize)?></th>
394
- <td>&nbsp;</td>
395
- </tr>
396
- <tr>
397
- <td colspan="5" align="center"><input type="submit" name="do" value="Download" class="button">&nbsp;&nbsp;<input type="submit" class="button" name="do" value="Restore" onclick="return confirm('You Are About To Restore A Database.\nThis Action Is Not Reversible.\nAny Data Inserted After The Backup Date Will Be Gone.\n\n Choose \'Cancel\' to stop, \'OK\' to restore.')" class="button">&nbsp;&nbsp;<input type="submit" name="cancel" Value="Cancel" class="button"></td>
398
- </tr>
399
- </table>
400
- </form>
401
- </div>
402
- <?php
403
- break;
404
- // Delete Database Backup Files
405
- case 'delete':
406
- $title = __('Delete Backup Database');
407
- require("./admin-header.php");
408
- ?>
409
- <ul id="submenu">
410
- <li><a href="database-manager.php"><?php _e('Manage Database'); ?></a></li>
411
- <li><a href="database-manager.php?mode=backup"><?php _e('Backup DB'); ?></a></li>
412
- <li><a href="database-manager.php?mode=optimize"><?php _e('Optimize DB'); ?></a></li>
413
- <li><a href="database-manager.php?mode=restore"><?php _e('Restore/Download DB'); ?></a></li>
414
- <li><a href="database-manager.php?mode=delete" class="current"><?php _e('Delete Backup DB'); ?></a></li>
415
- <li class="last"><a href="database-manager.php?mode=run"><?php _e('Run SQL Query'); ?></a></li>
416
- </ul>
417
- <!-- Delete Database Backup Files -->
418
- <div class="wrap">
419
- <h2>Delete Database Backup Files</h2>
420
- <form action="<?=$_SERVER['PHP_SELF']?>" method="post">
421
- <table width="100%" cellspacing="3" cellpadding="3" border="0">
422
- <tr>
423
- <th align="left" scope="row" colspan="5">Choose Database Backup Files To Delete</th>
424
- </tr>
425
- <tr>
426
- <th align="left" scope="col">No.</th>
427
- <th align="left" scope="col">Database File</th>
428
- <th align="left" scope="col">Date/Time</th>
429
- <th align="left" scope="col">Size</th>
430
- <th align="left" scope="col">Select</th>
431
- </tr>
432
- <?php
433
- if(!is_emtpy_folder($backup['path'])) {
434
- if ($handle = opendir($backup['path'])) {
435
- $database_files = array();
436
- while (false !== ($file = readdir($handle))) {
437
- if ($file != '.' && $file != '..') {
438
- $database_files[] = $file;
439
- }
440
- }
441
- closedir($handle);
442
- for($i = (sizeof($database_files)-1); $i > -1; $i--) {
443
- if($no%2 == 0) {
444
- $style = 'style=\'background-color: #eee\'';
445
- } else {
446
- $style = 'style=\'background-color: none\'';
447
- }
448
- $no++;
449
- $database_text = substr($database_files[$i], 13);
450
- $date_text = date('l, jS F Y @ H:i', substr($database_files[$i], 0, 10));
451
- $size_text = filesize($backup['path'].'/'.$database_files[$i]);
452
- echo "<tr $style>\n<td>$no</td>";
453
- echo "<td>$database_text</td>";
454
- echo "<td>$date_text</td>";
455
- echo '<td>'.format_size($size_text).'</td>';
456
- echo "<td><input type=\"checkbox\" name=\"delete[]\" value=\"$database_files[$i]\" /></td>\n</tr>\n";
457
- $totalsize += $size_text;
458
- }
459
- } else {
460
- echo '<tr><td align="center" colspan="5">There Are No Database Backup Files Available</td></tr>';
461
- }
462
- } else {
463
- echo '<tr><td align="center" colspan="5">There Are No Database Backup Files Available</td></tr>';
464
- }
465
- ?>
466
- </tr>
467
- <tr>
468
- <th align="left" colspan="3"><?=$no?> Backup File(s)</th>
469
- <th align="left"><?=format_size($totalsize)?></th>
470
- <td>&nbsp;</td>
471
- </tr>
472
- <tr>
473
- <td colspan="5" align="center"><input type="submit" class="button" name="do" value="Delete" onclick="return confirm('You Are About To Delete The Selected Database Backup Files.\nThis Action Is Not Reversible.\n\n Choose \'Cancel\' to stop, \'OK\' to delete.')">&nbsp;&nbsp;<input type="submit" name="cancel" Value="Cancel" class="button"></td>
474
- </tr>
475
- </table>
476
- </form>
477
- </div>
478
- <?php
479
- break;
480
- // Run SQL Query
481
- case 'run':
482
- $title = __('Run SQL Query');
483
- require("./admin-header.php");
484
- ?>
485
- <ul id="submenu">
486
- <li><a href="database-manager.php"><?php _e('Manage Database'); ?></a></li>
487
- <li><a href="database-manager.php?mode=backup"><?php _e('Backup DB'); ?></a></li>
488
- <li><a href="database-manager.php?mode=optimize"><?php _e('Optimize DB'); ?></a></li>
489
- <li><a href="database-manager.php?mode=restore"><?php _e('Restore/Download DB'); ?></a></li>
490
- <li><a href="database-manager.php?mode=delete"><?php _e('Delete Backup DB'); ?></a></li>
491
- <li class="last"><a href="database-manager.php?mode=run" class="current"><?php _e('Run SQL Query'); ?></a></li>
492
- </ul>
493
- <!-- Run SQL Query -->
494
- <div class="wrap">
495
- <h2>Run SQL Query</h2>
496
- <form action="<?=$_SERVER['PHP_SELF']?>" method="post">
497
- <p><b>Seperate Multiple Queries With A New Line</b><br /><font color="green">Use Only INSERT, UPDATE, REPLACE, DELETE and CREATE statements.</font></p>
498
- <p align="center"><textarea cols="150" rows="30" name="sql_query"></textarea></p>
499
- <p align="center"><input type="submit" name="do" Value="Run" class="button">&nbsp;&nbsp;<input type="submit" name="cancel" Value="Cancel" class="button"></p>
500
- <p>1. CREATE statement will return an error, which is perfectly normal due to the database class. To confirm that your table has been created check the Manage Database page.<br />2. UPDATE statement may return an error sometimes due to the newly updated value being the same as the previous value.</font></p>
501
- </form>
502
- </div>
503
- <?php
504
- break;
505
- // Database Information
506
- default:
507
- $title = __('Manage Database');
508
- require("./admin-header.php");
509
- // Get MYSQL Version
510
- $sqlversion = $wpdb->get_var("SELECT VERSION() AS version");
511
- ?>
512
- <ul id="submenu">
513
- <li><a href="database-manager.php" class="current"><?php _e('Manage Database'); ?></a></li>
514
- <li><a href="database-manager.php?mode=backup"><?php _e('Backup DB'); ?></a></li>
515
- <li><a href="database-manager.php?mode=optimize"><?php _e('Optimize DB'); ?></a></li>
516
- <li><a href="database-manager.php?mode=restore"><?php _e('Restore/Download DB'); ?></a></li>
517
- <li><a href="database-manager.php?mode=delete"><?php _e('Delete Backup DB'); ?></a></li>
518
- <li class="last"><a href="database-manager.php?mode=run"><?php _e('Run SQL Query'); ?></a></li>
519
- </ul>
520
- <?php if(!empty($text)) { echo '<!-- Last Action --><div id="message" class="updated fade"><p>'.$text.'</p></div>'; } ?>
521
- <!-- Database Information -->
522
- <div class="wrap">
523
- <h2>Database Information</h2>
524
- <table width="100%" cellspacing="3" cellpadding="3" border="0">
525
- <tr>
526
- <th align="left" scope="col">Setting</th>
527
- <th align="left" scope="col">Value</th>
528
- </tr>
529
- <tr>
530
- <td>Database Host</td>
531
- <td><?=DB_HOST?></td>
532
- </tr>
533
- <tr>
534
- <td>Database Name</td>
535
- <td><?=DB_NAME?></td>
536
- </tr>
537
- <tr>
538
- <td>Database User</td>
539
- <td><?=DB_USER?></td>
540
- </tr>
541
- <tr>
542
- <td>Database Type</td>
543
- <td>MYSQL</td>
544
- </tr>
545
- <tr>
546
- <td>Database Version</td>
547
- <td>v<?=$sqlversion?></td>
548
- </tr>
549
- </table>
550
- </div>
551
- <div class="wrap">
552
- <h2>Tables Information</h2>
553
- <table width="100%" cellspacing="3" cellpadding="3" border="0">
554
- <tr>
555
- <th align="left" scope="col">No.</th>
556
- <th align="left" scope="col">Tables</th>
557
- <th align="left" scope="col">Records</th>
558
- <th align="left" scope="col">Data Usage</th>
559
- <th align="left" scope="col">Index Usage</th>
560
- <th align="left" scope="col">Overhead</th>
561
- </tr>
562
- <?php
563
- // If MYSQL Version More Than 3.23, Get More Info
564
- if($sqlversion >= '3.23') {
565
- $tablesstatus = $wpdb->get_results("SHOW TABLE STATUS");
566
- foreach($tablesstatus as $tablestatus) {
567
- if($no%2 == 0) {
568
- $style = 'style=\'background-color: #eee\'';
569
- } else {
570
- $style = 'style=\'background-color: none\'';
571
- }
572
- $no++;
573
- echo "<tr $style>\n<td>$no</td>\n";
574
- echo "<td>$tablestatus->Name</td>\n";
575
- echo "<td>".number_format($tablestatus->Rows)."</td>\n";
576
- echo "<td>".format_size($tablestatus->Data_length)."</td>\n";
577
- echo "<td>".format_size($tablestatus->Index_length)."</td>\n";
578
- echo "<td>".format_size($tablestatus->Data_free)."</td>\n";
579
- $row_usage += $tablestatus->Rows;
580
- $data_usage += $tablestatus->Data_length;
581
- $index_usage += $tablestatus->Index_length;
582
- $overhead_usage += $tablestatus->Data_free;
583
- }
584
- echo "<tr><th align=\"left\" scope=\"row\">Total:</th>\n";
585
- echo "<th align=\"left\" scope=\"row\">$no Tables</th>\n";
586
- echo "<th align=\"left\" scope=\"row\">".number_format($row_usage)."</th>\n";
587
- echo "<th align=\"left\" scope=\"row\">".format_size($data_usage)."</th>\n";
588
- echo "<th align=\"left\" scope=\"row\">".format_size($index_usage)."</th>";
589
- echo "<th align=\"left\" scope=\"row\">".format_size($overhead_usage)."</th></tr>";
590
- } else {
591
- echo '<tr><td colspan="6" align="center"><b>Could Not Show Table Status Due To Your MYSQL Version Is Lower Than 3.23.</b></td></tr>';
592
- }
593
- ?>
594
- </table>
595
- </div>
596
- <?php
597
- } // End switch($mode)
598
-
599
- ### Require Admin Footer
600
- require_once 'admin-footer.php';
601
- ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
dbmanager.php DELETED
@@ -1,36 +0,0 @@
1
- <?php
2
- /*
3
- Plugin Name: WP-DBManager
4
- Plugin URI: http://www.lesterchan.net/portfolio/programming.php
5
- Description: Manages your Wordpress database. Allows you to optimizee, backup, restore, delete backup database and run selected queries.
6
- Version: 2.00
7
- Author: GaMerZ
8
- Author URI: http://www.lesterchan.net
9
- */
10
-
11
-
12
- /* Copyright 2005 Lester Chan (email : gamerz84@hotmail.com)
13
-
14
- This program is free software; you can redistribute it and/or modify
15
- it under the terms of the GNU General Public License as published by
16
- the Free Software Foundation; either version 2 of the License, or
17
- (at your option) any later version.
18
-
19
- This program is distributed in the hope that it will be useful,
20
- but WITHOUT ANY WARRANTY; without even the implied warranty of
21
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22
- GNU General Public License for more details.
23
-
24
- You should have received a copy of the GNU General Public License
25
- along with this program; if not, write to the Free Software
26
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
27
- */
28
-
29
- ### Function: Poll Menu
30
- add_action('admin_menu', 'dbmanager_menu');
31
- function dbmanager_menu() {
32
- if (function_exists('add_menu_page')) {
33
- add_menu_page('Database', 'Database', 1, 'database-manager.php');
34
- }
35
- }
36
- ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
dbmanager/database-backup.php ADDED
@@ -0,0 +1,199 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*
3
+ +----------------------------------------------------------------+
4
+ | |
5
+ | WordPress 2.1 Plugin: WP-DBManager 2.11 |
6
+ | Copyright (c) 2007 Lester "GaMerZ" Chan |
7
+ | |
8
+ | File Written By: |
9
+ | - Lester "GaMerZ" Chan |
10
+ | - http://www.lesterchan.net |
11
+ | |
12
+ | File Information: |
13
+ | - Database Backup |
14
+ | - wp-content/plugins/dbmanager/database-backup.php |
15
+ | |
16
+ +----------------------------------------------------------------+
17
+ */
18
+
19
+
20
+ ### Check Whether User Can Manage Database
21
+ if(!current_user_can('manage_database')) {
22
+ die('Access Denied');
23
+ }
24
+
25
+
26
+ ### Variables Variables Variables
27
+ $base_name = plugin_basename('dbmanager/database-manager.php');
28
+ $base_page = 'admin.php?page='.$base_name;
29
+ $current_date = gmdate('l, jS F Y @ H:i', (time() + (get_option('gmt_offset') * 3600)));
30
+ $backup = array();
31
+ $backup_options = get_option('dbmanager_options');
32
+ $backup['date'] = current_time('timestamp');
33
+ $backup['mysqldumppath'] = $backup_options['mysqldumppath'];
34
+ $backup['mysqlpath'] = $backup_options['mysqlpath'];
35
+ $backup['path'] = $backup_options['path'];
36
+
37
+
38
+ ### Form Processing
39
+ if($_POST['do']) {
40
+ // Decide What To Do
41
+ switch($_POST['do']) {
42
+ case __('Backup', 'wp-dbmanager'):
43
+ $gzip = intval($_POST['gzip']);
44
+ if($gzip == 1) {
45
+ $backup['filename'] = $backup['date'].'_-_'.DB_NAME.'.sql.gz';
46
+ $backup['filepath'] = $backup['path'].'/'.$backup['filename'];
47
+ $backup['command'] = $backup['mysqldumppath'].' --host="'.DB_HOST.'" --user="'.DB_USER.'" --password="'.DB_PASSWORD.'" --add-drop-table '.DB_NAME.' | gzip > '.$backup['filepath'];
48
+ } else {
49
+ $backup['filename'] = $backup['date'].'_-_'.DB_NAME.'.sql';
50
+ $backup['filepath'] = $backup['path'].'/'.$backup['filename'];
51
+ $backup['command'] = $backup['mysqldumppath'].' --host="'.DB_HOST.'" --user="'.DB_USER.'" --password="'.DB_PASSWORD.'" --add-drop-table '.DB_NAME.' > '.$backup['filepath'];
52
+ }
53
+ passthru($backup['command'], $error);
54
+ if(!is_writable($backup['path'])) {
55
+ $text = '<font color="red">'.sprintf(__('Database Failed To Backup On \'%s\'. Backup Folder Not Writable.', 'wp-dbmanager'), $current_date).'</font>';
56
+ } elseif(filesize($backup['filepath']) == 0) {
57
+ unlink($backup['filepath']);
58
+ $text = '<font color="red">'.sprintf(__('Database Failed To Backup On \'%s\'. Backup File Size Is 0KB.', 'wp-dbmanager'), $current_date).'</font>';
59
+ } elseif(!is_file($backup['filepath'])) {
60
+ $text = '<font color="red">'.sprintf(__('Database Failed To Backup On \'%s\'. Invalid Backup File Path.', 'wp-dbmanager'), $current_date).'</font>';
61
+ } elseif($error) {
62
+ $text = '<font color="red">'.sprintf(__('Database Failed To Backup On \'%s\'.', 'wp-dbmanager'), $current_date).'</font>';
63
+ } else {
64
+ $text = '<font color="green">'.sprintf(__('Database Backed Up Successfully On \'%s\'.', 'wp-dbmanager'), $current_date).'</font>';
65
+ }
66
+ break;
67
+ }
68
+ }
69
+
70
+
71
+ ### Backup File Name
72
+ $backup['filename'] = $backup['date'].'_-_'.DB_NAME.'.sql';
73
+
74
+
75
+ ### MYSQL Base Dir
76
+ $status_count = 0;
77
+ $stats_function_disabled = 0;
78
+ ?>
79
+ <?php if(!empty($text)) { echo '<!-- Last Action --><div id="message" class="updated fade"><p>'.$text.'</p></div>'; } ?>
80
+ <!-- Checking Backup Status -->
81
+ <div class="wrap">
82
+ <h2><?php _e('Checking Backup Status', 'wp-dbmanager'); ?></h2>
83
+ <p>
84
+ <?php _e('Checking Backup Folder', 'wp-dbmanager'); ?> (<strong><?php echo stripslashes($backup['path']); ?></strong>) ...<br />
85
+ <?php
86
+ if(is_dir(stripslashes($backup['path']))) {
87
+ echo '<font color="green">'.__('Backup folder exists', 'wp-dbmanager').'</font><br />';
88
+ $status_count++;
89
+ } else {
90
+ echo '<font color="red">'.__('Backup folder does NOT exist. Please create \'backup-db\' folder in \'wp-content\' folder and CHMOD it to \'777\' or change the location of the backup folder under DB Option.', 'wp-dbmanager').'</font><br />';
91
+ }
92
+ if(is_writable(stripslashes($backup['path']))) {
93
+ echo '<font color="green">'.__('Backup folder is writable', 'wp-dbmanager').'</font>';
94
+ $status_count++;
95
+ } else {
96
+ echo '<font color="red">'.__('Backup folder is NOT writable. Please CHMOD it to \'777\'.', 'wp-dbmanager').'</font>';
97
+ }
98
+ ?>
99
+ </p>
100
+ <p>
101
+ <?php
102
+ if(file_exists(stripslashes($backup['mysqldumppath']))) {
103
+ echo __('Checking MYSQL Dump Path', 'wp-dbmanager').' (<strong>'.stripslashes($backup['mysqldumppath']).'</strong>) ...<br />';
104
+ echo '<font color="green">'.__('MYSQL dump path exists.', 'wp-dbmanager').'</font>';
105
+ $status_count++;
106
+ } else {
107
+ echo __('Checking MYSQL Dump Path', 'wp-dbmanager').' ...<br />';
108
+ echo '<font color="red">'.__('MYSQL dump path does NOT exist. Please check your mysqldump path under DB Options. If uncertain, contact your server administrator.', 'wp-dbmanager').'</font>';
109
+ }
110
+ ?>
111
+ </p>
112
+ <p>
113
+ <?php
114
+ if(file_exists(stripslashes($backup['mysqlpath']))) {
115
+ echo __('Checking MYSQL Path', 'wp-dbmanager').' (<strong>'.stripslashes($backup['mysqlpath']).'</strong>) ...<br />';
116
+ echo '<font color="green">'.__('MYSQL path exists.', 'wp-dbmanager').'</font>';
117
+ $status_count++;
118
+ } else {
119
+ echo __('Checking MYSQL Path', 'wp-dbmanager').' ...<br />';
120
+ echo '<font color="red">'.__('MYSQL path does NOT exist. Please check your mysql path under DB Options. If uncertain, contact your server administrator.', 'wp-dbmanager').'</font>';
121
+ }
122
+ ?>
123
+ </p>
124
+ <p>
125
+ <?php _e('Checking PHP Functions', 'wp-dbmanager'); ?> (<strong>passthru()</strong>, <strong>system()</strong> <?php _e('and', 'wp-dbmanager'); ?> <strong>exec()</strong>) ...<br />
126
+ <?php
127
+ if(function_exists('passthru')) {
128
+ echo '<font color="green">passthru() '.__('enabled', 'wp-dbmanager').'.</font><br />';
129
+ $status_count++;
130
+ } else {
131
+ echo '<font color="red">passthru() '.__('disabled', 'wp-dbmanager').'.</font><br />';
132
+ $stats_function_disabled++;
133
+ }
134
+ if(function_exists('system')) {
135
+ echo '<font color="green">system() '.__('enabled', 'wp-dbmanager').'.</font><br />';
136
+ } else {
137
+ echo '<font color="red">system() '.__('disabled', 'wp-dbmanager').'.</font><br />';
138
+ $stats_function_disabled++;
139
+ }
140
+ if(function_exists('exec')) {
141
+ echo '<font color="green">exec() '.__('enabled', 'wp-dbmanager').'.</font>';
142
+ } else {
143
+ echo '<font color="red">exec() '.__('disabled', 'wp-dbmanager').'.</font>';
144
+ $stats_function_disabled++;
145
+ }
146
+ ?>
147
+ </p>
148
+ <p>
149
+ <?php
150
+ if($status_count == 5) {
151
+ echo '<strong><font color="green">'.__('Excellent. You Are Good To Go.', 'wp-dbmanager').'</font></strong>';
152
+ } else if($stats_function_disabled == 3) {
153
+ echo '<strong><font color="red">'.__('I\'m sorry, your server administrator has disabled passthru(), system() and exec(), thus you cannot use this backup script. You may consider using the default WordPress database backup script instead.', 'wp-dbmanager').'</font></strong>';
154
+ } else {
155
+ echo '<strong><font color="red">'.__('Please Rectify The Error Highlighted In Red Before Proceeding On.', 'wp-dbmanager').'</font></strong>';
156
+ }
157
+ ?>
158
+ </p>
159
+ <p><i><?php _e('Note: The checking of backup status is still undergoing testing, it may not be accurate.', 'wp-dbmanager'); ?></i></p>
160
+ </div>
161
+ <!-- Backup Database -->
162
+ <div class="wrap">
163
+ <h2><?php _e('Backup Database', 'wp-dbmanager'); ?></h2>
164
+ <form action="<?php echo $_SERVER['REQUEST_URI']; ?>" method="post">
165
+ <table width="100%" cellspacing="3" cellpadding="3" border="0">
166
+ <tr>
167
+ <th align="left" scope="row"><?php _e('Database Name:', 'wp-dbmanager'); ?></th>
168
+ <td><?php echo DB_NAME; ?></td>
169
+ </tr>
170
+ <tr style="background-color: #eee;">
171
+ <th align="left" scope="row"><?php _e('Database Backup To:', 'wp-dbmanager'); ?></th>
172
+ <td><?php echo stripslashes($backup['path']); ?></td>
173
+ </tr>
174
+ <tr>
175
+ <th align="left" scope="row"><?php _e('Database Backup Date:', 'wp-dbmanager'); ?></th>
176
+ <td><?php echo gmdate('l, jS F Y @ H:i', $backup['date']); ?></td>
177
+ </tr>
178
+ <tr style="background-color: #eee;">
179
+ <th align="left" scope="row"><?php _e('Database Backup File Name:', 'wp-dbmanager'); ?></th>
180
+ <td><?php echo $backup['filename']; ?></td>
181
+ </tr>
182
+ <tr>
183
+ <th align="left" scope="row"><?php _e('Database Backup Type:', 'wp-dbmanager'); ?></th>
184
+ <td><?php _e('Full (Structure and Data)', 'wp-dbmanager'); ?></td>
185
+ </tr>
186
+ <tr style="background-color: #eee;">
187
+ <th align="left" scope="row"><?php _e('MYSQL Dump Location:', 'wp-dbmanager'); ?></th>
188
+ <td><?php echo stripslashes($backup['mysqldumppath']); ?></td>
189
+ </tr>
190
+ <tr>
191
+ <th align="left" scope="row"><?php _e('GZIP Database Backup File?', 'wp-dbmanager'); ?></th>
192
+ <td><input type="radio" name="gzip" value="1" /><?php _e('Yes', 'wp-dbmanager'); ?>&nbsp;&nbsp;<input type="radio" name="gzip" value="0" checked="checked" /><?php _e('No', 'wp-dbmanager'); ?></td>
193
+ </tr>
194
+ <tr>
195
+ <td colspan="2" align="center"><input type="submit" name="do" value="<?php _e('Backup', 'wp-dbmanager'); ?>" class="button" />&nbsp;&nbsp;<input type="button" name="cancel" value="<?php _e('Cancel', 'wp-dbmanager'); ?>" class="button" onclick="javascript:history.go(-1)" /></td>
196
+ </tr>
197
+ </table>
198
+ </form>
199
+ </div>
dbmanager/database-empty.php ADDED
@@ -0,0 +1,111 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*
3
+ +----------------------------------------------------------------+
4
+ | |
5
+ | WordPress 2.1 Plugin: WP-DBManager 2.11 |
6
+ | Copyright (c) 2007 Lester "GaMerZ" Chan |
7
+ | |
8
+ | File Written By: |
9
+ | - Lester "GaMerZ" Chan |
10
+ | - http://www.lesterchan.net |
11
+ | |
12
+ | File Information: |
13
+ | - Database Empty |
14
+ | - wp-content/plugins/dbmanager/database-empty.php |
15
+ | |
16
+ +----------------------------------------------------------------+
17
+ */
18
+
19
+
20
+ ### Check Whether User Can Manage Database
21
+ if(!current_user_can('manage_database')) {
22
+ die('Access Denied');
23
+ }
24
+
25
+
26
+ ### Variables Variables Variables
27
+ $base_name = plugin_basename('dbmanager/database-manager.php');
28
+ $base_page = 'admin.php?page='.$base_name;
29
+ $current_date = gmdate('l, jS F Y @ H:i', (time() + (get_option('gmt_offset') * 3600)));
30
+ $backup = array();
31
+ $backup_options = get_option('dbmanager_options');
32
+ $backup['date'] = current_time('timestamp');
33
+ $backup['mysqldumppath'] = $backup_options['mysqldumppath'];
34
+ $backup['mysqlpath'] = $backup_options['mysqlpath'];
35
+ $backup['path'] = $backup_options['path'];
36
+
37
+
38
+ ### Form Processing
39
+ if($_POST['do']) {
40
+ // Lets Prepare The Variables
41
+ $emptydrop = $_POST['emptydrop'];
42
+
43
+ // Decide What To Do
44
+ switch($_POST['do']) {
45
+ case __('Empty/Drop', 'wp-dbmanager'):
46
+ $empty_tables = array();
47
+ if(!empty($emptydrop)) {
48
+ foreach($emptydrop as $key => $value) {
49
+ if($value == 'empty') {
50
+ $empty_tables[] = $key;
51
+ } elseif($value == 'drop') {
52
+ $drop_tables .= ', '.$key;
53
+ }
54
+ }
55
+ } else {
56
+ $text = '<font color="red">'.__('No Tables Selected.', 'wp-dbmanager').'</font>';
57
+ }
58
+ $drop_tables = substr($drop_tables, 2);
59
+ if(!empty($empty_tables)) {
60
+ foreach($empty_tables as $empty_table) {
61
+ $empty_query = $wpdb->query("TRUNCATE $empty_table");
62
+ $text .= '<font color="green">'.sprintf(__('Table \'%s\' Emptied', 'wp-dbmanager'), $empty_table).'</font><br />';
63
+ }
64
+ }
65
+ if(!empty($drop_tables)) {
66
+ $drop_query = $wpdb->query("DROP TABLE $drop_tables");
67
+ $text = '<font color="green">'.sprintf(__('Table(s) \'%s\' Dropped', 'wp-dbmanager'), $drop_tables).'</font>';
68
+ }
69
+ break;
70
+ }
71
+ }
72
+
73
+
74
+ ### Show Tables
75
+ $tables = $wpdb->get_col("SHOW TABLES");
76
+ ?>
77
+ <?php if(!empty($text)) { echo '<!-- Last Action --><div id="message" class="updated fade"><p>'.$text.'</p></div>'; } ?>
78
+ <!-- Empty/Drop Tables -->
79
+ <div class="wrap">
80
+ <h2><?php _e('Empty/Drop Tables', 'wp-dbmanager'); ?></h2>
81
+ <form action="<?php echo $_SERVER['REQUEST_URI']; ?>" method="post">
82
+ <table width="100%" cellspacing="3" cellpadding="3" border="0">
83
+ <tr class="thead">
84
+ <th align="left"><?php _e('Tables', 'wp-dbmanager'); ?></th>
85
+ <th align="left"><?php _e('Empty', 'wp-dbmanager'); ?></th>
86
+ <th align="left"><?php _e('Drop', 'wp-dbmanager'); ?></th>
87
+ </tr>
88
+ <?php
89
+ foreach($tables as $table_name) {
90
+ if($no%2 == 0) {
91
+ $style = 'style=\'background: none;\'';
92
+ } else {
93
+ $style = 'style=\'background-color: #eee;\'';
94
+ }
95
+ $no++;
96
+ echo "<tr $style><th align=\"left\" scope=\"row\">$table_name</th>\n";
97
+ echo "<td><input type=\"radio\" name=\"emptydrop[$table_name]\" value=\"empty\" />&nbsp;".__('Empty', 'wp-dbmanager').'</td>';
98
+ echo "<td><input type=\"radio\" name=\"emptydrop[$table_name]\" value=\"drop\" />&nbsp;".__('Drop', 'wp-dbmanager').'</td></tr>';
99
+ }
100
+ ?>
101
+ <tr>
102
+ <td colspan="3">
103
+ <?php _e('1. DROPPING a table means deleting the table. This action is not REVERSIBLE.', 'wp-dbmanager'); ?><br />
104
+ <?php _e('2. EMPTYING a table means all the rows in the table will be deleted. This action is not REVERSIBLE.', 'wp-dbmanager'); ?></td>
105
+ </tr>
106
+ <tr>
107
+ <td colspan="3" align="center"><input type="submit" name="do" value="<?php _e('Empty/Drop', 'wp-dbmanager'); ?>" class="button" onclick="return confirm('<?php _e('You Are About To Empty Or Drop The Selected Databases.\nThis Action Is Not Reversible.\n\n Choose [Cancel] to stop, [Ok] to delete.', 'wp-dbmanager'); ?>')" />&nbsp;&nbsp;<input type="button" name="cancel" value="<?php _e('Cancel', 'wp-dbmanager'); ?>" class="button" onclick="javascript:history.go(-1)" /></td>
108
+ </tr>
109
+ </table>
110
+ </form>
111
+ </div>
dbmanager/database-manage.php ADDED
@@ -0,0 +1,206 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*
3
+ +----------------------------------------------------------------+
4
+ | |
5
+ | WordPress 2.1 Plugin: WP-DBManager 2.11 |
6
+ | Copyright (c) 2007 Lester "GaMerZ" Chan |
7
+ | |
8
+ | File Written By: |
9
+ | - Lester "GaMerZ" Chan |
10
+ | - http://www.lesterchan.net |
11
+ | |
12
+ | File Information: |
13
+ | - Database Restore |
14
+ | - wp-content/plugins/dbmanager/database-restore.php |
15
+ | |
16
+ +----------------------------------------------------------------+
17
+ */
18
+
19
+
20
+ ### Check Whether User Can Manage Database
21
+ if(!current_user_can('manage_database')) {
22
+ die('Access Denied');
23
+ }
24
+
25
+
26
+ ### Variables Variables Variables
27
+ $base_name = plugin_basename('dbmanager/database-manager.php');
28
+ $base_page = 'admin.php?page='.$base_name;
29
+ $current_date = gmdate('l, jS F Y @ H:i', (time() + (get_option('gmt_offset') * 3600)));
30
+ $backup = array();
31
+ $backup_options = get_option('dbmanager_options');
32
+ $backup['date'] = current_time('timestamp');
33
+ $backup['mysqldumppath'] = $backup_options['mysqldumppath'];
34
+ $backup['mysqlpath'] = $backup_options['mysqlpath'];
35
+ $backup['path'] = $backup_options['path'];
36
+
37
+
38
+ ### Form Processing
39
+ if($_POST['do']) {
40
+ // Lets Prepare The Variables
41
+ $database_file = trim($_POST['database_file']);
42
+ $nice_file_date = gmdate('l, jS F Y @ H:i', substr($database_file, 0, 10));
43
+
44
+ // Decide What To Do
45
+ switch($_POST['do']) {
46
+ case __('Restore', 'wp-dbmanager'):
47
+ if(!empty($database_file)) {
48
+ if(stristr($database_file, '.gz')) {
49
+ $backup['command'] = 'gunzip < '.$backup['path'].'/'.$database_file.' | '.$backup['mysqlpath'].' --host="'.DB_HOST.'" --user="'.DB_USER.'" --password="'.DB_PASSWORD.'" '.DB_NAME;
50
+ } else {
51
+ $backup['command'] = $backup['mysqlpath'].' --host="'.DB_HOST.'" --user="'.DB_USER.'" --password="'.DB_PASSWORD.'" '.DB_NAME.' < '.$backup['path'].'/'.$database_file;
52
+ }
53
+ passthru($backup['command'], $error);
54
+ if($error) {
55
+ $text = '<font color="red">'.sprintf(__('Database On \'%s\' Failed To Restore', 'wp-dbmanager'), $nice_file_date).'</font>';
56
+ } else {
57
+ $text = '<font color="green">'.sprintf(__('Database On \'%s\' Restored Successfully', 'wp-dbmanager'), $nice_file_date).'</font>';
58
+ }
59
+ } else {
60
+ $text = '<font color="red">'.__('No Backup Database File Selected', 'wp-dbmanager').'</font>';
61
+ }
62
+ break;
63
+ case __('E-Mail', 'wp-dbmanager'):
64
+ if(!empty($database_file)) {
65
+ // Get And Read The Database Backup File
66
+ $file_path = $backup['path'].'/'.$database_file;
67
+ $file_size = format_size(filesize($file_path));
68
+ $file_date = gmdate('l, jS F Y @ H:i', substr($database_file, 0, 10));
69
+ $file = fopen($file_path,'rb');
70
+ $file_data = fread($file,filesize($file_path));
71
+ fclose($file);
72
+ $file_data = chunk_split(base64_encode($file_data));
73
+ // Create Mail To, Mail Subject And Mail Header
74
+ if(!empty($_POST['email_to'])) {
75
+ $mail_to = trim($_POST['email_to']);
76
+ } else {
77
+ $mail_to = get_option('admin_email');
78
+ }
79
+ $mail_subject = sprintf(__('%s Database Backup File For %s', 'wp-dbmanager'), get_bloginfo('name'), $file_date);
80
+ $mail_header = 'From: '.get_bloginfo('name').' Administrator <'.get_option('admin_email').'>';
81
+ // MIME Boundary
82
+ $random_time = md5(time());
83
+ $mime_boundary = "==WP-DBManager- $random_time";
84
+ // Create Mail Header And Mail Message
85
+ $mail_header .= "\nMIME-Version: 1.0\n" .
86
+ "Content-Type: multipart/mixed;\n" .
87
+ " boundary=\"{$mime_boundary}\"";
88
+ $mail_message = __('Website Name:', 'wp-dbmanager').' '.get_bloginfo('name')."\n".
89
+ __('Website URL:', 'wp-dbmanager').' '.get_bloginfo('siteurl')."\n".
90
+ __('Backup File Name:', 'wp-dbmanager').' '.$database_file."\n".
91
+ __('Backup File Date:', 'wp-dbmanager').' '.$file_date."\n".
92
+ __('Backup File Size:', 'wp-dbmanager').' '.$file_size."\n\n".
93
+ __('With Regards,', 'wp-dbmanager')."\n".
94
+ get_bloginfo('name').' '. __('Administrator', 'wp-dbmanager')."\n".
95
+ get_bloginfo('siteurl');
96
+ $mail_message = "This is a multi-part message in MIME format.\n\n" .
97
+ "--{$mime_boundary}\n" .
98
+ "Content-Type: text/plain; charset=\"utf-8\"\n" .
99
+ "Content-Transfer-Encoding: 7bit\n\n".$mail_message."\n\n";
100
+ $mail_message .= "--{$mime_boundary}\n" .
101
+ "Content-Type: application/octet-stream;\n" .
102
+ " name=\"$database_file\"\n" .
103
+ "Content-Disposition: attachment;\n" .
104
+ " filename=\"$database_file\"\n" .
105
+ "Content-Transfer-Encoding: base64\n\n" .
106
+ $file_data."\n\n--{$mime_boundary}--\n";
107
+ if(mail($mail_to, $mail_subject, $mail_message, $mail_header)) {
108
+ $text .= '<font color="green">'.sprintf(__('Database Backup File For \'%s\' Successfully E-Mailed To \'%s\'', 'wp-dbmanager'), $file_date, $mail_to).'</font><br />';
109
+ } else {
110
+ $text = '<font color="red">'.sprintf(__('Unable To E-Mail Database Backup File For \'%s\' To \'%s\'', 'wp-dbmanager'), $file_date, $mail_to).'</font>';
111
+ }
112
+ } else {
113
+ $text = '<font color="red">'.__('No Backup Database File Selected', 'wp-dbmanager').'</font>';
114
+ }
115
+ break;
116
+ case __('Download', 'wp-dbmanager'):
117
+ if(empty($database_file)) {
118
+ $text = '<font color="red">'.__('No Backup Database File Selected', 'wp-dbmanager').'</font>';
119
+ }
120
+ break;
121
+ case __('Delete', 'wp-dbmanager'):
122
+ if(!empty($database_file)) {
123
+ $nice_file_date = gmdate('l, jS F Y @ H:i', substr($database_file, 0, 10));
124
+ if(is_file($backup['path'].'/'.$database_file)) {
125
+ if(!unlink($backup['path'].'/'.$database_file)) {
126
+ $text .= '<font color="red">'.sprintf(__('Unable To Delete Database Backup File On \'%s\'', 'wp-dbmanager'), $nice_file_date).'</font><br />';
127
+ } else {
128
+ $text .= '<font color="green">'.sprintf(__('Database Backup File On \'%s\' Deleted Successfully', 'wp-dbmanager'), $nice_file_date).'</font><br />';
129
+ }
130
+ } else {
131
+ $text = '<font color="red">'.sprintf(__('Invalid Database Backup File On \'%s\'', 'wp-dbmanager'), $nice_file_date).'</font>';
132
+ }
133
+ } else {
134
+ $text = '<font color="red">'.__('No Backup Database File Selected', 'wp-dbmanager').'</font>';
135
+ }
136
+ break;
137
+ }
138
+ }
139
+ ?>
140
+ <?php if(!empty($text)) { echo '<!-- Last Action --><div id="message" class="updated fade"><p>'.$text.'</p></div>'; } ?>
141
+ <!-- Manage Backup Database -->
142
+ <div class="wrap">
143
+ <h2><?php _e('Manage Backup Database', 'wp-dbmanager'); ?></h2>
144
+ <p><?php _e('Choose A Backup Date To E-Mail, Restore, Download Or Delete', 'wp-dbmanager'); ?></p>
145
+ <form action="<?php echo $_SERVER['REQUEST_URI']; ?>" method="post">
146
+ <table width="100%" cellspacing="3" cellpadding="3" border="0">
147
+ <tr class="thead">
148
+ <th align="left"><?php _e('No.', 'wp-dbmanager'); ?></th>
149
+ <th align="left"><?php _e('Database File', 'wp-dbmanager'); ?></th>
150
+ <th align="left"><?php _e('Date/Time', 'wp-dbmanager'); ?></th>
151
+ <th align="left"><?php _e('Size', 'wp-dbmanager'); ?></th>
152
+ <th align="left"><?php _e('Select', 'wp-dbmanager'); ?></th>
153
+ </tr>
154
+ <?php
155
+ if(!is_emtpy_folder($backup['path'])) {
156
+ if ($handle = opendir($backup['path'])) {
157
+ $database_files = array();
158
+ while (false !== ($file = readdir($handle))) {
159
+ if ($file != '.' && $file != '..' && (file_ext($file) == 'sql' || file_ext($file) == 'gz')) {
160
+ $database_files[] = $file;
161
+ }
162
+ }
163
+ closedir($handle);
164
+ sort($database_files);
165
+ for($i = (sizeof($database_files)-1); $i > -1; $i--) {
166
+ if($no%2 == 0) {
167
+ $style = 'style=\'background: none\'';
168
+ } else {
169
+ $style = 'style=\'background-color: #eee\'';
170
+ }
171
+ $no++;
172
+ $database_text = substr($database_files[$i], 13);
173
+ $date_text = gmdate('l, jS F Y @ H:i', substr($database_files[$i], 0, 10));
174
+ $size_text = filesize($backup['path'].'/'.$database_files[$i]);
175
+ echo "<tr $style>\n<td>$no</td>";
176
+ echo "<td>$database_text</td>";
177
+ echo "<td>$date_text</td>";
178
+ echo '<td>'.format_size($size_text).'</td>';
179
+ echo "<td><input type=\"radio\" name=\"database_file\" value=\"$database_files[$i]\" /></td>\n</tr>\n";
180
+ $totalsize += $size_text;
181
+ }
182
+ } else {
183
+ echo '<tr><td align="center" colspan="5">'.__('There Are No Database Backup Files Available.', 'wp-dbmanager').'</td></tr>';
184
+ }
185
+ } else {
186
+ echo '<tr><td align="center" colspan="5">'.__('There Are No Database Backup Files Available.', 'wp-dbmanager').'</td></tr>';
187
+ }
188
+ ?>
189
+ <tr class="thead">
190
+ <th align="left" colspan="3"><?php echo $no; ?> <?php _e('Backup File(s)', 'wp-dbmanager'); ?></th>
191
+ <th align="left"><?php echo format_size($totalsize); ?></th>
192
+ <td>&nbsp;</td>
193
+ </tr>
194
+ <tr>
195
+ <td colspan="5"><?php _e('E-mail database backup file to:', 'wp-dbmanager'); ?> <input type="text" name="email_to" size="30" maxlength="50" value="<?php echo get_option('admin_email'); ?>" />&nbsp;&nbsp;<input type="submit" name="do" value="<?php _e('E-Mail', 'wp-dbmanager'); ?>" class="button" /></td>
196
+ </tr>
197
+ <tr>
198
+ <td colspan="5" align="center">
199
+ <input type="submit" name="do" value="<?php _e('Download', 'wp-dbmanager'); ?>" class="button" />&nbsp;&nbsp;
200
+ <input type="submit" name="do" value="<?php _e('Restore', 'wp-dbmanager'); ?>" onclick="return confirm('<?php _e('You Are About To Restore A Database.\nThis Action Is Not Reversible.\nAny Data Inserted After The Backup Date Will Be Gone.\n\n Choose [Cancel] to stop, [Ok] to restore.', 'wp-dbmanager'); ?>')" class="button" />&nbsp;&nbsp;
201
+ <input type="submit" class="button" name="do" value="<?php _e('Delete', 'wp-dbmanager'); ?>" onclick="return confirm('<?php _e('You Are About To Delete The Selected Database Backup Files.\nThis Action Is Not Reversible.\n\n Choose [Cancel] to stop, [Ok] to delete.', 'wp-dbmanager'); ?>')" />&nbsp;&nbsp;
202
+ <input type="button" name="cancel" value="<?php _e('Cancel', 'wp-dbmanager'); ?>" class="button" onclick="javascript:history.go(-1)" /></td>
203
+ </tr>
204
+ </table>
205
+ </form>
206
+ </div>
dbmanager/database-manager.php ADDED
@@ -0,0 +1,120 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*
3
+ +----------------------------------------------------------------+
4
+ | |
5
+ | WordPress 2.1 Plugin: WP-DBManager 2.11 |
6
+ | Copyright (c) 2007 Lester "GaMerZ" Chan |
7
+ | |
8
+ | File Written By: |
9
+ | - Lester "GaMerZ" Chan |
10
+ | - http://www.lesterchan.net |
11
+ | |
12
+ | File Information: |
13
+ | - Database Manager |
14
+ | - wp-content/plugins/dbmanager/database-manager.php |
15
+ | |
16
+ +----------------------------------------------------------------+
17
+ */
18
+
19
+
20
+ ### Check Whether User Can Manage Database
21
+ if(!current_user_can('manage_database')) {
22
+ die('Access Denied');
23
+ }
24
+
25
+
26
+ ### Variables Variables Variables
27
+ $base_name = plugin_basename('dbmanager/database-manager.php');
28
+ $base_page = 'admin.php?page='.$base_name;
29
+ $current_date = gmdate('l, jS F Y @ H:i', (time() + (get_option('gmt_offset') * 3600)));
30
+ $backup = array();
31
+ $backup_options = get_option('dbmanager_options');
32
+ $backup['date'] = current_time('timestamp');
33
+ $backup['mysqldumppath'] = $backup_options['mysqldumppath'];
34
+ $backup['mysqlpath'] = $backup_options['mysqlpath'];
35
+ $backup['path'] = $backup_options['path'];
36
+
37
+
38
+ ### Get MYSQL Version
39
+ $sqlversion = $wpdb->get_var("SELECT VERSION() AS version");
40
+ ?>
41
+ <?php if(!empty($text)) { echo '<!-- Last Action --><div id="message" class="updated fade"><p>'.$text.'</p></div>'; } ?>
42
+ <!-- Database Information -->
43
+ <div class="wrap">
44
+ <h2><?php _e('Database Information', 'wp-dbmanager'); ?></h2>
45
+ <table width="100%" cellspacing="3" cellpadding="3" border="0">
46
+ <tr class="thead">
47
+ <th align="left"><?php _e('Setting', 'wp-dbmanager'); ?></th>
48
+ <th align="left"><?php _e('Value', 'wp-dbmanager'); ?></th>
49
+ </tr>
50
+ <tr>
51
+ <td><?php _e('Database Host', 'wp-dbmanager'); ?></td>
52
+ <td><?php echo DB_HOST; ?></td>
53
+ </tr>
54
+ <tr style="background-color: #eee;">
55
+ <td><?php _e('Database Name', 'wp-dbmanager'); ?></td>
56
+ <td><?php echo DB_NAME; ?></td>
57
+ </tr>
58
+ <tr>
59
+ <td><?php _e('Database User', 'wp-dbmanager'); ?></td>
60
+ <td><?php echo DB_USER; ?></td>
61
+ </tr>
62
+ <tr style="background-color: #eee;">
63
+ <td><?php _e('Database Type', 'wp-dbmanager'); ?></td>
64
+ <td>MYSQL</td>
65
+ </tr>
66
+ <tr>
67
+ <td><?php _e('Database Version', 'wp-dbmanager'); ?></td>
68
+ <td>v<?php echo $sqlversion; ?></td>
69
+ </tr>
70
+ </table>
71
+ </div>
72
+ <div class="wrap">
73
+ <h2><?php _e('Tables Information', 'wp-dbmanager'); ?></h2>
74
+ <table width="100%" cellspacing="3" cellpadding="3" border="0">
75
+ <tr class="thead">
76
+ <th align="left"><?php _e('No.', 'wp-dbmanager'); ?></th>
77
+ <th align="left"><?php _e('Tables', 'wp-dbmanager'); ?></th>
78
+ <th align="left"><?php _e('Records', 'wp-dbmanager'); ?></th>
79
+ <th align="left"><?php _e('Data Usage', 'wp-dbmanager'); ?></th>
80
+ <th align="left"><?php _e('Index Usage', 'wp-dbmanager'); ?></th>
81
+ <th align="left"><?php _e('Overhead', 'wp-dbmanager'); ?></th>
82
+ </tr>
83
+ <?php
84
+ // If MYSQL Version More Than 3.23, Get More Info
85
+ if($sqlversion >= '3.23') {
86
+ $tablesstatus = $wpdb->get_results("SHOW TABLE STATUS");
87
+ foreach($tablesstatus as $tablestatus) {
88
+ if($no%2 == 0) {
89
+ $style = 'style=\'background: none;\'';
90
+ } else {
91
+ $style = 'style=\'background-color: #eee;\'';
92
+ }
93
+ $no++;
94
+ echo "<tr $style>\n";
95
+ echo "<td>$no</td>\n";
96
+ echo "<td>$tablestatus->Name</td>\n";
97
+ echo '<td>'.number_format($tablestatus->Rows).'</td>'."\n";
98
+ echo '<td>'.format_size($tablestatus->Data_length).'</td>'."\n";
99
+ echo '<td>'.format_size($tablestatus->Index_length).'</td>'."\n";;
100
+ echo '<td>'.format_size($tablestatus->Data_free).'</td>'."\n";
101
+ $row_usage += $tablestatus->Rows;
102
+ $data_usage += $tablestatus->Data_length;
103
+ $index_usage += $tablestatus->Index_length;
104
+ $overhead_usage += $tablestatus->Data_free;
105
+ echo '</tr>'."\n";
106
+ }
107
+ echo '<tr class="thead">'."\n";
108
+ echo '<th align="left">'.__('Total:', 'wp-dbmanager').'</th>'."\n";
109
+ echo '<th align="left">'.$no.' '.__('Tables', 'wp-dbmanager').'</th>'."\n";
110
+ echo '<th align="left">'.number_format($row_usage).'</th>'."\n";
111
+ echo '<th align="left">'.format_size($data_usage).'</th>'."\n";
112
+ echo '<th align="left">'.format_size($index_usage).'</th>'."\n";
113
+ echo '<th align="left">'.format_size($overhead_usage).'</th>'."\n";
114
+ echo '</tr>';
115
+ } else {
116
+ echo '<tr><td colspan="6" align="center"><strong>'.__('Could Not Show Table Status Due To Your MYSQL Version Is Lower Than 3.23.', 'wp-dbmanager').'</strong></td></tr>';
117
+ }
118
+ ?>
119
+ </table>
120
+ </div>
dbmanager/database-optimize.php ADDED
@@ -0,0 +1,94 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*
3
+ +----------------------------------------------------------------+
4
+ | |
5
+ | WordPress 2.1 Plugin: WP-DBManager 2.11 |
6
+ | Copyright (c) 2007 Lester "GaMerZ" Chan |
7
+ | |
8
+ | File Written By: |
9
+ | - Lester "GaMerZ" Chan |
10
+ | - http://www.lesterchan.net |
11
+ | |
12
+ | File Information: |
13
+ | - Database Optimize |
14
+ | - wp-content/plugins/dbmanager/database-optimize.php |
15
+ | |
16
+ +----------------------------------------------------------------+
17
+ */
18
+
19
+
20
+ ### Check Whether User Can Manage Database
21
+ if(!current_user_can('manage_database')) {
22
+ die('Access Denied');
23
+ }
24
+
25
+
26
+ ### Variables Variables Variables
27
+ $base_name = plugin_basename('dbmanager/database-manager.php');
28
+ $base_page = 'admin.php?page='.$base_name;
29
+
30
+ ### Form Processing
31
+ if($_POST['do']) {
32
+ // Lets Prepare The Variables
33
+ $optimize = $_POST['optimize'];
34
+
35
+ // Decide What To Do
36
+ switch($_POST['do']) {
37
+ case 'Optimize':
38
+ if(!empty($optimize)) {
39
+ foreach($optimize as $key => $value) {
40
+ if($value == 'yes') {
41
+ $tables_string .= ', '.$key;
42
+ }
43
+ }
44
+ } else {
45
+ $text = '<font color="red">'.__('No Tables Selected', 'wp-dbmanager').'</font>';
46
+ }
47
+ $selected_tables = substr($tables_string, 2);
48
+ if(!empty($selected_tables)) {
49
+ $optimize2 = $wpdb->query("OPTIMIZE TABLE $selected_tables");
50
+ if(!$optimize2) {
51
+ $text = '<font color="red">'.sprintf(__('Table(s) \'%s\' NOT Optimized', 'wp-dbmanager'), $selected_tables).'</font>';
52
+ } else {
53
+ $text = '<font color="green">'.sprintf(__('Table(s) \'%s\' Optimized', 'wp-dbmanager'), $selected_tables).'</font>';
54
+ }
55
+ }
56
+ break;
57
+ }
58
+ }
59
+
60
+
61
+ ### Show Tables
62
+ $tables = $wpdb->get_col("SHOW TABLES");
63
+ ?>
64
+ <?php if(!empty($text)) { echo '<!-- Last Action --><div id="message" class="updated fade"><p>'.$text.'</p></div>'; } ?>
65
+ <!-- Optimize Database -->
66
+ <div class="wrap">
67
+ <h2><?php _e('Optimize Database', 'wp-dbmanager'); ?></h2>
68
+ <form action="<?php echo $_SERVER['REQUEST_URI']; ?>" method="post">
69
+ <table width="100%" cellspacing="3" cellpadding="3" border="0">
70
+ <tr class="thead">
71
+ <th align="left"><?php _e('Tables', 'wp-dbmanager'); ?></th>
72
+ <th align="left"><?php _e('Options', 'wp-dbmanager'); ?></th>
73
+ </tr>
74
+ <?php
75
+ foreach($tables as $table_name) {
76
+ if($no%2 == 0) {
77
+ $style = 'style=\'background: none\'';
78
+ } else {
79
+ $style = 'style=\'background-color: #eee;\'';
80
+ }
81
+ $no++;
82
+ echo "<tr $style><th align=\"left\" scope=\"row\">$table_name</th>\n";
83
+ echo "<td><input type=\"radio\" name=\"optimize[$table_name]\" value=\"no\" />".__('No', 'wp-dbmanager')."&nbsp;&nbsp;&nbsp;<input type=\"radio\" name=\"optimize[$table_name]\" value=\"yes\" checked=\"checked\" />".__('Yes', 'wp-dbmanager').'</td></tr>';
84
+ }
85
+ ?>
86
+ <tr>
87
+ <td colspan="2" align="center"><?php _e('Database should be optimize once every month.', 'wp-dbmanager'); ?></td>
88
+ </tr>
89
+ <tr>
90
+ <td colspan="2" align="center"><input type="submit" name="do" value="<?php _e('Optimize', 'wp-dbmanager'); ?>" class="button" />&nbsp;&nbsp;<input type="button" name="cancel" value="<?php _e('Cancel', 'wp-dbmanager'); ?>" class="button" onclick="javascript:history.go(-1)" /></td>
91
+ </tr>
92
+ </table>
93
+ </form>
94
+ </div>
dbmanager/database-repair.php ADDED
@@ -0,0 +1,87 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*
3
+ +----------------------------------------------------------------+
4
+ | |
5
+ | WordPress 2.1 Plugin: WP-DBManager 2.11 |
6
+ | Copyright (c) 2007 Lester "GaMerZ" Chan |
7
+ | |
8
+ | File Written By: |
9
+ | - Lester "GaMerZ" Chan |
10
+ | - http://www.lesterchan.net |
11
+ | |
12
+ | File Information: |
13
+ | - Database Repair |
14
+ | - wp-content/plugins/dbmanager/database-repair.php |
15
+ | |
16
+ +----------------------------------------------------------------+
17
+ */
18
+
19
+
20
+ ### Check Whether User Can Manage Database
21
+ if(!current_user_can('manage_database')) {
22
+ die('Access Denied');
23
+ }
24
+
25
+
26
+ ### Variables Variables Variables
27
+ $base_name = plugin_basename('dbmanager/database-manager.php');
28
+ $base_page = 'admin.php?page='.$base_name;
29
+
30
+ ### Form Processing
31
+ if($_POST['do']) {
32
+ // Lets Prepare The Variables
33
+ $repair = $_POST['repair'];
34
+
35
+ // Decide What To Do
36
+ switch($_POST['do']) {
37
+ case 'Repair':
38
+ if(!empty($repair)) {
39
+ foreach($repair as $key => $value) {
40
+ if($value == 'yes') {
41
+ $tables_string .= ', '.$key;
42
+ }
43
+ }
44
+ } else {
45
+ $text = '<font color="red">'.__('No Tables Selected', 'wp-dbmanager').'</font>';
46
+ }
47
+ $selected_tables = substr($tables_string, 2);
48
+ if(!empty($selected_tables)) {
49
+ $repair2 = $wpdb->query("REPAIR TABLE $selected_tables");
50
+ $text = '<font color="green">'.sprintf(__('Table(s) \'%s\' Repaired', 'wp-dbmanager'), $selected_tables).'</font>';
51
+ }
52
+ break;
53
+ }
54
+ }
55
+
56
+
57
+ ### Show Tables
58
+ $tables = $wpdb->get_col("SHOW TABLES");
59
+ ?>
60
+ <?php if(!empty($text)) { echo '<!-- Last Action --><div id="message" class="updated fade"><p>'.$text.'</p></div>'; } ?>
61
+ <!-- Repair Database -->
62
+ <div class="wrap">
63
+ <h2><?php _e('Repair Database', 'wp-dbmanager'); ?></h2>
64
+ <form action="<?php echo $_SERVER['REQUEST_URI']; ?>" method="post">
65
+ <table width="100%" cellspacing="3" cellpadding="3" border="0">
66
+ <tr class="thead">
67
+ <th align="left"><?php _e('Tables', 'wp-dbmanager'); ?></th>
68
+ <th align="left"><?php _e('Options', 'wp-dbmanager'); ?></th>
69
+ </tr>
70
+ <?php
71
+ foreach($tables as $table_name) {
72
+ if($no%2 == 0) {
73
+ $style = 'style=\'background: none\'';
74
+ } else {
75
+ $style = 'style=\'background-color: #eee;\'';
76
+ }
77
+ $no++;
78
+ echo "<tr $style><th align=\"left\" scope=\"row\">$table_name</th>\n";
79
+ echo "<td><input type=\"radio\" name=\"repair[$table_name]\" value=\"no\" />".__('No', 'wp-dbmanager')."&nbsp;&nbsp;&nbsp;<input type=\"radio\" name=\"repair[$table_name]\" value=\"yes\" checked=\"checked\" />".__('Yes', 'wp-dbmanager').'</td></tr>';
80
+ }
81
+ ?>
82
+ <tr>
83
+ <td colspan="2" align="center"><input type="submit" name="do" value="<?php _e('Repair', 'wp-dbmanager'); ?>" class="button" />&nbsp;&nbsp;<input type="button" name="cancel" value="<?php _e('Cancel', 'wp-dbmanager'); ?>" class="button" onclick="javascript:history.go(-1)" /></td>
84
+ </tr>
85
+ </table>
86
+ </form>
87
+ </div>
dbmanager/database-run.php ADDED
@@ -0,0 +1,99 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*
3
+ +----------------------------------------------------------------+
4
+ | |
5
+ | WordPress 2.1 Plugin: WP-DBManager 2.11 |
6
+ | Copyright (c) 2007 Lester "GaMerZ" Chan |
7
+ | |
8
+ | File Written By: |
9
+ | - Lester "GaMerZ" Chan |
10
+ | - http://www.lesterchan.net |
11
+ | |
12
+ | File Information: |
13
+ | - Database Run Query |
14
+ | - wp-content/plugins/dbmanager/database-run.php |
15
+ | |
16
+ +----------------------------------------------------------------+
17
+ */
18
+
19
+
20
+ ### Check Whether User Can Manage Database
21
+ if(!current_user_can('manage_database')) {
22
+ die('Access Denied');
23
+ }
24
+
25
+
26
+ ### Variables Variables Variables
27
+ $base_name = plugin_basename('dbmanager/database-manager.php');
28
+ $base_page = 'admin.php?page='.$base_name;
29
+ $current_date = gmdate('l, jS F Y @ H:i', (time() + (get_option('gmt_offset') * 3600)));
30
+ $backup = array();
31
+ $backup_options = get_option('dbmanager_options');
32
+ $backup['date'] = current_time('timestamp');
33
+ $backup['mysqldumppath'] = $backup_options['mysqldumppath'];
34
+ $backup['mysqlpath'] = $backup_options['mysqlpath'];
35
+ $backup['path'] = $backup_options['path'];
36
+
37
+
38
+ ### Form Processing
39
+ if($_POST['do']) {
40
+ // Decide What To Do
41
+ switch($_POST['do']) {
42
+ case __('Run', 'wp-dbmanager'):
43
+ $sql_queries2 = trim($_POST['sql_query']);
44
+ $totalquerycount = 0;
45
+ $successquery = 0;
46
+ if($sql_queries2) {
47
+ $sql_queries = array();
48
+ $sql_queries2 = explode("\n", $sql_queries2);
49
+ foreach($sql_queries2 as $sql_query2) {
50
+ $sql_query2 = trim(stripslashes($sql_query2));
51
+ $sql_query2 = preg_replace("/[\r\n]+/", '', $sql_query2);
52
+ if(!empty($sql_query2)) {
53
+ $sql_queries[] = $sql_query2;
54
+ }
55
+ }
56
+ if($sql_queries) {
57
+ foreach($sql_queries as $sql_query) {
58
+ if (preg_match("/^\\s*(insert|update|replace|delete|create|alter) /i",$sql_query)) {
59
+ $run_query = $wpdb->query($sql_query);
60
+ if(!$run_query) {
61
+ $text .= "<font color=\"red\">$sql_query</font><br />";
62
+ } else {
63
+ $successquery++;
64
+ $text .= "<font color=\"green\">$sql_query</font><br />";
65
+ }
66
+ $totalquerycount++;
67
+ } elseif (preg_match("/^\\s*(select|drop|show|grant) /i",$sql_query)) {
68
+ $text .= "<font color=\"red\">$sql_query</font><br />";
69
+ $totalquerycount++;
70
+ }
71
+ }
72
+ $text .= "<font color=\"blue\">$successquery/$totalquerycount ".__('Query(s) Executed Successfully', 'wp-dbmanager').'</font>';
73
+ } else {
74
+ $text = '<font color="red">'.__('Empty Query', 'wp-dbmanager').'</font>';
75
+ }
76
+ } else {
77
+ $text = '<font color="red">'.__('Empty Query', 'wp-dbmanager').'</font>';
78
+ }
79
+ break;
80
+ }
81
+ }
82
+ ?>
83
+ <?php if(!empty($text)) { echo '<!-- Last Action --><div id="message" class="updated fade"><p>'.$text.'</p></div>'; } ?>
84
+ <!-- Run SQL Query -->
85
+ <div class="wrap">
86
+ <h2><?php _e('Run SQL Query', 'wp-dbmanager'); ?></h2>
87
+ <form action="<?php echo $_SERVER['REQUEST_URI']; ?>" method="post">
88
+ <p>
89
+ <strong><?php _e('Seperate Multiple Queries With A New Line', 'wp-dbmanager'); ?></strong><br />
90
+ <font color="green"><?php _e('Use Only INSERT, UPDATE, REPLACE, DELETE, CREATE and ALTER statements.', 'wp-dbmanager'); ?></font>
91
+ </p>
92
+ <p align="center"><textarea cols="120" rows="30" name="sql_query"></textarea></p>
93
+ <p align="center"><input type="submit" name="do" value="<?php _e('Run', 'wp-dbmanager'); ?>" class="button" />&nbsp;&nbsp;<input type="button" name="cancel" value="<?php _e('Cancel', 'wp-dbmanager'); ?>" class="button" onclick="javascript:history.go(-1)" /></p>
94
+ <p>
95
+ <?php _e('1. CREATE statement will return an error, which is perfectly normal due to the database class. To confirm that your table has been created check the Manage Database page.', 'wp-dbmanager'); ?><br />
96
+ <?php _e('2. UPDATE statement may return an error sometimes due to the newly updated value being the same as the previous value.', 'wp-dbmanager'); ?><br />
97
+ <?php _e('3. ALTER statement will return an error because there is no value returned.', 'wp-dbmanager'); ?></p>
98
+ </form>
99
+ </div>
dbmanager/dbmanager.php ADDED
@@ -0,0 +1,441 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*
3
+ Plugin Name: WP-DBManager
4
+ Plugin URI: http://www.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 and optimizing of database.
6
+ Version: 2.11
7
+ Author: Lester 'GaMerZ' Chan
8
+ Author URI: http://www.lesterchan.net
9
+ */
10
+
11
+
12
+ /*
13
+ Copyright 2007 Lester Chan (email : gamerz84@hotmail.com)
14
+
15
+ This program is free software; you can redistribute it and/or modify
16
+ it under the terms of the GNU General Public License as published by
17
+ the Free Software Foundation; either version 2 of the License, or
18
+ (at your option) any later version.
19
+
20
+ This program is distributed in the hope that it will be useful,
21
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
22
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
23
+ GNU General Public License for more details.
24
+
25
+ You should have received a copy of the GNU General Public License
26
+ along with this program; if not, write to the Free Software
27
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
28
+ */
29
+
30
+
31
+ ### Create Text Domain For Translations
32
+ load_plugin_textdomain('wp-dbmanager', 'wp-content/plugins/dbmanager');
33
+
34
+
35
+ ### Function: Database Manager Menu
36
+ add_action('admin_menu', 'dbmanager_menu');
37
+ function dbmanager_menu() {
38
+ if (function_exists('add_menu_page')) {
39
+ add_menu_page(__('Database', 'wp-dbmanager'), __('Database', 'wp-dbmanager'), 'manage_database', 'dbmanager/database-manager.php');
40
+ }
41
+ if (function_exists('add_submenu_page')) {
42
+ add_submenu_page('dbmanager/database-manager.php', __('Backup DB', 'wp-dbmanager'), __('Backup DB', 'wp-dbmanager'), 'manage_database', 'dbmanager/database-backup.php');
43
+ add_submenu_page('dbmanager/database-manager.php', __('Manage Backup DB', 'wp-dbmanager'), __('Manage Backup DB', 'wp-dbmanager'), 'manage_database', 'dbmanager/database-manage.php');
44
+ add_submenu_page('dbmanager/database-manager.php', __('Optimize DB', 'wp-dbmanager'), __('Optimize DB', 'wp-dbmanager'), 'manage_database', 'dbmanager/database-optimize.php');
45
+ add_submenu_page('dbmanager/database-manager.php', __('Repair DB', 'wp-dbmanager'), __('Repair DB', 'wp-dbmanager'), 'manage_database', 'dbmanager/database-repair.php');
46
+ add_submenu_page('dbmanager/database-manager.php', __('Empty/Drop Tables', 'wp-dbmanager'), __('Empty/Drop Tables', 'wp-dbmanager'), 'manage_database', 'dbmanager/database-empty.php');
47
+ add_submenu_page('dbmanager/database-manager.php', __('Run SQL Query', 'wp-dbmanager'), __('Run SQL Query', 'wp-dbmanager'), 'manage_database', 'dbmanager/database-run.php');
48
+ add_submenu_page('dbmanager/database-manager.php', __('DB Options', 'wp-dbmanager'), __('DB Options', 'wp-dbmanager'), 'manage_database', 'dbmanager/dbmanager.php', 'dbmanager_options');
49
+ }
50
+ }
51
+
52
+
53
+ ### Funcion: Database Manager Cron
54
+ add_filter('cron_schedules', 'cron_dbmanager_reccurences');
55
+ add_action('dbmanager_cron_backup', 'cron_dbmanager_backup');
56
+ add_action('dbmanager_cron_optimize', 'cron_dbmanager_optimize');
57
+ function cron_dbmanager_backup() {
58
+ global $wpdb;
59
+ $backup_options = get_option('dbmanager_options');
60
+ $backup_email = stripslashes($backup_options['backup_email']);
61
+ if(intval($backup_options['backup_period']) > 0) {
62
+ $current_date = gmdate('l, jS F Y @ H:i', (time() + (get_option('gmt_offset') * 3600)));
63
+ $backup = array();
64
+ $backup['date'] = current_time('timestamp');
65
+ $backup['mysqldumppath'] = $backup_options['mysqldumppath'];
66
+ $backup['mysqlpath'] = $backup_options['mysqlpath'];
67
+ $backup['path'] = $backup_options['path'];
68
+ $backup['command'] = '';
69
+ if(intval($backup_options['backup_gzip']) == 1) {
70
+ $backup['filename'] = $backup['date'].'_-_'.DB_NAME.'.sql.gz';
71
+ $backup['filepath'] = $backup['path'].'/'.$backup['filename'];
72
+ $backup['command'] = $backup['mysqldumppath'].' --host="'.DB_HOST.'" --user="'.DB_USER.'" --password="'.DB_PASSWORD.'" --add-drop-table '.DB_NAME.' | gzip > '.$backup['filepath'];
73
+ } else {
74
+ $backup['filename'] = $backup['date'].'_-_'.DB_NAME.'.sql';
75
+ $backup['filepath'] = $backup['path'].'/'.$backup['filename'];
76
+ $backup['command'] = $backup['mysqldumppath'].' --host="'.DB_HOST.'" --user="'.DB_USER.'" --password="'.DB_PASSWORD.'" --add-drop-table '.DB_NAME.' > '.$backup['filepath'];
77
+ }
78
+ passthru($backup['command']);
79
+ if(!empty($backup_email)) {
80
+ // Get And Read The Database Backup File
81
+ $file_path = $backup['filepath'];
82
+ $file_size = format_size(filesize($file_path));
83
+ $file_date = gmdate('l, jS F Y @ H:i', substr($backup['filename'], 0, 10));
84
+ $file = fopen($file_path,'rb');
85
+ $file_data = fread($file,filesize($file_path));
86
+ fclose($file);
87
+ $file_data = chunk_split(base64_encode($file_data));
88
+ // Create Mail To, Mail Subject And Mail Header
89
+ $mail_subject = sprintf(__('%s Database Backup File For %s', 'wp-dbmanager'), get_bloginfo('name'), $file_date);
90
+ $mail_header = 'From: '.get_bloginfo('name').' Administrator <'.get_option('admin_email').'>';
91
+ // MIME Boundary
92
+ $random_time = md5(time());
93
+ $mime_boundary = "==WP-DBManager- $random_time";
94
+ // Create Mail Header And Mail Message
95
+ $mail_header .= "\nMIME-Version: 1.0\n" .
96
+ "Content-Type: multipart/mixed;\n" .
97
+ " boundary=\"{$mime_boundary}\"";
98
+ $mail_message = __('Website Name:', 'wp-dbmanager').' '.get_bloginfo('name')."\n".
99
+ __('Website URL:', 'wp-dbmanager').' '.get_bloginfo('siteurl')."\n".
100
+ __('Backup File Name:', 'wp-dbmanager').' '.$backup['filename']."\n".
101
+ __('Backup File Date:', 'wp-dbmanager').' '.$file_date."\n".
102
+ __('Backup File Size:', 'wp-dbmanager').' '.$file_size."\n\n".
103
+ __('With Regards,', 'wp-dbmanager')."\n".
104
+ get_bloginfo('name').' '. __('Administrator', 'wp-dbmanager')."\n".
105
+ get_bloginfo('siteurl');
106
+ $mail_message = "This is a multi-part message in MIME format.\n\n" .
107
+ "--{$mime_boundary}\n" .
108
+ "Content-Type: text/plain; charset=\"utf-8\"\n" .
109
+ "Content-Transfer-Encoding: 7bit\n\n".$mail_message."\n\n";
110
+ $mail_message .= "--{$mime_boundary}\n" .
111
+ "Content-Type: application/octet-stream;\n" .
112
+ " name=\"{$backup['filename']}\"\n" .
113
+ "Content-Disposition: attachment;\n" .
114
+ " filename=\"{$backup['filename']}\"\n" .
115
+ "Content-Transfer-Encoding: base64\n\n" .
116
+ $file_data."\n\n--{$mime_boundary}--\n";
117
+ mail($backup_email, $mail_subject, $mail_message, $mail_header);
118
+ }
119
+ }
120
+ return;
121
+ }
122
+ function cron_dbmanager_optimize() {
123
+ global $wpdb;
124
+ $backup_options = get_option('dbmanager_options');
125
+ $optimize = intval($backup_options['optimize']);
126
+ $optimize_period = intval($backup_options['optimize_period']);
127
+ if($optimize_period > 0) {
128
+ $optimize_tables = array();
129
+ $tables = $wpdb->get_col("SHOW TABLES");
130
+ foreach($tables as $table_name) {
131
+ $optimize_tables[] = $table_name;
132
+ }
133
+ $wpdb->query('OPTIMIZE TABLE '.implode(',', $optimize_tables));
134
+ }
135
+ return;
136
+ }
137
+ function cron_dbmanager_reccurences() {
138
+ $backup_options = get_option('dbmanager_options');
139
+ $backup = intval($backup_options['backup'])*intval($backup_options['backup_period']);
140
+ $optimize = intval($backup_options['optimize'])*intval($backup_options['optimize_period']);
141
+ if($backup == 0) {
142
+ $backup = 31536000;
143
+ }
144
+ if($optimize == 0) {
145
+ $optimize = 31536000;
146
+ }
147
+ return array(
148
+ 'dbmanager_backup' => array('interval' => $backup, 'display' => 'WP-DBManager Backup Schedule'),
149
+ 'dbmanager_optimize' => array('interval' => $optimize, 'display' => 'WP-DBManager Optimize Schedule')
150
+ );
151
+ }
152
+
153
+
154
+ ### Function: Auto Detect MYSQL and MYSQL Dump Paths
155
+ function detect_mysql() {
156
+ global $wpdb;
157
+ $paths = array('mysq' => '', 'mysqldump' => '');
158
+ if(substr(PHP_OS,0,3) == 'WIN') {
159
+ $mysql_install = $wpdb->get_row("SHOW VARIABLES LIKE 'basedir'");
160
+ if($mysql_install) {
161
+ $install_path = str_replace('\\', '/', $mysql_install->Value);
162
+ $paths['mysql'] = $install_path.'bin/mysql.exe';
163
+ $paths['mysqldump'] = $install_path.'bin/mysqldump.exe';
164
+ } else {
165
+ $paths['mysql'] = 'mysql.exe';
166
+ $paths['mysqldump'] = 'mysqldump.exe';
167
+ }
168
+ } else {
169
+ if(function_exists('exec')) {
170
+ $paths['mysql'] = exec('which mysql');
171
+ $paths['mysqldump'] = exec('which mysqldump');
172
+ } else {
173
+ $paths['mysql'] = 'mysql';
174
+ $paths['mysqldump'] = 'mysqldump';
175
+ }
176
+ }
177
+ return $paths;
178
+ }
179
+
180
+
181
+ ### Function: Format Bytes Into KB/MB
182
+ if(!function_exists('format_size')) {
183
+ function format_size($rawSize) {
184
+ if($rawSize / 1073741824 > 1)
185
+ return round($rawSize/1048576, 1) . ' GB';
186
+ else if ($rawSize / 1048576 > 1)
187
+ return round($rawSize/1048576, 1) . ' MB';
188
+ else if ($rawSize / 1024 > 1)
189
+ return round($rawSize/1024, 1) . ' KB';
190
+ else
191
+ return round($rawSize, 1) . ' bytes';
192
+ }
193
+ }
194
+
195
+
196
+ ### Function: Get File Extension
197
+ if(!function_exists('file_ext')) {
198
+ function file_ext($file_name) {
199
+ return substr(strrchr($file_name, '.'), 1);
200
+ }
201
+ }
202
+
203
+
204
+ ### Function: Check Folder Whether There Is Any File Inside
205
+ if(!function_exists('is_emtpy_folder')) {
206
+ function is_emtpy_folder($folder){
207
+ if(is_dir($folder) ){
208
+ $handle = opendir($folder);
209
+ while( (gettype( $name = readdir($handle)) != 'boolean')){
210
+ $name_array[] = $name;
211
+ }
212
+ foreach($name_array as $temp)
213
+ $folder_content .= $temp;
214
+
215
+ if($folder_content == '...')
216
+ return true;
217
+ else
218
+ return false;
219
+ closedir($handle);
220
+ }
221
+ else
222
+ return true;
223
+ }
224
+ }
225
+
226
+
227
+ ### Function: Database Manager Role
228
+ add_action('activate_dbmanager/dbmanager.php', 'dbmanager_init');
229
+ function dbmanager_init() {
230
+ global $wpdb;
231
+ $auto = detect_mysql();
232
+ // Add Options
233
+ $backup_options = array();
234
+ $backup_options['mysqldumppath'] = $auto['mysqldump'];
235
+ $backup_options['mysqlpath'] = $auto['mysql'];
236
+ $backup_options['path'] = str_replace('\\', '/', ABSPATH).'wp-content/backup-db';
237
+ $backup_options['backup'] = 1;
238
+ $backup_options['backup_gzip'] = 0;
239
+ $backup_options['backup_period'] = 604800;
240
+ $backup_options['backup_email'] = get_option('admin_email');
241
+ $backup_options['optimize'] = 3;
242
+ $backup_options['optimize_period'] = 86400;
243
+ add_option('dbmanager_options', $backup_options, 'WP-DBManager Options');
244
+
245
+ // Create Backup Folder
246
+ if(!is_dir(ABSPATH.'wp-content/backup-db')) {
247
+ mkdir(ABSPATH.'wp-content/backup-db');
248
+ }
249
+
250
+ // Set 'manage_database' Capabilities To Administrator
251
+ $role = get_role('administrator');
252
+ if(!$role->has_cap('manage_database')) {
253
+ $role->add_cap('manage_database');
254
+ }
255
+ }
256
+
257
+
258
+ ### Function: Download Database
259
+ add_action('init', 'download_database');
260
+ function download_database() {
261
+ if($_POST['do'] == 'Download' && !empty($_POST['database_file'])) {
262
+ if(strpos($_SERVER['HTTP_REFERER'], get_option('siteurl').'/wp-admin/admin.php?page=dbmanager/database-manage.php') !== false) {
263
+ $backup_options = get_option('dbmanager_options');
264
+ $file_path = $backup_options['path'].'/'.$_POST['database_file'];
265
+ header("Pragma: public");
266
+ header("Expires: 0");
267
+ header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
268
+ header("Content-Type: application/force-download");
269
+ header("Content-Type: application/octet-stream");
270
+ header("Content-Type: application/download");
271
+ header("Content-Disposition: attachment; filename=".basename($file_path).";");
272
+ header("Content-Transfer-Encoding: binary");
273
+ header("Content-Length: ".filesize($file_path));
274
+ @readfile($file_path);
275
+ }
276
+ exit();
277
+ }
278
+ }
279
+
280
+
281
+ ### Function: Database Options
282
+ function dbmanager_options() {
283
+ global $wpdb;
284
+ $text = '';
285
+ $backup_options = array();
286
+ $backup_options = get_option('dbmanager_options');
287
+ if($_POST['Submit']) {
288
+ $backup_options['mysqldumppath'] = trim($_POST['db_mysqldumppath']);
289
+ $backup_options['mysqlpath'] = trim($_POST['db_mysqlpath']);
290
+ $backup_options['path'] = trim($_POST['db_path']);
291
+ $backup_options['backup'] = intval($_POST['db_backup']);
292
+ $backup_options['backup_gzip'] = intval($_POST['db_backup_gzip']);
293
+ $backup_options['backup_period'] = intval($_POST['db_backup_period']);
294
+ $backup_options['backup_email'] = trim(addslashes($_POST['db_backup_email']));
295
+ $backup_options['optimize'] = intval($_POST['db_optimize']);
296
+ $backup_options['optimize_period'] = intval($_POST['db_optimize_period']);
297
+ $update_db_options = update_option('dbmanager_options', $backup_options);
298
+ if($update_db_options) {
299
+ $text = '<font color="green">'.__('Database Options Updated', 'wp-dbmanager').'</font>';
300
+ }
301
+ if(empty($text)) {
302
+ $text = '<font color="red">'.__('No Database Option Updated', 'wp-dbmanager').'</font>';
303
+ }
304
+ wp_clear_scheduled_hook('dbmanager_cron_backup');
305
+ if($backup_options['backup_period'] > 0) {
306
+ if (!wp_next_scheduled('dbmanager_cron_backup')) {
307
+ wp_schedule_event(time(), 'dbmanager_backup', 'dbmanager_cron_backup');
308
+ }
309
+ }
310
+ wp_clear_scheduled_hook('dbmanager_cron_optimize');
311
+ if($backup_options['optimize_period'] > 0) {
312
+ if (!wp_next_scheduled('dbmanager_cron_optimize')) {
313
+ wp_schedule_event(time(), 'dbmanager_optimize', 'dbmanager_cron_optimize');
314
+ }
315
+ }
316
+ }
317
+ $path = detect_mysql();
318
+ ?>
319
+ <script type="text/javascript">
320
+ /* <![CDATA[*/
321
+ function mysqlpath() {
322
+ document.getElementById('db_mysqlpath').value = '<?php echo $path['mysql']; ?>';
323
+ }
324
+ function mysqldumppath() {
325
+ document.getElementById('db_mysqldumppath').value = '<?php echo $path['mysqldump']; ?>';
326
+ }
327
+ /* ]]> */
328
+ </script>
329
+ <?php if(!empty($text)) { echo '<!-- Last Action --><div id="message" class="updated fade"><p>'.$text.'</p></div>'; } ?>
330
+ <!-- Database Options -->
331
+ <div class="wrap">
332
+ <h2><?php _e('Database Options', 'wp-dbmanager'); ?></h2>
333
+ <form action="<?php echo $_SERVER['REQUEST_URI']; ?>" method="post">
334
+ <fieldset class="options">
335
+ <legend><?php _e('Paths', 'wp-dbmanager'); ?></legend>
336
+ <table class="optiontable">
337
+ <tr>
338
+ <td valign="top"><strong><?php _e('Path To mysqldump:', 'wp-dbmanager'); ?></strong></td>
339
+ <td>
340
+ <input type="text" id="db_mysqldumppath" name="db_mysqldumppath" size="60" maxlength="100" value="<?php echo stripslashes($backup_options['mysqldumppath']); ?>" />&nbsp;&nbsp;<input type="button" value="Auto Detect" onclick="mysqldumppath();" />
341
+ <p><?php _e('The absolute path to mysqldump without trailing slash. If unsure, please email your server administrator about this.', 'wp-dbmanager'); ?></p>
342
+ </td>
343
+ </tr>
344
+ <tr>
345
+ <td valign="top"><strong><?php _e('Path To mysql:', 'wp-dbmanager'); ?></strong></td>
346
+ <td>
347
+ <input type="text" id="db_mysqlpath" name="db_mysqlpath" size="60" maxlength="100" value="<?php echo stripslashes($backup_options['mysqlpath']); ?>" />&nbsp;&nbsp;<input type="button" value="Auto Detect" onclick="mysqlpath();" />
348
+ <p><?php _e('The absolute path to mysql without trailing slash. If unsure, please email your server administrator about this.', 'wp-dbmanager'); ?></p>
349
+ </td>
350
+ </tr>
351
+ <tr>
352
+ <td valign="top"><strong><?php _e('Path To Backup:', 'wp-dbmanager'); ?></strong></td>
353
+ <td>
354
+ <input type="text" name="db_path" size="60" maxlength="100" value="<?php echo stripslashes($backup_options['path']); ?>" />
355
+ <p><?php _e('The absolute path to your database backup folder without trailing slash. Make sure the folder is writable.', 'wp-dbmanager'); ?></p>
356
+ </td>
357
+ </tr>
358
+ </table>
359
+ <p>
360
+ <strong><?php _e('Windows Server', 'wp-dbmanager'); ?></strong><br />
361
+ <?php _e('For mysqldump path, you can try \'<strong>mysqldump.exe</strong>\'.', 'wp-dbmanager'); ?><br />
362
+ <?php _e('For mysql path, you can try \'<strong>mysql.exe</strong>\'.', 'wp-dbmanager'); ?>
363
+ </p>
364
+ <p>
365
+ <strong><?php _e('Linux Server', 'wp-dbmanager'); ?></strong><br />
366
+ <?php _e('For mysqldump path, normally is just \'<strong>mysqldump</strong>\'.', 'wp-dbmanager'); ?><br />
367
+ <?php _e('For mysql path, normally is just \'<strong>mysql</strong>\'.', 'wp-dbmanager'); ?>
368
+ </p>
369
+ <p>
370
+ <strong><?php _e('Note', 'wp-dbmanager'); ?></strong><br />
371
+ <?php _e('The \'Auto Detect\' function does not work for some servers. If it does not work for you, please contact your server administrator for the MYSQL and MYSQL DUMP paths.'); ?>
372
+ </p>
373
+ <p>&nbsp;</p>
374
+ </fieldset>
375
+ <fieldset class="options">
376
+ <legend><?php _e('Automatic Scheduling', 'wp-dbmanager'); ?></legend>
377
+ <table class="optiontable">
378
+ <tr>
379
+ <td valign="top"><strong><?php _e('Automatic Backing Up Of DB:', 'wp-dbmanager'); ?></strong></td>
380
+ <td>
381
+ <?php
382
+ _e('Next backup date: ', 'wp-dbmanager');
383
+ if(wp_next_scheduled('dbmanager_cron_backup')) {
384
+ echo '<strong>'.gmdate('l, jS F Y @ H:i', (wp_next_scheduled('dbmanager_cron_backup') + (get_option('gmt_offset') * 3600))).'</strong>';
385
+ } else {
386
+ _e('N/A', 'wp-dbmanager');
387
+ }
388
+ ?>
389
+ <p>
390
+ <?php _e('Every', 'wp-dbmanager'); ?>&nbsp;<input type="text" name="db_backup" size="3" maxlength="5" value="<?php echo intval($backup_options['backup']); ?>" />&nbsp;
391
+ <select name="db_backup_period" size="1">
392
+ <option value="0"<?php selected('0', $backup_options['backup_period']); ?>><?php _e('Disable', 'wp-dbmanager'); ?></option>
393
+ <option value="3600"<?php selected('3600', $backup_options['backup_period']); ?>><?php _e('Hour(s)', 'wp-dbmanager'); ?></option>
394
+ <option value="86400"<?php selected('86400', $backup_options['backup_period']); ?>><?php _e('Day(s)', 'wp-dbmanager'); ?></option>
395
+ <option value="604800"<?php selected('604800', $backup_options['backup_period']); ?>><?php _e('Week(s)', 'wp-dbmanager'); ?></option>
396
+ <option value="18144000"<?php selected('18144000', $backup_options['backup_period']); ?>><?php _e('Month(s)', 'wp-dbmanager'); ?></option>
397
+ </select>&nbsp;&nbsp;&nbsp;
398
+ <?php _e('Gzip', 'wp-dnmanager'); ?>
399
+ <select name="db_backup_gzip" size="1">
400
+ <option value="0"<?php selected('0', $backup_options['backup_gzip']); ?>><?php _e('No', 'wp-dbmanager'); ?></option>
401
+ <option value="1"<?php selected('1', $backup_options['backup_gzip']); ?>><?php _e('Yes', 'wp-dbmanager'); ?></option>
402
+ </select>
403
+ </p>
404
+ <p><?php _e('E-mail backup to:', 'wp-dbmanager'); ?> <input type="text" name="db_backup_email" size="30" maxlength="50" value="<?php echo stripslashes($backup_options['backup_email']) ?>" />&nbsp;&nbsp;&nbsp;<?php _e('(Leave black to disable this feature)', 'wp-dbmanager'); ?></p>
405
+ <p><?php _e('WP-DBManager can automatically backup your database after a certain period.', 'wp-dbmanager'); ?></p>
406
+ </td>
407
+ </tr>
408
+ <tr>
409
+ <td valign="top"><strong><?php _e('Automatic Optimizing Of DB:', 'wp-dbmanager'); ?></strong></td>
410
+ <td>
411
+ <?php
412
+ _e('Next optimize date: ', 'wp-dbmanager');
413
+ if(wp_next_scheduled('dbmanager_cron_optimize')) {
414
+ echo '<strong>'.gmdate('l, jS F Y @ H:i', (wp_next_scheduled('dbmanager_cron_optimize') + (get_option('gmt_offset') * 3600))).'</strong>';
415
+ } else {
416
+ _e('N/A', 'wp-dbmanager');
417
+ }
418
+ ?>
419
+ <p>
420
+ <?php _e('Every', 'wp-dbmanager'); ?>&nbsp;<input type="text" name="db_optimize" size="3" maxlength="5" value="<?php echo intval($backup_options['optimize']); ?>" />&nbsp;
421
+ <select name="db_optimize_period" size="1">
422
+ <option value="0"<?php selected('0', $backup_options['optimize_period']); ?>><?php _e('Disable', 'wp-dbmanager'); ?></option>
423
+ <option value="3600"<?php selected('3600', $backup_options['optimize_period']); ?>><?php _e('Hour(s)', 'wp-dbmanager'); ?></option>
424
+ <option value="86400"<?php selected('86400', $backup_options['optimize_period']); ?>><?php _e('Day(s)', 'wp-dbmanager'); ?></option>
425
+ <option value="604800"<?php selected('604800', $backup_options['optimize_period']); ?>><?php _e('Week(s)', 'wp-dbmanager'); ?></option>
426
+ <option value="18144000"<?php selected('18144000', $backup_options['optimize_period']); ?>><?php _e('Month(s)', 'wp-dbmanager'); ?></option>
427
+ </select>
428
+ </p>
429
+ <p><?php _e('WP-DBManager can automatically optimize your database after a certain period.', 'wp-dbmanager'); ?></p>
430
+ </td>
431
+ </tr>
432
+ <tr>
433
+ <td width="100%" colspan="2" align="center"><input type="submit" name="Submit" class="button" value="<?php _e('Update Options', 'wp-dbmanager'); ?>" />&nbsp;&nbsp;<input type="button" name="cancel" value="<?php _e('Cancel', 'wp-dbmanager'); ?>" class="button" onclick="javascript:history.go(-1)" /></td>
434
+ </tr>
435
+ </table>
436
+ </fieldset>
437
+ </form>
438
+ </div>
439
+ <?php
440
+ }
441
+ ?>
dbmanager/wp-dbmanager.mo ADDED
Binary file
dbmanager/wp-dbmanager.pot ADDED
@@ -0,0 +1,731 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ msgid ""
2
+ msgstr ""
3
+ "Project-Id-Version: WP-DBManager\n"
4
+ "POT-Creation-Date: \n"
5
+ "PO-Revision-Date: 2007-05-31 19:29+0800\n"
6
+ "Last-Translator: Lester 'GaMerZ' Chan <gamerz84@hotmail.com>\n"
7
+ "Language-Team: Lester Chan <gamerz84@hotmail.com>\n"
8
+ "MIME-Version: 1.0\n"
9
+ "Content-Type: text/plain; charset=utf-8\n"
10
+ "Content-Transfer-Encoding: 8bit\n"
11
+ "X-Poedit-Language: English\n"
12
+ "X-Poedit-Country: SINGAPORE\n"
13
+ "X-Poedit-KeywordsList: __;_e\n"
14
+ "X-Poedit-Basepath: .\n"
15
+ "X-Poedit-SearchPath-0: .\n"
16
+
17
+ #: database-backup.php:42
18
+ #: database-backup.php:195
19
+ msgid "Backup"
20
+ msgstr ""
21
+
22
+ #: database-backup.php:55
23
+ #, php-format
24
+ msgid "Database Failed To Backup On '%s'. Backup Folder Not Writable."
25
+ msgstr ""
26
+
27
+ #: database-backup.php:58
28
+ #, php-format
29
+ msgid "Database Failed To Backup On '%s'. Backup File Size Is 0KB."
30
+ msgstr ""
31
+
32
+ #: database-backup.php:60
33
+ #, php-format
34
+ msgid "Database Failed To Backup On '%s'. Invalid Backup File Path."
35
+ msgstr ""
36
+
37
+ #: database-backup.php:62
38
+ #, php-format
39
+ msgid "Database Failed To Backup On '%s'."
40
+ msgstr ""
41
+
42
+ #: database-backup.php:64
43
+ #, php-format
44
+ msgid "Database Backed Up Successfully On '%s'."
45
+ msgstr ""
46
+
47
+ #: database-backup.php:82
48
+ msgid "Checking Backup Status"
49
+ msgstr ""
50
+
51
+ #: database-backup.php:84
52
+ msgid "Checking Backup Folder"
53
+ msgstr ""
54
+
55
+ #: database-backup.php:87
56
+ msgid "Backup folder exists"
57
+ msgstr ""
58
+
59
+ #: database-backup.php:90
60
+ msgid "Backup folder does NOT exist. Please create 'backup-db' folder in 'wp-content' folder and CHMOD it to '777' or change the location of the backup folder under DB Option."
61
+ msgstr ""
62
+
63
+ #: database-backup.php:93
64
+ msgid "Backup folder is writable"
65
+ msgstr ""
66
+
67
+ #: database-backup.php:96
68
+ msgid "Backup folder is NOT writable. Please CHMOD it to '777'."
69
+ msgstr ""
70
+
71
+ #: database-backup.php:103
72
+ #: database-backup.php:107
73
+ msgid "Checking MYSQL Dump Path"
74
+ msgstr ""
75
+
76
+ #: database-backup.php:104
77
+ msgid "MYSQL dump path exists."
78
+ msgstr ""
79
+
80
+ #: database-backup.php:108
81
+ msgid "MYSQL dump path does NOT exist. Please check your mysqldump path under DB Options. If uncertain, contact your server administrator."
82
+ msgstr ""
83
+
84
+ #: database-backup.php:115
85
+ #: database-backup.php:119
86
+ msgid "Checking MYSQL Path"
87
+ msgstr ""
88
+
89
+ #: database-backup.php:116
90
+ msgid "MYSQL path exists."
91
+ msgstr ""
92
+
93
+ #: database-backup.php:120
94
+ msgid "MYSQL path does NOT exist. Please check your mysql path under DB Options. If uncertain, contact your server administrator."
95
+ msgstr ""
96
+
97
+ #: database-backup.php:125
98
+ msgid "Checking PHP Functions"
99
+ msgstr ""
100
+
101
+ #: database-backup.php:125
102
+ msgid "and"
103
+ msgstr ""
104
+
105
+ #: database-backup.php:128
106
+ #: database-backup.php:135
107
+ #: database-backup.php:141
108
+ msgid "enabled"
109
+ msgstr ""
110
+
111
+ #: database-backup.php:131
112
+ #: database-backup.php:137
113
+ #: database-backup.php:143
114
+ msgid "disabled"
115
+ msgstr ""
116
+
117
+ #: database-backup.php:151
118
+ msgid "Excellent. You Are Good To Go."
119
+ msgstr ""
120
+
121
+ #: database-backup.php:153
122
+ msgid "I'm sorry, your server administrator has disabled passthru(), system() and exec(), thus you cannot use this backup script. You may consider using the default WordPress database backup script instead."
123
+ msgstr ""
124
+
125
+ #: database-backup.php:155
126
+ msgid "Please Rectify The Error Highlighted In Red Before Proceeding On."
127
+ msgstr ""
128
+
129
+ #: database-backup.php:159
130
+ msgid "Note: The checking of backup status is still undergoing testing, it may not be accurate."
131
+ msgstr ""
132
+
133
+ #: database-backup.php:163
134
+ msgid "Backup Database"
135
+ msgstr ""
136
+
137
+ #: database-backup.php:167
138
+ msgid "Database Name:"
139
+ msgstr ""
140
+
141
+ #: database-backup.php:171
142
+ msgid "Database Backup To:"
143
+ msgstr ""
144
+
145
+ #: database-backup.php:175
146
+ msgid "Database Backup Date:"
147
+ msgstr ""
148
+
149
+ #: database-backup.php:179
150
+ msgid "Database Backup File Name:"
151
+ msgstr ""
152
+
153
+ #: database-backup.php:183
154
+ msgid "Database Backup Type:"
155
+ msgstr ""
156
+
157
+ #: database-backup.php:184
158
+ msgid "Full (Structure and Data)"
159
+ msgstr ""
160
+
161
+ #: database-backup.php:187
162
+ msgid "MYSQL Dump Location:"
163
+ msgstr ""
164
+
165
+ #: database-backup.php:191
166
+ msgid "GZIP Database Backup File?"
167
+ msgstr ""
168
+
169
+ #: database-backup.php:192
170
+ #: database-optimize.php:83
171
+ #: database-repair.php:79
172
+ #: dbmanager.php:401
173
+ msgid "Yes"
174
+ msgstr ""
175
+
176
+ #: database-backup.php:192
177
+ #: database-optimize.php:83
178
+ #: database-repair.php:79
179
+ #: dbmanager.php:400
180
+ msgid "No"
181
+ msgstr ""
182
+
183
+ #: database-backup.php:195
184
+ #: database-empty.php:107
185
+ #: database-manage.php:202
186
+ #: database-optimize.php:90
187
+ #: database-repair.php:83
188
+ #: database-run.php:93
189
+ #: dbmanager.php:433
190
+ msgid "Cancel"
191
+ msgstr ""
192
+
193
+ #: database-empty.php:45
194
+ #: database-empty.php:107
195
+ msgid "Empty/Drop"
196
+ msgstr ""
197
+
198
+ #: database-empty.php:56
199
+ msgid "No Tables Selected."
200
+ msgstr ""
201
+
202
+ #: database-empty.php:62
203
+ #, php-format
204
+ msgid "Table '%s' Emptied"
205
+ msgstr ""
206
+
207
+ #: database-empty.php:67
208
+ #, php-format
209
+ msgid "Table(s) '%s' Dropped"
210
+ msgstr ""
211
+
212
+ #: database-empty.php:80
213
+ #: dbmanager.php:46
214
+ msgid "Empty/Drop Tables"
215
+ msgstr ""
216
+
217
+ #: database-empty.php:84
218
+ #: database-manager.php:77
219
+ #: database-manager.php:109
220
+ #: database-optimize.php:71
221
+ #: database-repair.php:67
222
+ msgid "Tables"
223
+ msgstr ""
224
+
225
+ #: database-empty.php:85
226
+ #: database-empty.php:97
227
+ msgid "Empty"
228
+ msgstr ""
229
+
230
+ #: database-empty.php:86
231
+ #: database-empty.php:98
232
+ msgid "Drop"
233
+ msgstr ""
234
+
235
+ #: database-empty.php:103
236
+ msgid "1. DROPPING a table means deleting the table. This action is not REVERSIBLE."
237
+ msgstr ""
238
+
239
+ #: database-empty.php:104
240
+ msgid "2. EMPTYING a table means all the rows in the table will be deleted. This action is not REVERSIBLE."
241
+ msgstr ""
242
+
243
+ #: database-empty.php:107
244
+ msgid ""
245
+ "You Are About To Empty Or Drop The Selected Databases.\\n"
246
+ "This Action Is Not Reversible.\\n"
247
+ "\\n"
248
+ " Choose [Cancel] to stop, [Ok] to delete."
249
+ msgstr ""
250
+
251
+ #: database-manage.php:46
252
+ #: database-manage.php:200
253
+ msgid "Restore"
254
+ msgstr ""
255
+
256
+ #: database-manage.php:55
257
+ #, php-format
258
+ msgid "Database On '%s' Failed To Restore"
259
+ msgstr ""
260
+
261
+ #: database-manage.php:57
262
+ #, php-format
263
+ msgid "Database On '%s' Restored Successfully"
264
+ msgstr ""
265
+
266
+ #: database-manage.php:60
267
+ #: database-manage.php:113
268
+ #: database-manage.php:118
269
+ #: database-manage.php:134
270
+ msgid "No Backup Database File Selected"
271
+ msgstr ""
272
+
273
+ #: database-manage.php:63
274
+ #: database-manage.php:195
275
+ msgid "E-Mail"
276
+ msgstr ""
277
+
278
+ #: database-manage.php:79
279
+ #: dbmanager.php:89
280
+ #, php-format
281
+ msgid "%s Database Backup File For %s"
282
+ msgstr ""
283
+
284
+ #: database-manage.php:88
285
+ #: dbmanager.php:98
286
+ msgid "Website Name:"
287
+ msgstr ""
288
+
289
+ #: database-manage.php:89
290
+ #: dbmanager.php:99
291
+ msgid "Website URL:"
292
+ msgstr ""
293
+
294
+ #: database-manage.php:90
295
+ #: dbmanager.php:100
296
+ msgid "Backup File Name:"
297
+ msgstr ""
298
+
299
+ #: database-manage.php:91
300
+ #: dbmanager.php:101
301
+ msgid "Backup File Date:"
302
+ msgstr ""
303
+
304
+ #: database-manage.php:92
305
+ #: dbmanager.php:102
306
+ msgid "Backup File Size:"
307
+ msgstr ""
308
+
309
+ #: database-manage.php:93
310
+ #: dbmanager.php:103
311
+ msgid "With Regards,"
312
+ msgstr ""
313
+
314
+ #: database-manage.php:94
315
+ #: dbmanager.php:104
316
+ msgid "Administrator"
317
+ msgstr ""
318
+
319
+ #: database-manage.php:108
320
+ #, php-format
321
+ msgid "Database Backup File For '%s' Successfully E-Mailed To '%s'"
322
+ msgstr ""
323
+
324
+ #: database-manage.php:110
325
+ #, php-format
326
+ msgid "Unable To E-Mail Database Backup File For '%s' To '%s'"
327
+ msgstr ""
328
+
329
+ #: database-manage.php:116
330
+ #: database-manage.php:199
331
+ msgid "Download"
332
+ msgstr ""
333
+
334
+ #: database-manage.php:121
335
+ #: database-manage.php:201
336
+ msgid "Delete"
337
+ msgstr ""
338
+
339
+ #: database-manage.php:126
340
+ #, php-format
341
+ msgid "Unable To Delete Database Backup File On '%s'"
342
+ msgstr ""
343
+
344
+ #: database-manage.php:128
345
+ #, php-format
346
+ msgid "Database Backup File On '%s' Deleted Successfully"
347
+ msgstr ""
348
+
349
+ #: database-manage.php:131
350
+ #, php-format
351
+ msgid "Invalid Database Backup File On '%s'"
352
+ msgstr ""
353
+
354
+ #: database-manage.php:143
355
+ msgid "Manage Backup Database"
356
+ msgstr ""
357
+
358
+ #: database-manage.php:144
359
+ msgid "Choose A Backup Date To E-Mail, Restore, Download Or Delete"
360
+ msgstr ""
361
+
362
+ #: database-manage.php:148
363
+ #: database-manager.php:76
364
+ msgid "No."
365
+ msgstr ""
366
+
367
+ #: database-manage.php:149
368
+ msgid "Database File"
369
+ msgstr ""
370
+
371
+ #: database-manage.php:150
372
+ msgid "Date/Time"
373
+ msgstr ""
374
+
375
+ #: database-manage.php:151
376
+ msgid "Size"
377
+ msgstr ""
378
+
379
+ #: database-manage.php:152
380
+ msgid "Select"
381
+ msgstr ""
382
+
383
+ #: database-manage.php:183
384
+ #: database-manage.php:186
385
+ msgid "There Are No Database Backup Files Available."
386
+ msgstr ""
387
+
388
+ #: database-manage.php:190
389
+ msgid "Backup File(s)"
390
+ msgstr ""
391
+
392
+ #: database-manage.php:195
393
+ msgid "E-mail database backup file to:"
394
+ msgstr ""
395
+
396
+ #: database-manage.php:200
397
+ msgid ""
398
+ "You Are About To Restore A Database.\\n"
399
+ "This Action Is Not Reversible.\\n"
400
+ "Any Data Inserted After The Backup Date Will Be Gone.\\n"
401
+ "\\n"
402
+ " Choose [Cancel] to stop, [Ok] to restore."
403
+ msgstr ""
404
+
405
+ #: database-manage.php:201
406
+ msgid ""
407
+ "You Are About To Delete The Selected Database Backup Files.\\n"
408
+ "This Action Is Not Reversible.\\n"
409
+ "\\n"
410
+ " Choose [Cancel] to stop, [Ok] to delete."
411
+ msgstr ""
412
+
413
+ #: database-manager.php:44
414
+ msgid "Database Information"
415
+ msgstr ""
416
+
417
+ #: database-manager.php:47
418
+ msgid "Setting"
419
+ msgstr ""
420
+
421
+ #: database-manager.php:48
422
+ msgid "Value"
423
+ msgstr ""
424
+
425
+ #: database-manager.php:51
426
+ msgid "Database Host"
427
+ msgstr ""
428
+
429
+ #: database-manager.php:55
430
+ msgid "Database Name"
431
+ msgstr ""
432
+
433
+ #: database-manager.php:59
434
+ msgid "Database User"
435
+ msgstr ""
436
+
437
+ #: database-manager.php:63
438
+ msgid "Database Type"
439
+ msgstr ""
440
+
441
+ #: database-manager.php:67
442
+ msgid "Database Version"
443
+ msgstr ""
444
+
445
+ #: database-manager.php:73
446
+ msgid "Tables Information"
447
+ msgstr ""
448
+
449
+ #: database-manager.php:78
450
+ msgid "Records"
451
+ msgstr ""
452
+
453
+ #: database-manager.php:79
454
+ msgid "Data Usage"
455
+ msgstr ""
456
+
457
+ #: database-manager.php:80
458
+ msgid "Index Usage"
459
+ msgstr ""
460
+
461
+ #: database-manager.php:81
462
+ msgid "Overhead"
463
+ msgstr ""
464
+
465
+ #: database-manager.php:108
466
+ msgid "Total:"
467
+ msgstr ""
468
+
469
+ #: database-manager.php:116
470
+ msgid "Could Not Show Table Status Due To Your MYSQL Version Is Lower Than 3.23."
471
+ msgstr ""
472
+
473
+ #: database-optimize.php:45
474
+ #: database-repair.php:45
475
+ msgid "No Tables Selected"
476
+ msgstr ""
477
+
478
+ #: database-optimize.php:51
479
+ #, php-format
480
+ msgid "Table(s) '%s' NOT Optimized"
481
+ msgstr ""
482
+
483
+ #: database-optimize.php:53
484
+ #, php-format
485
+ msgid "Table(s) '%s' Optimized"
486
+ msgstr ""
487
+
488
+ #: database-optimize.php:67
489
+ msgid "Optimize Database"
490
+ msgstr ""
491
+
492
+ #: database-optimize.php:72
493
+ #: database-repair.php:68
494
+ msgid "Options"
495
+ msgstr ""
496
+
497
+ #: database-optimize.php:87
498
+ msgid "Database should be optimize once every month."
499
+ msgstr ""
500
+
501
+ #: database-optimize.php:90
502
+ msgid "Optimize"
503
+ msgstr ""
504
+
505
+ #: database-repair.php:50
506
+ #, php-format
507
+ msgid "Table(s) '%s' Repaired"
508
+ msgstr ""
509
+
510
+ #: database-repair.php:63
511
+ msgid "Repair Database"
512
+ msgstr ""
513
+
514
+ #: database-repair.php:83
515
+ msgid "Repair"
516
+ msgstr ""
517
+
518
+ #: database-run.php:42
519
+ #: database-run.php:93
520
+ msgid "Run"
521
+ msgstr ""
522
+
523
+ #: database-run.php:72
524
+ msgid "Query(s) Executed Successfully"
525
+ msgstr ""
526
+
527
+ #: database-run.php:74
528
+ #: database-run.php:77
529
+ msgid "Empty Query"
530
+ msgstr ""
531
+
532
+ #: database-run.php:86
533
+ #: dbmanager.php:47
534
+ msgid "Run SQL Query"
535
+ msgstr ""
536
+
537
+ #: database-run.php:89
538
+ msgid "Seperate Multiple Queries With A New Line"
539
+ msgstr ""
540
+
541
+ #: database-run.php:90
542
+ msgid "Use Only INSERT, UPDATE, REPLACE, DELETE, CREATE and ALTER statements."
543
+ msgstr ""
544
+
545
+ #: database-run.php:95
546
+ msgid "1. CREATE statement will return an error, which is perfectly normal due to the database class. To confirm that your table has been created check the Manage Database page."
547
+ msgstr ""
548
+
549
+ #: database-run.php:96
550
+ msgid "2. UPDATE statement may return an error sometimes due to the newly updated value being the same as the previous value."
551
+ msgstr ""
552
+
553
+ #: database-run.php:97
554
+ msgid "3. ALTER statement will return an error because there is no value returned."
555
+ msgstr ""
556
+
557
+ #: dbmanager.php:39
558
+ msgid "Database"
559
+ msgstr ""
560
+
561
+ #: dbmanager.php:42
562
+ msgid "Backup DB"
563
+ msgstr ""
564
+
565
+ #: dbmanager.php:43
566
+ msgid "Manage Backup DB"
567
+ msgstr ""
568
+
569
+ #: dbmanager.php:44
570
+ msgid "Optimize DB"
571
+ msgstr ""
572
+
573
+ #: dbmanager.php:45
574
+ msgid "Repair DB"
575
+ msgstr ""
576
+
577
+ #: dbmanager.php:48
578
+ msgid "DB Options"
579
+ msgstr ""
580
+
581
+ #: dbmanager.php:299
582
+ msgid "Database Options Updated"
583
+ msgstr ""
584
+
585
+ #: dbmanager.php:302
586
+ msgid "No Database Option Updated"
587
+ msgstr ""
588
+
589
+ #: dbmanager.php:332
590
+ msgid "Database Options"
591
+ msgstr ""
592
+
593
+ #: dbmanager.php:335
594
+ msgid "Paths"
595
+ msgstr ""
596
+
597
+ #: dbmanager.php:338
598
+ msgid "Path To mysqldump:"
599
+ msgstr ""
600
+
601
+ #: dbmanager.php:341
602
+ msgid "The absolute path to mysqldump without trailing slash. If unsure, please email your server administrator about this."
603
+ msgstr ""
604
+
605
+ #: dbmanager.php:345
606
+ msgid "Path To mysql:"
607
+ msgstr ""
608
+
609
+ #: dbmanager.php:348
610
+ msgid "The absolute path to mysql without trailing slash. If unsure, please email your server administrator about this."
611
+ msgstr ""
612
+
613
+ #: dbmanager.php:352
614
+ msgid "Path To Backup:"
615
+ msgstr ""
616
+
617
+ #: dbmanager.php:355
618
+ msgid "The absolute path to your database backup folder without trailing slash. Make sure the folder is writable."
619
+ msgstr ""
620
+
621
+ #: dbmanager.php:360
622
+ msgid "Windows Server"
623
+ msgstr ""
624
+
625
+ #: dbmanager.php:361
626
+ msgid "For mysqldump path, you can try '<strong>mysqldump.exe</strong>'."
627
+ msgstr ""
628
+
629
+ #: dbmanager.php:362
630
+ msgid "For mysql path, you can try '<strong>mysql.exe</strong>'."
631
+ msgstr ""
632
+
633
+ #: dbmanager.php:365
634
+ msgid "Linux Server"
635
+ msgstr ""
636
+
637
+ #: dbmanager.php:366
638
+ msgid "For mysqldump path, normally is just '<strong>mysqldump</strong>'."
639
+ msgstr ""
640
+
641
+ #: dbmanager.php:367
642
+ msgid "For mysql path, normally is just '<strong>mysql</strong>'."
643
+ msgstr ""
644
+
645
+ #: dbmanager.php:370
646
+ msgid "Note"
647
+ msgstr ""
648
+
649
+ #: dbmanager.php:371
650
+ msgid "The 'Auto Detect' function does not work for some servers. If it does not work for you, please contact your server administrator for the MYSQL and MYSQL DUMP paths."
651
+ msgstr ""
652
+
653
+ #: dbmanager.php:376
654
+ msgid "Automatic Scheduling"
655
+ msgstr ""
656
+
657
+ #: dbmanager.php:379
658
+ msgid "Automatic Backing Up Of DB:"
659
+ msgstr ""
660
+
661
+ #: dbmanager.php:382
662
+ msgid "Next backup date: "
663
+ msgstr ""
664
+
665
+ #: dbmanager.php:386
666
+ #: dbmanager.php:416
667
+ msgid "N/A"
668
+ msgstr ""
669
+
670
+ #: dbmanager.php:390
671
+ #: dbmanager.php:420
672
+ msgid "Every"
673
+ msgstr ""
674
+
675
+ #: dbmanager.php:392
676
+ #: dbmanager.php:422
677
+ msgid "Disable"
678
+ msgstr ""
679
+
680
+ #: dbmanager.php:393
681
+ #: dbmanager.php:423
682
+ msgid "Hour(s)"
683
+ msgstr ""
684
+
685
+ #: dbmanager.php:394
686
+ #: dbmanager.php:424
687
+ msgid "Day(s)"
688
+ msgstr ""
689
+
690
+ #: dbmanager.php:395
691
+ #: dbmanager.php:425
692
+ msgid "Week(s)"
693
+ msgstr ""
694
+
695
+ #: dbmanager.php:396
696
+ #: dbmanager.php:426
697
+ msgid "Month(s)"
698
+ msgstr ""
699
+
700
+ #: dbmanager.php:398
701
+ msgid "Gzip"
702
+ msgstr ""
703
+
704
+ #: dbmanager.php:404
705
+ msgid "E-mail backup to:"
706
+ msgstr ""
707
+
708
+ #: dbmanager.php:404
709
+ msgid "(Leave black to disable this feature)"
710
+ msgstr ""
711
+
712
+ #: dbmanager.php:405
713
+ msgid "WP-DBManager can automatically backup your database after a certain period."
714
+ msgstr ""
715
+
716
+ #: dbmanager.php:409
717
+ msgid "Automatic Optimizing Of DB:"
718
+ msgstr ""
719
+
720
+ #: dbmanager.php:412
721
+ msgid "Next optimize date: "
722
+ msgstr ""
723
+
724
+ #: dbmanager.php:429
725
+ msgid "WP-DBManager can automatically optimize your database after a certain period."
726
+ msgstr ""
727
+
728
+ #: dbmanager.php:433
729
+ msgid "Update Options"
730
+ msgstr ""
731
+
readme-install.txt DELETED
@@ -1,24 +0,0 @@
1
- -> Installation Instructions
2
- --------------------------------------------------
3
- // Create a folder called 'wp-backup-db' under your root Wordpress folder
4
-
5
-
6
- // CHMOD 'wp-backup-db' to 777
7
-
8
-
9
- // Open wp-admin folder
10
-
11
- Put:
12
- ------------------------------------------------------------------
13
- database-manager.php
14
- ------------------------------------------------------------------
15
-
16
- // Open wp-content/plugins folder
17
-
18
- Put:
19
- ------------------------------------------------------------------
20
- dbmanager.php
21
- ------------------------------------------------------------------
22
-
23
-
24
- // Activate dbmanager plugin
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
readme.html ADDED
@@ -0,0 +1,435 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
2
+ <html>
3
+ <head>
4
+ <meta http-equiv="content-type" content="text/html; charset=utf-8" />
5
+ <title>WP-DBManager 2.11 Readme</title>
6
+ <style type="text/css" media="screen">
7
+ /* Default Style */
8
+ BODY {
9
+ font-family: Verdana, Arial;
10
+ font-size: 12px;
11
+ color: #000000;
12
+ background: #FFFFFF;
13
+ }
14
+ P {
15
+ padding-left: 10px;
16
+ }
17
+ BLOCKQUOTE {
18
+ margin: 10px 20px 0px 20px;
19
+ padding: 10px;
20
+ border: 1px solid #8d8d8d;
21
+ background-color: #f5f5f5;
22
+ }
23
+ LI {
24
+ margin-top: 20px;
25
+ }
26
+ UL LI UL LI {
27
+ margin-top: 10px;
28
+ }
29
+ A, A:active, A:link, A:visited {
30
+ color: #2d3a4c;
31
+ text-decoration: none;
32
+ }
33
+ A:hover {
34
+ color: #5577a5;
35
+ text-decoration: underline;
36
+ }
37
+ /* Place Holder Style */
38
+ #Container {
39
+ width: 780px;
40
+ margin-left: auto;
41
+ margin-right: auto;
42
+ }
43
+ #Content {
44
+ background-color: #fafafa;
45
+ border: 1px solid #a2b6cb;
46
+ padding: 10px;
47
+ margin-top: -13px;
48
+ }
49
+ /* Title Style */
50
+ #Title {
51
+ font-family: Verdana, Arial;
52
+ font-size: 22px;
53
+ font-weight: bold;
54
+ color: #389aff;
55
+ border-bottom: 1px solid #389aff;
56
+ margin-bottom: 10px;
57
+ }
58
+ .SubTitle {
59
+ font-family: Verdana, Arial;
60
+ font-size: 18px;
61
+ font-weight: bold;
62
+ color: #5b87b4;
63
+ }
64
+ .SubSubTitle {
65
+ font-family: Verdana, Arial;
66
+ font-size: 14px;
67
+ font-weight: bold;
68
+ color: #73a4d6;
69
+ }
70
+ /* Tabs */
71
+ UL#Tabs {
72
+ font-family: Verdana, Arial;
73
+ font-size: 12px;
74
+ font-weight: bold;
75
+ list-style-type: none;
76
+ padding-bottom: 28px;
77
+ border-bottom: 1px solid #a2b6cb;
78
+ margin-bottom: 12px;
79
+ z-index: 1;
80
+ }
81
+ #Tabs LI.Tab {
82
+ float: right;
83
+ height: 25px;
84
+ background-color: #deedfb;
85
+ margin: 2px 0px 0px 5px;
86
+ border: 1px solid #a2b6cb;
87
+ }
88
+ #Tabs LI.Tab A {
89
+ float: left;
90
+ display: block;
91
+ color: #666666;
92
+ text-decoration: none;
93
+ padding: 5px;
94
+ }
95
+ #Tabs LI.Tab A:hover {
96
+ background-color: #bfe0fe;
97
+ border-bottom: 1px solid #bfe0fe;
98
+ }
99
+ /* Selected Tab */
100
+ #Tabs LI.SelectedTab {
101
+ float: right;
102
+ height: 25px;
103
+ background-color: #fafafa;
104
+ margin: 2px 0px 0px 5px;
105
+ border-top: 1px solid #a2b6cb;
106
+ border-right: 1px solid #a2b6cb;
107
+ border-bottom: 1px solid #fafafa;
108
+ border-left: 1px solid #a2b6cb;
109
+ }
110
+ #Tabs LI.SelectedTab A {
111
+ float: left;
112
+ display: block;
113
+ color: #666666;
114
+ text-decoration: none;
115
+ padding: 5px;
116
+ cursor: default;
117
+ }
118
+ /* Copyright */
119
+ #Copyright {
120
+ text-align: center;
121
+ }
122
+ </style>
123
+ <script type="text/javascript">
124
+ /* <![CDATA[*/
125
+ // Index Page
126
+ function index() {
127
+ // Tab
128
+ document.getElementById('IndexTab').className = 'SelectedTab';
129
+ document.getElementById('ChangelogTab').className = 'Tab';
130
+ document.getElementById('InstallTab').className = 'Tab';
131
+ document.getElementById('UpgradeTab').className = 'Tab';
132
+ document.getElementById('UsageTab').className = 'Tab';
133
+ // Page
134
+ document.getElementById('Index').style.display= 'block';
135
+ document.getElementById('Changelog').style.display = 'none';
136
+ document.getElementById('Install').style.display = 'none';
137
+ document.getElementById('Upgrade').style.display = 'none';
138
+ document.getElementById('Usage').style.display = 'none';
139
+ }
140
+ // Changelog Page
141
+ function changelog() {
142
+ // Tab
143
+ document.getElementById('IndexTab').className = 'Tab';
144
+ document.getElementById('ChangelogTab').className = 'SelectedTab';
145
+ document.getElementById('InstallTab').className = 'Tab';
146
+ document.getElementById('UpgradeTab').className = 'Tab';
147
+ document.getElementById('UsageTab').className = 'Tab';
148
+ // Page
149
+ document.getElementById('Index').style.display = 'none';
150
+ document.getElementById('Changelog').style.display = 'block';
151
+ document.getElementById('Install').style.display = 'none';
152
+ document.getElementById('Upgrade').style.display = 'none';
153
+ document.getElementById('Usage').style.display = 'none';
154
+ }
155
+ // Installation Page
156
+ function install() {
157
+ // Tab
158
+ document.getElementById('IndexTab').className = 'Tab';
159
+ document.getElementById('ChangelogTab').className = 'Tab';
160
+ document.getElementById('InstallTab').className = 'SelectedTab';
161
+ document.getElementById('UpgradeTab').className = 'Tab';
162
+ document.getElementById('UsageTab').className = 'Tab';
163
+ // Page
164
+ document.getElementById('Index').style.display= 'none';
165
+ document.getElementById('Changelog').style.display = 'none';
166
+ document.getElementById('Install').style.display = 'block';
167
+ document.getElementById('Upgrade').style.display = 'none';
168
+ document.getElementById('Usage').style.display = 'none';
169
+ }
170
+ // Upgrade Page
171
+ function upgrade() {
172
+ // Tab
173
+ document.getElementById('IndexTab').className = 'Tab';
174
+ document.getElementById('ChangelogTab').className = 'Tab';
175
+ document.getElementById('InstallTab').className = 'Tab';
176
+ document.getElementById('UpgradeTab').className = 'SelectedTab';
177
+ document.getElementById('UsageTab').className = 'Tab';
178
+ // Page
179
+ document.getElementById('Index').style.display= 'none';
180
+ document.getElementById('Changelog').style.display = 'none';
181
+ document.getElementById('Install').style.display = 'none';
182
+ document.getElementById('Upgrade').style.display = 'block';
183
+ document.getElementById('Usage').style.display = 'none';
184
+ }
185
+ // Usage Page
186
+ function usage() {
187
+ // Tab
188
+ document.getElementById('IndexTab').className = 'Tab';
189
+ document.getElementById('ChangelogTab').className = 'Tab';
190
+ document.getElementById('InstallTab').className = 'Tab';
191
+ document.getElementById('UpgradeTab').className = 'Tab';
192
+ document.getElementById('UsageTab').className = 'SelectedTab';
193
+ // Page
194
+ document.getElementById('Index').style.display= 'none';
195
+ document.getElementById('Changelog').style.display = 'none';
196
+ document.getElementById('Install').style.display = 'none';
197
+ document.getElementById('Upgrade').style.display = 'none';
198
+ document.getElementById('Usage').style.display = 'block';
199
+ }
200
+ /* ]]> */
201
+ </script>
202
+ </head>
203
+ <body>
204
+ <div id="Container">
205
+ <!-- Title -->
206
+ <div id="Title">WP-DBManager 2.11&nbsp;&nbsp;&nbsp;<span style="color: #aaaaaa;">Readme</span></div>
207
+
208
+ <!-- Tabs -->
209
+ <ul id="Tabs">
210
+ <li id="UsageTab" class="Tab"><a href="#Usage" onclick="usage(); return false;" title="Usage Instructions">Usage</a></li>
211
+ <li id="UpgradeTab" class="Tab"><a href="#Upgrade" onclick="upgrade(); return false;" title="Upgrade Instructions">Upgrade</a></li>
212
+ <li id="InstallTab" class="Tab"><a href="#Installation" onclick="install(); return false;" title="Installation Instructions">Installation</a></li>
213
+ <li id="ChangelogTab" class="Tab"><a href="#Changelog" onclick="changelog(); return false;" title="Changelog">Changelog</a></li>
214
+ <li id="IndexTab" class="SelectedTab"><a href="#Index" onclick="index(); return false;" title="Index Instructions">Index</a></li>
215
+ </ul>
216
+
217
+ <!-- Content -->
218
+ <div id="Content">
219
+ <!-- Index -->
220
+ <div id="Index">
221
+ <div class="SubTitle">&raquo; Index</div>
222
+ <div class="SubSubTitle">Plugin Information</div>
223
+ <p>
224
+ <strong>Author:</strong><br />
225
+ <strong>&raquo;</strong> Lester 'GaMerZ' Chan
226
+ </p>
227
+ <p>
228
+ <strong>EMail:</strong><br />
229
+ <strong>&raquo;</strong>
230
+ <script type="text/javascript">
231
+ /* <![CDATA[*/
232
+ document.write(' <a href="mailto:gamerz84@hotmail.com?Subject=WP-DBManager%202.11%20Support" title="EMail To gamerz84@hotmail.com">gamerz84@hotmail.com</a>');
233
+ /* ]]> */
234
+ </script>
235
+ </p>
236
+ <p>
237
+ <strong>Website:</strong><br />
238
+ <strong>&raquo;</strong> <a href="http://www.lesterchan.net/" title="http://www.lesterchan.net/">http://www.lesterchan.net/</a>
239
+ </p>
240
+ <p>
241
+ <strong>Features:</strong><br />
242
+ <strong>&raquo;</strong> 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 and optimizing of database.
243
+ </p>
244
+ <p>
245
+ <strong>Download:</strong><br />
246
+ <strong>&raquo;</strong> <a href="http://www.lesterchan.net/others/downloads.php?id=15" title="http://www.lesterchan.net/others/downloads.php?id=15">WP-DBManager 2.11 For WordPress 2.1.x And Above</a><br />
247
+ <strong>&raquo;</strong> <a href="http://www.lesterchan.net/others/downloads/wp-dbmanager205.zip" title="http://www.lesterchan.net/others/downloads/wp-dbmanager205.zip">WP-DBManager 2.05 For WordPress 2.0.x</a><br />
248
+ <strong>&raquo;</strong> <a href="http://www.lesterchan.net/others/downloads/wp-dbmanager.zip" title="http://www.lesterchan.net/others/downloads/wp-dbmanager.zip">WP-DBManager 1.00 For WordPress 1.5.2</a>
249
+ </p>
250
+ <p>
251
+ <strong>Demo:</strong><br />
252
+ <strong>&raquo;</strong> N/A
253
+ </p>
254
+ <p>
255
+ <strong>Development:</strong><br />
256
+ <strong>&raquo;</strong> <a href="http://dev.wp-plugins.org/browser/wp-dbmanager/" title="http://dev.wp-plugins.org/browser/wp-dbmanager/">http://dev.wp-plugins.org/browser/wp-dbmanager/</a>
257
+ </p>
258
+ <p>
259
+ <strong>Translations:</strong><br />
260
+ <strong>&raquo;</strong> <a href="http://dev.wp-plugins.org/browser/wp-dbmanager/i18n/" title="http://dev.wp-plugins.org/browser/wp-dbmanager/i18n/">http://dev.wp-plugins.org/browser/wp-dbmanager/i18n/</a>
261
+ </p>
262
+ <p>
263
+ <strong>Support Forums:</strong><br />
264
+ <strong>&raquo;</strong> <a href="http://forums.lesterchan.net/index.php?board=11.0" title="http://forums.lesterchan.net/index.php?board=11.0">http://forums.lesterchan.net/index.php?board=11.0</a>
265
+ </p>
266
+ <p>
267
+ <strong>Updated:</strong><br />
268
+ <strong>&raquo;</strong> 1st June 2007
269
+ </p>
270
+ <p>
271
+ <strong>Note:</strong><br />
272
+ <strong>&raquo;</strong> The <strong>Changelog</strong>, <strong>Installation</strong>, <strong>Upgrade</strong>, <strong>Usage</strong> Tab at the top of the page.
273
+ </p>
274
+ <p>
275
+ <strong>Donations:</strong><br />
276
+ <strong>&raquo;</strong> 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 as my school allowance, I will really appericiate it. If not feel free to use it without any obligations. Thank You. My Paypal account is
277
+ <script type="text/javascript">
278
+ /* <![CDATA[*/
279
+ document.write(' <strong>gamerz84@hotmail.com</strong>.');
280
+ /* ]]> */
281
+ </script>
282
+ </p>
283
+ </div>
284
+
285
+ <!-- Changelog -->
286
+ <div id="Changelog" style="display: none;">
287
+ <div class="SubTitle">&raquo; Changelog</div>
288
+ <ul>
289
+ <li>
290
+ <strong>Version 2.11 (01-06-2007)</strong>
291
+ <ul>
292
+ <li>NEW: Sort Database Backup Files By Date In Descending Order</li>
293
+ <li>NEW: Added Repair Database Feature</li>
294
+ <li>NEW: Automatic Scheduling Of Backing Up And Optimizing Of Database</li>
295
+ </ul>
296
+ </li>
297
+ <li>
298
+ <strong>Version 2.10 (01-02-2007)</strong>
299
+ <ul>
300
+ <li>NEW: Works For WordPress 2.1 Only</li>
301
+ <li>NEW: Removed database-config.php</li>
302
+ <li>NEW: Localize WP-DBManager</li>
303
+ <li>NEW: Added The Ability To Auto Detect MYSQL And MYSQL Dump Path</li>
304
+ </ul>
305
+ </li>
306
+ <li>
307
+ <strong>Version 2.05 (01-06-2006)</strong>
308
+ <ul>
309
+ <li>FIXED: Database Table Names Not Appearing Correctly</li>
310
+ <li>NEW: DBManager Administration Panel Is XHTML 1.0 Transitional</li>
311
+ </ul>
312
+ </li>
313
+ <li>
314
+ <strong>Version 2.04 (10-05-2006)</strong>
315
+ <ul>
316
+ <li>FIXED: Unable To Download Backup DB Due To Header Sent Error</li>
317
+ <li>FIXED: Some XHTML Code Fixes</li>
318
+ </ul>
319
+ </li>
320
+ <li>
321
+ <strong>Version 2.03 (01-04-2006)</strong>
322
+ <ul>
323
+ <li>FIXED: Run Query Box Too Big</li>
324
+ <li>FIXED: Header Sent Error</li>
325
+ <li>FIXED: Extra Slashes For Mysql/Mysql Dump Path</li>
326
+ <li>FIXED: Mismatch Date Due To GMT</li>
327
+ </ul>
328
+ </li>
329
+ <li>
330
+ <strong>Version 2.02 (01-03-2006)</strong>
331
+ <ul>
332
+ <li>NEW: Improved On 'manage_database' Capabilities</li>
333
+ <li>NEW: Added GigaBytes To File Size</li>
334
+ <li>NEW: Added ALTER Statement To Allowed Queries</li>
335
+ <li>NEW: Able To Empty/Drop Tables</li>
336
+ <li>NEW: Able To EMail Database Backup File</li>
337
+ <li>NEW: Splitted database-manager.php Into Individual Files</li>
338
+ <li>NEW: Merge Restore And Delete Backup Database</li>
339
+ <li>NEW: Included .htaccess File To Protect Backup Folder</li>
340
+ <li>NEW: Checking Of Backup Status</li>
341
+ <li>FIXED: Using Old Method To Add Submenu</li>
342
+ <li>FIXED: PHP Short Tags</li>
343
+ <li>FIXED: Redirect Back To The Same Page Instead Of Manage Database Page After Submitting Form</li>
344
+ </ul>
345
+ </li>
346
+ <li>
347
+ <strong>Version 2.01 (01-02-2006)</strong>
348
+ <ul>
349
+ <li>NEW: Added 'manage_database' Capabilities To Administrator Role</li>
350
+ </ul>
351
+ </li>
352
+ <li>
353
+ <strong>Version 2.00 (01-01-2006)</strong>
354
+ <ul>
355
+ <li>NEW: Compatible With WordPress 2.0 Only</li>
356
+ <li>NEW: GPL License Added</li>
357
+ </ul>
358
+ </li>
359
+ </ul>
360
+ </div>
361
+
362
+ <!-- Installation Instructions -->
363
+ <div id="Install" style="display: none;">
364
+ <div class="SubTitle">&raquo; Installation Instructions</div>
365
+ <ol>
366
+ <li>
367
+ Open <strong>wp-content/plugins</strong> Folder
368
+ </li>
369
+ <li>
370
+ Put:
371
+ <blockquote>Folder: dbmanager</blockquote>
372
+ </li>
373
+ <li>
374
+ <strong>Activate</strong> WP-DBManager Plugin
375
+ </li>
376
+ <li>
377
+ Open <strong>wp-content/backup-db</strong> Folder
378
+ </li>
379
+ <li>
380
+ Put:
381
+ <blockquote>File: .htaccess</blockquote>
382
+ <p>The script will automatically create a folder called <strong>backup-db</strong> in wp-content folder if that folder is writable. If it is not created, please create it and CHMOD it to 777.</p>
383
+ </li>
384
+ <li>
385
+ Refer To <strong>Usage</strong> For Further Instructions
386
+ </li>
387
+ </ol>
388
+ </div>
389
+
390
+ <!-- Upgrade Instructions -->
391
+ <div id="Upgrade" style="display: none;">
392
+ <div class="SubTitle">&raquo; Upgrade Instructions</div>
393
+ <div class="SubSubTitle">From v2.0x To v2.11</div>
394
+ <ol>
395
+ <li>
396
+ <strong>Deactivate</strong> WP-DBManager Plugin
397
+ </li>
398
+ <li>
399
+ Open <strong>wp-content/plugins</strong> Folder
400
+ </li>
401
+ <li>
402
+ Put/Overwrite:
403
+ <blockquote>Folder: dbmanager</blockquote>
404
+ </li>
405
+ <li>
406
+ Delete:
407
+ <blockquote>File: wp-content/plugins/dbmanager/database-config.php</blockquote>
408
+ </li>
409
+ <li>
410
+ <strong>Activate</strong> WP-DBManager Plugin
411
+ </li>
412
+ <li>
413
+ Refer To <strong>Usage</strong> For Further Instructions
414
+ </li>
415
+ </ol>
416
+ </div>
417
+
418
+ <!-- Usage Instructions -->
419
+ <div id="Usage" style="display: none;">
420
+ <div class="SubTitle">&raquo; Usage Instructions</div>
421
+ <div class="SubSubTitle">General Usage</div>
422
+ <ol>
423
+ <li>
424
+ You can find DBManager under the <strong>Database Tab</strong> in the WordPress Administration Panel.
425
+ </li>
426
+ <li>
427
+ Go to <strong>'WP-Admin -> Database -> DB Options'</strong> to configure the database options.
428
+ </li>
429
+ </ol>
430
+ </div>
431
+ </div>
432
+ </div>
433
+ <p id="Copyright">WP-DBManager 2.11<br />Copyright &copy; 2007 Lester 'GaMerZ' Chan. All Rights Reserved.</p>
434
+ </body>
435
+ </html>
readme.txt CHANGED
@@ -1,13 +1,31 @@
1
- -> Database Manager For WordPress 2.0
2
- --------------------------------------------------
3
- Author -> Lester 'GaMerZ' Chan
4
- Email -> lesterch@singnet.com.sg
5
- Website -> http://www.lesterchan.net/
6
- Demo -> N/A
7
- Updated -> 1st January 2006
8
- --------------------------------------------------
9
-
10
-
11
- // Version 2.00 (01-01-2006)
12
- - NEW: Compatible With WordPress 2.0
13
- - NEW: GPL License Added
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ === WP-DBManager ===
2
+ Contributors: GamerZ
3
+ Donate link: http://www.lesterchan.net/wordpress
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: 2.1.0
6
+ Stable tag: 2.11
7
+
8
+ Manages your Wordpress database.
9
+
10
+ == Description ==
11
+
12
+ Allows you to optimize database, repair database, backup database, restore database, delete backup database , drop/empty tables and run selected queries. Supports automatic scheduling of backing up and optimizing of database.
13
+
14
+ All the information (general, changelog, installation, upgrade, usage) you need about this plugin can be found here: [WP-DBManager Readme](http://www.lesterchan.net/wordpress/readme/wp-dbmanager.html "WP-DBManager Readme").
15
+ It is the exact same readme.html is included in the zip package.
16
+
17
+ == Development Blog ==
18
+
19
+ [GaMerZ WordPress Plugins Development Blog](http://www.lesterchan.net/wordpress/ "GaMerZ WordPress Plugins Development Blog")
20
+
21
+ == Installation ==
22
+
23
+ [WP-DBManager Readme](http://www.lesterchan.net/wordpress/readme/wp-dbmanager.html "WP-DBManager Readme") (Installation Tab)
24
+
25
+ == Screenshots ==
26
+
27
+ [GaMerZ WordPress Plugins Screenshots](http://www.lesterchan.net/wordpress/screenshots/ "GaMerZ WordPress Plugins Screenshots")
28
+
29
+ == Frequently Asked Questions ==
30
+
31
+ You will need [GaMerZ WordPress Plugins Support Forums](http://forums.lesterchan.net/ "GaMerZ WordPress Plugins Support Forums")