if (get_apache_tracker() == "program") { print " Apache install status = Installed as a standard program\n"; } } else { print " Apache run status = Not running\n"; if (get_apache_tracker() == "free") { print " Apache install status = Free to install\n"; } if (get_apache_tracker() != "free") { print " Apache install status = Undefined!\n"; } } //===================================================================== print "\n MySQL SERVER:\n\n"; print " MySQL port = " . get_mysql_port() . "\n"; print " MySQL executable name = " . get_mysql_exe() . "\n"; print " MySQL service name = {$us_mysql_service_name}\n"; // Check was PC switched off while server running if (!mysql_running() && get_mysql_tracker() == "program") { set_mysql_tracker('free'); } if (mysql_running() && get_mysql_tracker() != "free") { print " MySQL run status = Running\n"; if (get_mysql_tracker() == "program") { print " MySQL install status = Installed as a standard program\n"; } if (get_mysql_tracker() == "service") { print " MySQL install status = Installed as a service\n"; } } else { print " MySQL run status = Not running\n";
exit(1); // Exit with error code } $safety_timer = $safety_timer + 1; // update timer usleep(500000); // delay 0.5 sec and repeat } //=== Update password file ============== print " Password file restored to root\n"; $wfile = fopen($usf_mysql_passwd, 'w'); fwrite($wfile, "root"); fclose($wfile); //=== Restore password ==================== print " Restoring MySQL server password\n"; $MySQL_exe = get_mysql_exe(); // get program name $cmd = "middleman.bat {$MySQL_exe}"; // command line to be run exec($cmd, $dummy, $return); // 0=running 1=not-running print " Restored MySQL server password\n"; //=== Restore Server to original state ===== if ($status == "service") { print " Starting MySQL service\n"; start_mysql_service(); } if ($status == "program") { print " Starting MySQL program\n"; start_mysql(); }
function mysql_running() { global $usf_pskill; // pskill program $MySQL_exe = get_mysql_exe(); $cmd = "{$usf_pskill} {$MySQL_exe}"; // command line to be run exec($cmd, $dummy, $return); // 0=running 1=not-running if ($return == 0) { // Check return value return true; // MySQL is running } else { return false; // MySQL not running } }
} $Apache_service_name_old = $us_apache_service_name; # Apache original service name # Apache New service name if (preg_match("/([a-zA-Z]+)(\\d*)/", $Apache_service_name_old, $matches)) { $Apache_service_name = $matches[1] . ($matches[2] + 1); } $MySQL_port_old = get_mysql_port(); # Server port $MySQL_port = $MySQL_port_old + 1; # New Server port # Avoid these ports if ($MySQL_port == $avoid1 || $MySQL_port == $avoid2) { $MySQL_port = $MySQL_port + 1; } $MySQL_name_old = get_mysql_exe(); # MySQL executable name # New MYSQL executable name if (preg_match("/([a-zA-Z\\-]+)(\\d*)(\\.exe)/", $MySQL_name_old, $matches)) { $MySQL_name = $matches[1] . ($matches[2] + 1) . $matches[3]; } $MySQL_service_name_old = $us_mysql_service_name; # MySQL original service name # MySQL service name if (preg_match("/([a-zA-Z]+)(\\d*)/", $MySQL_service_name_old, $matches)) { $MySQL_service_name = $matches[1] . ($matches[2] + 1); } // UniTray $UniTray_name_old = get_unitray_exe(); # UniTray executable name # New UniTray executable name