Changeset 142 for minimanager/backup.php
- Timestamp:
- Nov 23, 2007, 11:29:33 PM (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
minimanager/backup.php
r19 r142 20 20 21 21 $output .= "<center> 22 <br /><fieldset style=\"width: 700px;\">22 <br /><fieldset class=\"tquarter_frame\"> 23 23 <legend>{$lang_backup['backup_options']}</legend> 24 24 <table class=\"hidden\"> … … 49 49 //############################################################################################## 50 50 function backup_step2(){ 51 global $lang_backup, $lang_global, $output, $backup_dir, $realm_db, $ mangos_db;51 global $lang_backup, $lang_global, $output, $backup_dir, $realm_db, $characters_db; 52 52 53 53 if ( empty($_GET['backup_action']) || empty($_GET['backup_from_to'] )) { … … 66 66 switch ($backup_action){ 67 67 case "load": 68 $output .= "<center><fieldset style=\"width: 700px;\">68 $output .= "<center><fieldset class=\"tquarter_frame\"> 69 69 <legend>{$lang_backup['select_file']}</legend> 70 70 <br /><table class=\"hidden\">"; … … 77 77 <input type=\"hidden\" name=\"MAX_FILE_SIZE\" value=\"$upload_max_filesize\" /> 78 78 <select name=\"use_db\">"; 79 foreach ($ mangos_db as $db) $output .= "<option value=\"{$db['name']}\">{$db['name']}</option>";79 foreach ($characters_db as $db) $output .= "<option value=\"{$db['name']}\">{$db['name']}</option>"; 80 80 $output .= "<option value=\"{$realm_db['name']}\">{$realm_db['name']}</option> 81 81 </select> … … 88 88 $output .= "<tr><td><form action=\"backup.php?action=dobackup&backup_action=$backup_action&backup_from_to=$backup_from_to\" method=\"post\" name=\"form\"> 89 89 <select name=\"use_db\">"; 90 foreach ($ mangos_db as $db) $output .= "<option value=\"{$db['name']}\">{$db['name']}</option>";90 foreach ($characters_db as $db) $output .= "<option value=\"{$db['name']}\">{$db['name']}</option>"; 91 91 $output .= "<option value=\"{$realm_db['name']}\">{$realm_db['name']}</option> 92 92 </select> … … 111 111 <form action=\"backup.php?action=dobackup&backup_action=$backup_action&backup_from_to=$backup_from_to\" method=\"post\" name=\"form\"> 112 112 <select name=\"use_db\">"; 113 foreach ($ mangos_db as $db) $output .= "<option value=\"{$db['name']}\">{$db['name']}</option>";113 foreach ($characters_db as $db) $output .= "<option value=\"{$db['name']}\">{$db['name']}</option>"; 114 114 $output .= "<option value=\"{$realm_db['name']}\">{$realm_db['name']}</option> 115 115 </select> … … 153 153 //############################################################################################## 154 154 function dobackup(){ 155 global $lang_backup,$backup_dir, $tables_backup_realmd, $tables_backup_ mangos, $output, $realm_db,156 $ mangos_db, $realm_id, $tab_backup_user_realmd, $tab_backup_user_mangos;155 global $lang_backup,$backup_dir, $tables_backup_realmd, $tables_backup_characters, $output, $realm_db, 156 $characters_db, $realm_id, $tab_backup_user_realmd, $tab_backup_user_characters; 157 157 158 158 if ( empty($_GET['backup_action']) || empty($_GET['backup_from_to']) ) { … … 177 177 if ($use_db == $realm_db['name']) $queries = run_sql_script($realm_db['addr'], $realm_db['user'], $realm_db['pass'], $realm_db['name'], "$backup_dir/$file_name_new",true); 178 178 else { 179 foreach ($ mangos_db as $db)179 foreach ($characters_db as $db) 180 180 if ($use_db == $db['name']) $queries = run_sql_script($db['addr'], $db['user'], $db['pass'], $db['name'], "$backup_dir/$file_name_new",true); 181 181 } … … 196 196 if ($use_db == $realm_db['name']) $queries = run_sql_script($realm_db['addr'], $realm_db['user'], $realm_db['pass'], $realm_db['name'], "$backup_dir/$file_name",false); 197 197 else { 198 foreach ($ mangos_db as $db)198 foreach ($characters_db as $db) 199 199 if ($use_db == $db['name']) $queries = run_sql_script($db['addr'], $db['user'], $db['pass'], $db['name'], "$backup_dir/$file_name",false); 200 200 } … … 226 226 227 227 if($save_all_realms) { 228 foreach ($ mangos_db as $db){228 foreach ($characters_db as $db){ 229 229 $fp = fopen("$backup_dir/$file_name_new", 'r+') or die (error($lang_backup['file_write_err'])); 230 230 fseek($fp,0,SEEK_END); … … 233 233 fclose($fp); 234 234 235 foreach ($tables_backup_ mangos as $value) {235 foreach ($tables_backup_characters as $value) { 236 236 sql_table_dump ($db['addr'], $db['user'], $db['pass'], $db['name'],$value,$struc_backup,"$backup_dir/$file_name_new"); 237 237 } … … 240 240 $fp = fopen("$backup_dir/$file_name_new", 'r+') or die (error($lang_backup['file_write_err'])); 241 241 fseek($fp,0,SEEK_END); 242 fwrite($fp, "CREATE DATABASE /*!32312 IF NOT EXISTS*/ {$ mangos_db[$realm_id]['name']};\n")or die (error($lang_backup['file_write_err']));243 fwrite($fp, "USE {$ mangos_db[$realm_id]['name']};\n\n")or die (error($lang_backup['file_write_err']));242 fwrite($fp, "CREATE DATABASE /*!32312 IF NOT EXISTS*/ {$characters_db[$realm_id]['name']};\n")or die (error($lang_backup['file_write_err'])); 243 fwrite($fp, "USE {$characters_db[$realm_id]['name']};\n\n")or die (error($lang_backup['file_write_err'])); 244 244 fclose($fp); 245 245 246 foreach ($tables_backup_ mangos as $value) {247 sql_table_dump ($ mangos_db[$realm_id]['addr'], $mangos_db[$realm_id]['user'], $mangos_db[$realm_id]['pass'], $mangos_db[$realm_id]['name'],$value,$struc_backup,"$backup_dir/$file_name_new");246 foreach ($tables_backup_characters as $value) { 247 sql_table_dump ($characters_db[$realm_id]['addr'], $characters_db[$realm_id]['user'], $characters_db[$realm_id]['pass'], $characters_db[$realm_id]['name'],$value,$struc_backup,"$backup_dir/$file_name_new"); 248 248 } 249 249 } … … 281 281 282 282 if($save_all_realms) { 283 foreach ($ mangos_db as $db){283 foreach ($characters_db as $db){ 284 284 $file_name_new = $db['name']."_backup_".date("m.d.y_H.i.s").".sql"; 285 285 $fp = fopen("$backup_dir/$file_name_new", 'w') or die (error($lang_backup['file_write_err'])); … … 290 290 fclose($fp); 291 291 292 foreach ($tables_backup_ mangos as $value) {292 foreach ($tables_backup_characters as $value) { 293 293 sql_table_dump ($db['addr'], $db['user'], $db['pass'], $db['name'],$value,$struc_backup,"$backup_dir/$file_name_new"); 294 294 } … … 296 296 } 297 297 } else { 298 $file_name_new = $ mangos_db[$realm_id]['name']."_backup_".date("m.d.y_H.i.s").".sql";298 $file_name_new = $characters_db[$realm_id]['name']."_backup_".date("m.d.y_H.i.s").".sql"; 299 299 $fp = fopen("$backup_dir/$file_name_new", 'w') or die (error($lang_backup['file_write_err'])); 300 300 fseek($fp,0,SEEK_END); 301 fwrite($fp, "CREATE DATABASE /*!32312 IF NOT EXISTS*/ {$ mangos_db[$realm_id]['name']};\n")or die (error($lang_backup['file_write_err']));302 fwrite($fp, "USE {$ mangos_db[$realm_id]['name']};\n\n")or die (error($lang_backup['file_write_err']));301 fwrite($fp, "CREATE DATABASE /*!32312 IF NOT EXISTS*/ {$characters_db[$realm_id]['name']};\n")or die (error($lang_backup['file_write_err'])); 302 fwrite($fp, "USE {$characters_db[$realm_id]['name']};\n\n")or die (error($lang_backup['file_write_err'])); 303 303 fclose($fp); 304 304 305 foreach ($tables_backup_ mangos as $value) {306 sql_table_dump ($ mangos_db[$realm_id]['addr'], $mangos_db[$realm_id]['user'], $mangos_db[$realm_id]['pass'], $mangos_db[$realm_id]['name'],$value,$struc_backup,"$backup_dir/$file_name_new");305 foreach ($tables_backup_characters as $value) { 306 sql_table_dump ($characters_db[$realm_id]['addr'], $characters_db[$realm_id]['user'], $characters_db[$realm_id]['pass'], $characters_db[$realm_id]['name'],$value,$struc_backup,"$backup_dir/$file_name_new"); 307 307 } 308 308 fclose($fp); … … 373 373 fclose($fp); 374 374 375 foreach ($ mangos_db as $db){375 foreach ($characters_db as $db){ 376 376 $file_name_new = $acc[0]."_{$db['name']}.sql"; 377 377 $fp = fopen("$subdir/$file_name_new", 'w') or die (error($lang_backup['file_write_err'])); … … 383 383 while ($char = $sql->fetch_array($all_char_query)){ 384 384 fwrite($fp, "-- Dumping data for character $char[1]\n")or die (error($lang_backup['file_write_err'])); 385 foreach ($tab_backup_user_ mangos as $value) {385 foreach ($tab_backup_user_characters as $value) { 386 386 $char_query = $sql->query("SELECT * FROM $value[0] WHERE $value[1] = $char[0]"); 387 387 $num_fields = $sql->num_fields($char_query); … … 444 444 if ($use_db == $realm_db['name']) $queries = run_sql_script($realm_db['addr'], $realm_db['user'], $realm_db['pass'],$realm_db['name'], "$backup_dir/accounts/$file_dir/$file_name.sql",true); 445 445 else { 446 foreach ($ mangos_db as $db)446 foreach ($characters_db as $db) 447 447 if ($use_db == $db['name']) $queries = run_sql_script($db['addr'], $db['user'], $db['pass'],$db['name'], "$backup_dir/accounts/$file_dir/$file_name.sql",true); 448 448 } … … 484 484 <tr><td>"; 485 485 foreach ($tables_backup_realmd as $value) $output .= " {$realm_db['name']}.$value / "; 486 foreach ($tables_backup_ mangos as $value) $output .= " $value / ";486 foreach ($tables_backup_characters as $value) $output .= " $value / "; 487 487 $output .= "</td></tr></table></center>"; 488 488 }
Note:
See TracChangeset
for help on using the changeset viewer.