You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

70 lines
2.7 KiB

​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
  1. <?php
  2. echo "\n\n\nBEFORE\n\n\n";
  3. $DBHost="localhost";
  4. $DBName="argus";
  5. $DBUser="argus";
  6. $DBPassword="Jc8zYWEhqGAGGYJRum92tm";
  7. run_command( 'systemctl stop argus_nginx');
  8. run_command( 'systemctl stop nginx');
  9. run_command( 'killall -s 9 starProcDaemon -q');
  10. run_command( 'killall -s 9 serva -q');
  11. run_command( 'killall -s 9 serva_d -q' );
  12. sleep( 3 );
  13. //Try Save Settings
  14. $USERS_SETTINGS=array();
  15. $SYSTEM_SETTINGS=array();
  16. $TOPOLOGY_SETTINGS=array();
  17. $INS_TIME_DB = false;
  18. $TT_123 = explode( '.', PHP_VERSION );
  19. if( $TT_123[0] == '4' ){
  20. require_once( $WDIR . '/MySQL_class.php' );
  21. $INS_TIME_DB = new MySQL_DB($DBHost, $DBName, $DBUser, $DBPassword);
  22. } elseif( $TT_123[0] > '4' ){
  23. require_once( $WDIR . '/MySQLi_class.php' );
  24. $INS_TIME_DB = new MySQLi_DB($DBHost, $DBName, $DBUser, $DBPassword);
  25. };
  26. if( $INS_TIME_DB !== false ){
  27. out_log("Old Database Exists!");
  28. $QS="SELECT * FROM `users`";
  29. $USERS_SETTINGS = $INS_TIME_DB->Query( $QS );
  30. $QS="SELECT * FROM `system_props`";
  31. $SYSTEM_SETTINGS = $INS_TIME_DB->Query( $QS );
  32. $QS="SELECT * FROM `metro_lines`";
  33. $TOPOLOGY_SETTINGS['metro_lines'] = $INS_TIME_DB->Query( $QS );
  34. $QS="SELECT * FROM `metro_stations`";
  35. $TOPOLOGY_SETTINGS['metro_stations'] = $INS_TIME_DB->Query( $QS );
  36. $QS="SELECT * FROM `metro_platforms`";
  37. $TOPOLOGY_SETTINGS['metro_platforms'] = $INS_TIME_DB->Query( $QS );
  38. $QS="SELECT * FROM `metro_tracks`";
  39. $TOPOLOGY_SETTINGS['metro_tracks'] = $INS_TIME_DB->Query( $QS );
  40. $QS="SELECT * FROM `metro_modules`";
  41. $TOPOLOGY_SETTINGS['metro_modules'] = $INS_TIME_DB->Query( $QS );
  42. $QS="SELECT * FROM `metro_platforms_2_lines`";
  43. $TOPOLOGY_SETTINGS['metro_platforms_2_lines'] = $INS_TIME_DB->Query( $QS );
  44. $QS="SELECT * FROM `metro_stations_2_lines`";
  45. $TOPOLOGY_SETTINGS['metro_stations_2_lines'] = $INS_TIME_DB->Query( $QS );
  46. unset( $INS_TIME_DB );
  47. out_log("Old Settings Read!");
  48. };
  49. //Web Interface
  50. run_command( 'rm -R -f /srv/www' );
  51. //$CC = `rm -R -f /srv/www/web/style`;
  52. //$CC = `rm -R -f /srv/www/web/lib/controller/data/uploads`;
  53. //$CC = `rm -R -f /srv/www/web/lib/controller/dash`;
  54. //$CC = `rm -R -f /srv/www/web/lib/controller/props`;
  55. //$CC = `rm -R -f /srv/www/web/lib/controller/report`;
  56. //$CC = `rm -f /srv/www/web/lib/controller/*.php`;//*/
  57. //$CC = `rm -R -f /srv/www/web/lib/javascript`;
  58. //$CC = `rm -R -f /srv/www/web/lib/php`;
  59. //Control Panel
  60. //$CC = `rm -R -f /srv/www/distro`;
  61. //Application
  62. run_command( 'rm -R -f /srv/serva' );
  63. run_command( 'rm -R -f /srv/start' );
  64. //Settings
  65. run_command( 'rm -R -f /srv/etc' );
  66. run_command( 'rm -R -f /srv/scripts' );
  67. sleep( 5 );
  68. ?>