- Timestamp:
- 07/09/09 13:46:30 (13 years ago)
- Location:
- dev
- Files:
-
- 2 modified
Legend:
- Unmodified
- Added
- Removed
-
dev/common/includes/globals.php
r410 r411 7 7 else 8 8 { 9 $svn_rev = '41 0';9 $svn_rev = '411'; 10 10 } 11 11 define('SVN_REV', $svn_rev); -
dev/upgrade.php
r404 r411 1 1 <?php 2 3 if(function_exists("set_time_limit")) 4 set_time_limit(0); 5 2 6 define('DB_HALTONERROR', true); 3 7 … … 10 14 session::init(); 11 15 $url=$_SERVER['HTTP_HOST'].$_SERVER['PHP_SELF']; 16 if($_SERVER['QUERY_STRING'] != "") $url .= '?'.$_SERVER['QUERY_STRING']; 12 17 13 18 … … 45 50 // Moved to index.php 46 51 define(LASTEST_DB_UPDATE,"010"); 52 if (CURRENT_DB_UPDATE >= LASTEST_DB_UPDATE ) 53 { 54 echo "<html><head>"; 55 echo "<meta http-equiv='refresh' content='5;url=http://".$url."' >"; 56 echo"</head><body>Board is up to date.<br><a href='".config::get('cfg_kbhost')."'>Return to your board</a></body>"; 57 die(); 58 } 47 59 updateDB(); 48 60 touch ('install/install.lock'); 49 61 echo "<html><head>"; 50 echo "<meta http-equiv='refresh' content='5;url=http://".$ _SERVER['HTTP_HOST'].$_SERVER['PHP_SELF']."' />";62 echo "<meta http-equiv='refresh' content='5;url=http://".$url."' >"; 51 63 echo"</head><body>Upgrade complete.<br><a href='".config::get('cfg_kbhost')."'>Return to your board</a></body>"; 52 64 die(); … … 220 232 function update007() 221 233 { 234 global $url; 222 235 //Checking if this Update already done 223 236 if (CURRENT_DB_UPDATE < "007" ) … … 256 269 config::set('007updatestatus',1); 257 270 echo "<html><head>"; 258 echo "<meta http-equiv='refresh' content='5;url=http://".$ _SERVER['HTTP_HOST'].$_SERVER['PHP_SELF']."' />";271 echo "<meta http-equiv='refresh' content='5;url=http://".$url."' >"; 259 272 echo"</head><body>7. External ID columns added</body>"; 260 273 die(); … … 296 309 config::set('007updatestatus',3); 297 310 echo "<html><head>"; 298 echo "<meta http-equiv='refresh' content='5;url=http://".$ _SERVER['HTTP_HOST'].$_SERVER['PHP_SELF']."' />";311 echo "<meta http-equiv='refresh' content='5;url=http://".$url."' >"; 299 312 echo"</head><body>7. Kill values: Ship prices calculated</body>"; 300 313 die(); … … 313 326 config::set('007updatestatus',4); 314 327 echo "<html><head>"; 315 echo "<meta http-equiv='refresh' content='5;url=http://".$ _SERVER['HTTP_HOST'].$_SERVER['PHP_SELF']."' />";328 echo "<meta http-equiv='refresh' content='5;url=http://".$url."' >"; 316 329 echo"</head><body>7. Kill values: Destroyed item prices calculated</body>"; 317 330 die(); … … 335 348 config::set('007updatestatus',5); 336 349 echo "<html><head>"; 337 echo "<meta http-equiv='refresh' content='5;url=http://".$ _SERVER['HTTP_HOST'].$_SERVER['PHP_SELF']."' />";350 echo "<meta http-equiv='refresh' content='5;url=http://".$url."' >"; 338 351 echo"</head><body>7. Kill values: Dropped item prices $action</body>"; 339 352 die(); … … 347 360 config::set('007updatestatus',7); 348 361 echo "<html><head>"; 349 echo "<meta http-equiv='refresh' content='5;url=http://".$ _SERVER['HTTP_HOST'].$_SERVER['PHP_SELF']."' />";362 echo "<meta http-equiv='refresh' content='5;url=http://".$url."' >"; 350 363 echo"</head><body>7. Kill values: ISK column created</body>"; 351 364 die(); … … 353 366 config::set('007updatestatus',7); 354 367 echo "<html><head>"; 355 echo "<meta http-equiv='refresh' content='5;url=http://".$ _SERVER['HTTP_HOST'].$_SERVER['PHP_SELF']."' />";368 echo "<meta http-equiv='refresh' content='5;url=http://".$url."' >"; 356 369 echo"</head><body>7. Kill values: ISK column already exists.</body>"; 357 370 die(); … … 359 372 if(config::get('007updatestatus') <8) 360 373 { 361 $sql = 'UPDATE kb3_kills 362 natural join tmp_price_ship 363 natural left join tmp_price_destroyed '; 364 if(config::get(kd_droptototal)) $sql .= ' natural left join tmp_price_dropped '; 365 $sql .= 'SET kb3_kills.kll_isk_loss = tmp_price_ship.value + ifnull(tmp_price_destroyed.value,0) '; 366 if(config::get(kd_droptototal)) $sql .= ' + ifnull(tmp_price_dropped.value,0) '; 367 $qry->execute ($sql); 374 // default step size 375 $step = 8192; 376 if(!config::get('007.8status')) 377 { 378 config::set('007.8status', 0); 379 config::set('007.8step', $step); 380 } 381 // If we had to restart then halve the step size up to 4 times. 382 if(config::get('007.8status') > 0 && config::get('007.8step') >= $step / 2^4) 383 config::set('007.8step', config::get('007.8step') / 2); 384 $qry->execute("SELECT max(kll_id) as max FROM kb3_kills"); 385 $row=$qry->getRow(); 386 $count=$row['max']; 387 while(config::get('007.8status') < $count) 388 { 389 $sql = 'UPDATE kb3_kills 390 natural join tmp_price_ship 391 natural left join tmp_price_destroyed '; 392 if(config::get(kd_droptototal)) $sql .= ' natural left join tmp_price_dropped '; 393 $sql .= 'SET kb3_kills.kll_isk_loss = tmp_price_ship.value + ifnull(tmp_price_destroyed.value,0) '; 394 if(config::get(kd_droptototal)) $sql .= ' + ifnull(tmp_price_dropped.value,0) '; 395 $sql .= ' WHERE kll_id >= '.config::get('007.8status').' AND kll_id < '. 396 (intval(config::get('007.8status')) + intval(config::get('007.8step'))); 397 $qry->execute ($sql); 398 config::set('007.8status',(intval(config::get('007.8status')) + intval(config::get('007.8step'))) ); 399 } 400 config::del('007.8status'); 401 config::del('007.8step'); 368 402 $qry->execute("UNLOCK TABLES"); 369 403 $qry->execute('DROP TABLE tmp_price_ship'); … … 372 406 config::set('007updatestatus',8); 373 407 echo "<html><head>"; 374 echo "<meta http-equiv='refresh' content='5;url=http://".$ _SERVER['HTTP_HOST'].$_SERVER['PHP_SELF']."' />";408 echo "<meta http-equiv='refresh' content='5;url=http://".$url."' >"; 375 409 echo"</head><body>7. Kill values: Totals updated</body>"; 376 410 die(); … … 383 417 config::set('007updatestatus',9); 384 418 echo "<html><head>"; 385 echo "<meta http-equiv='refresh' content='5;url=http://".$ _SERVER['HTTP_HOST'].$_SERVER['PHP_SELF']."' />";419 echo "<meta http-equiv='refresh' content='5;url=http://".$url."' >"; 386 420 echo"</head><body>7. kll_fb_crp_id column dropped</body>"; 387 421 die(); … … 393 427 config::set('007updatestatus',10); 394 428 echo "<html><head>"; 395 echo "<meta http-equiv='refresh' content='5;url=http://".$ _SERVER['HTTP_HOST'].$_SERVER['PHP_SELF']."' />";429 echo "<meta http-equiv='refresh' content='5;url=http://".$url."' >"; 396 430 echo"</head><body>7. kll_fb_all_id column dropped</body>"; 397 431 die(); … … 408 442 config::set('007updatestatus',11); 409 443 echo "<html><head>"; 410 echo "<meta http-equiv='refresh' content='5;url=http://".$ _SERVER['HTTP_HOST'].$_SERVER['PHP_SELF']."' />";444 echo "<meta http-equiv='refresh' content='5;url=http://".$url."' >"; 411 445 echo"</head><body>7. Unused crp and plt columns dropped</body>"; 412 446 die(); … … 429 463 config::set('007updatestatus',12); 430 464 echo "<html><head>"; 431 echo "<meta http-equiv='refresh' content='5;url=http://".$ _SERVER['HTTP_HOST'].$_SERVER['PHP_SELF']."' />";465 echo "<meta http-equiv='refresh' content='5;url=http://".$url."' >"; 432 466 echo"</head><body>7. kb3_inv_detail ind_crp_id index added</body>"; 433 467 die(); … … 439 473 config::set('007updatestatus',13); 440 474 echo "<html><head>"; 441 echo "<meta http-equiv='refresh' content='5;url=http://".$ _SERVER['HTTP_HOST'].$_SERVER['PHP_SELF']."' />";475 echo "<meta http-equiv='refresh' content='5;url=http://".$url."' >"; 442 476 echo"</head><body>7. kb3_inv_detail ind_all_id index added</body>"; 443 477 die(); … … 470 504 config::set('007updatestatus',14); 471 505 echo "<html><head>"; 472 echo "<meta http-equiv='refresh' content='5;url=http://".$ _SERVER['HTTP_HOST'].$_SERVER['PHP_SELF']."' />";506 echo "<meta http-equiv='refresh' content='5;url=http://".$url."' >"; 473 507 echo"</head><body>7. API tables added</body>"; 474 508 die(); … … 490 524 config::set('007updatestatus',15); 491 525 echo "<html><head>"; 492 echo "<meta http-equiv='refresh' content='5;url=http://".$ _SERVER['HTTP_HOST'].$_SERVER['PHP_SELF']."' />";526 echo "<meta http-equiv='refresh' content='5;url=http://".$url."' >"; 493 527 echo"</head><body>7. Subsystem slots added</body>"; 494 528 die(); … … 507 541 killCache(); 508 542 config::set("DBUpdate","007"); 543 $qry->execute("UPDATE kb3_config SET cfg_value = '007' WHERE cfg_key = 'DBUpdate'"); 509 544 config::del('007updatestatus'); 510 545 echo "<html><head>"; 511 echo "<meta http-equiv='refresh' content='5;url=http://".$ _SERVER['HTTP_HOST'].$_SERVER['PHP_SELF']."' />";546 echo "<meta http-equiv='refresh' content='5;url=http://".$url."' >"; 512 547 echo"</head><body>7. Empty tables truncated.<br>Update 007 completed.</body>"; 513 548 die(); … … 519 554 function update008() 520 555 { 556 global $url; 521 557 //Checking if this Update already done 522 558 if (CURRENT_DB_UPDATE < "008" ) … … 551 587 $qry->execute("ALTER TABLE `kb3_inv_detail` ADD INDEX ( `ind_kll_id`, `ind_order` ) "); 552 588 echo "<html><head>"; 553 echo "<meta http-equiv='refresh' content='5;url=http://".$ _SERVER['HTTP_HOST'].$_SERVER['PHP_SELF']."' />";589 echo "<meta http-equiv='refresh' content='5;url=http://".$url."' >"; 554 590 echo"</head><body>8. kb3_inv_detail index id_order added</body>"; 555 591 die(); … … 559 595 $qry->execute("ALTER TABLE `kb3_inv_detail` ADD INDEX ( `ind_crp_id` ) "); 560 596 echo "<html><head>"; 561 echo "<meta http-equiv='refresh' content='5;url=http://".$ _SERVER['HTTP_HOST'].$_SERVER['PHP_SELF']."' />";597 echo "<meta http-equiv='refresh' content='5;url=http://".$url."' >"; 562 598 echo"</head><body>8. kb3_inv_detail index id_order added</body>"; 563 599 die(); … … 567 603 $qry->execute("ALTER TABLE `kb3_inv_detail` ADD INDEX ( `ind_all_id` ) "); 568 604 echo "<html><head>"; 569 echo "<meta http-equiv='refresh' content='5;url=http://".$ _SERVER['HTTP_HOST'].$_SERVER['PHP_SELF']."' />";605 echo "<meta http-equiv='refresh' content='5;url=http://".$url."' >"; 570 606 echo"</head><body>8. kb3_inv_detail index id_order added</body>"; 571 607 die(); … … 575 611 $qry->execute("ALTER TABLE `kb3_inv_detail` ADD INDEX ( `ind_plt_id` ) "); 576 612 echo "<html><head>"; 577 echo "<meta http-equiv='refresh' content='5;url=http://".$ _SERVER['HTTP_HOST'].$_SERVER['PHP_SELF']."' />";613 echo "<meta http-equiv='refresh' content='5;url=http://".$url."' >"; 578 614 echo"</head><body>8. kb3_inv_detail index id_order added</body>"; 579 615 die(); … … 598 634 config::set('008updatestatus', 2); 599 635 echo "<html><head>"; 600 echo "<meta http-equiv='refresh' content='5;url=http://".$ _SERVER['HTTP_HOST'].$_SERVER['PHP_SELF']."' />";636 echo "<meta http-equiv='refresh' content='5;url=http://".$url."' >"; 601 637 echo"</head><body>8. Unique corp names: updated kb3_inv_detail</body>"; 602 638 die(); … … 607 643 config::set('008updatestatus', 3); 608 644 echo "<html><head>"; 609 echo "<meta http-equiv='refresh' content='5;url=http://".$ _SERVER['HTTP_HOST'].$_SERVER['PHP_SELF']."' />";645 echo "<meta http-equiv='refresh' content='5;url=http://".$url."' >"; 610 646 echo"</head><body>8. Unique corp names: updated kb3_pilots</body>"; 611 647 die(); … … 616 652 config::set('008updatestatus', 4); 617 653 echo "<html><head>"; 618 echo "<meta http-equiv='refresh' content='5;url=http://".$ _SERVER['HTTP_HOST'].$_SERVER['PHP_SELF']."' />";654 echo "<meta http-equiv='refresh' content='5;url=http://".$url."' >"; 619 655 echo"</head><body>8. Unique corp names: updated kb3_kills</body>"; 620 656 die(); … … 625 661 config::set('008updatestatus', 6); 626 662 echo "<html><head>"; 627 echo "<meta http-equiv='refresh' content='5;url=http://".$ _SERVER['HTTP_HOST'].$_SERVER['PHP_SELF']."' />";663 echo "<meta http-equiv='refresh' content='5;url=http://".$url."' >"; 628 664 echo"</head><body>8. Unique corp names: updated kb3_corps</body>"; 629 665 die(); … … 650 686 config::set('008updatestatus', 7); 651 687 echo "<html><head>"; 652 echo "<meta http-equiv='refresh' content='5;url=http://".$ _SERVER['HTTP_HOST'].$_SERVER['PHP_SELF']."' />";688 echo "<meta http-equiv='refresh' content='5;url=http://".$url."' >"; 653 689 echo"</head><body>8. Unique corp names: unique index added to kb3_corps</body>"; 654 690 die(); … … 671 707 config::set('008updatestatus', 8); 672 708 echo "<html><head>"; 673 echo "<meta http-equiv='refresh' content='5;url=http://".$ _SERVER['HTTP_HOST'].$_SERVER['PHP_SELF']."' />";709 echo "<meta http-equiv='refresh' content='5;url=http://".$url."' >"; 674 710 echo"</head><body>8. Unique all names: updated kb3_inv_detail</body>"; 675 711 die(); … … 680 716 config::set('008updatestatus', 9); 681 717 echo "<html><head>"; 682 echo "<meta http-equiv='refresh' content='5;url=http://".$ _SERVER['HTTP_HOST'].$_SERVER['PHP_SELF']."' />";718 echo "<meta http-equiv='refresh' content='5;url=http://".$url."' >"; 683 719 echo"</head><body>8. Unique all names: updated kb3_corps</body>"; 684 720 die(); … … 689 725 config::set('008updatestatus', 10); 690 726 echo "<html><head>"; 691 echo "<meta http-equiv='refresh' content='5;url=http://".$ _SERVER['HTTP_HOST'].$_SERVER['PHP_SELF']."' />";727 echo "<meta http-equiv='refresh' content='5;url=http://".$url."' >"; 692 728 echo"</head><body>8. Unique all names: updated kb3_kills</body>"; 693 729 die(); … … 699 735 config::set('008updatestatus', 12); 700 736 echo "<html><head>"; 701 echo "<meta http-equiv='refresh' content='5;url=http://".$ _SERVER['HTTP_HOST'].$_SERVER['PHP_SELF']."' />";737 echo "<meta http-equiv='refresh' content='5;url=http://".$url."' >"; 702 738 echo"</head><body>8. Unique all names: updated kb3_alliances</body>"; 703 739 die(); … … 722 758 config::set('008updatestatus', 13); 723 759 echo "<html><head>"; 724 echo "<meta http-equiv='refresh' content='5;url=http://".$ _SERVER['HTTP_HOST'].$_SERVER['PHP_SELF']."' />";760 echo "<meta http-equiv='refresh' content='5;url=http://".$url."' >"; 725 761 echo"</head><body>8. Unique all names: unique index applied to kb3_alliances</body>"; 726 762 die(); … … 744 780 config::set('008updatestatus', 14); 745 781 echo "<html><head>"; 746 echo "<meta http-equiv='refresh' content='5;url=http://".$ _SERVER['HTTP_HOST'].$_SERVER['PHP_SELF']."' />";782 echo "<meta http-equiv='refresh' content='5;url=http://".$url."' >"; 747 783 echo"</head><body>8. Unique plt names: updated kb3_inv_detail</body>"; 748 784 die(); … … 753 789 config::set('008updatestatus', 15); 754 790 echo "<html><head>"; 755 echo "<meta http-equiv='refresh' content='5;url=http://".$ _SERVER['HTTP_HOST'].$_SERVER['PHP_SELF']."' />";791 echo "<meta http-equiv='refresh' content='5;url=http://".$url."' >"; 756 792 echo"</head><body>8. Unique plt names: updated kb3_kills victim</body>"; 757 793 die(); … … 762 798 config::set('008updatestatus', 16); 763 799 echo "<html><head>"; 764 echo "<meta http-equiv='refresh' content='5;url=http://".$ _SERVER['HTTP_HOST'].$_SERVER['PHP_SELF']."' />";800 echo "<meta http-equiv='refresh' content='5;url=http://".$url."' >"; 765 801 echo"</head><body>8. Unique plt names: updated kb3_kills killer</body>"; 766 802 die(); … … 771 807 config::set('008updatestatus', 17); 772 808 echo "<html><head>"; 773 echo "<meta http-equiv='refresh' content='5;url=http://".$ _SERVER['HTTP_HOST'].$_SERVER['PHP_SELF']."' />";809 echo "<meta http-equiv='refresh' content='5;url=http://".$url."' >"; 774 810 echo"</head><body>8. Unique plt names: updated kb3_pilots</body>"; 775 811 die(); … … 794 830 config::set('008updatestatus', 18); 795 831 echo "<html><head>"; 796 echo "<meta http-equiv='refresh' content='5;url=http://".$ _SERVER['HTTP_HOST'].$_SERVER['PHP_SELF']."' />";797 echo"</head><body>8. Unique plt names: unique index applied to kb3_pilots.< br>Update 8 applied.</body>";832 echo "<meta http-equiv='refresh' content='5;url=http://".$url."' >"; 833 echo"</head><body>8. Unique plt names: unique index applied to kb3_pilots.</body>"; 798 834 die(); 799 835 } … … 804 840 killCache(); 805 841 config::set("DBUpdate", "008"); 842 $qry->execute("UPDATE kb3_config SET cfg_value = '008' WHERE cfg_key = 'DBUpdate'"); 806 843 config::del("008updatestatus"); 844 echo "<html><head>"; 845 echo "<meta http-equiv='refresh' content='5;url=http://".$url."' >"; 846 echo"</head><body>Update 008 completed.</body>"; 847 die(); 807 848 } 808 849 } … … 811 852 function update009() 812 853 { 854 global $url; 813 855 //Checking if this Update already done 814 856 if (CURRENT_DB_UPDATE < "009" ) … … 836 878 $qry->execute($sql); 837 879 config::set("DBUpdate", "009"); 880 $qry->execute("UPDATE kb3_config SET cfg_value = '009' WHERE cfg_key = 'DBUpdate'"); 838 881 echo "<html><head>"; 839 echo "<meta http-equiv='refresh' content='5;url=http://".$ _SERVER['HTTP_HOST'].$_SERVER['PHP_SELF']."' />";840 echo"</head><body> 9. Update 9 applied.</body>";882 echo "<meta http-equiv='refresh' content='5;url=http://".$url."' >"; 883 echo"</head><body>Update 009 completed.</body>"; 841 884 die(); 842 885 } … … 846 889 function update010() 847 890 { 891 global $url; 848 892 //Checking if this Update already done 849 893 if (CURRENT_DB_UPDATE < "010" ) … … 862 906 863 907 config::set("DBUpdate", "010"); 908 echo "<html><head>"; 909 echo "<meta http-equiv='refresh' content='5;url=http://".$url."' >"; 910 echo"</head><body>Update 010 completed.</body>"; 911 die(); 864 912 } 865 913 }