# Modified Last By: Mike Gleaves (Ric) # Web: http://www.uniformserver.com # V1.0 29-6-2009 ############################################################################### */ #error_reporting(0); // Disable PHP errors and warnings // Comment to Enable for testing chdir(dirname(__FILE__)); // Change wd to this files location include_once "../../main/includes/config.inc.php"; include_once "../../main/includes/functions.php"; run_location_tracker(); // Have servers moved update configuration accordingly //=== Update shebang in all files in folder cgi-bin and sub-folders =========== print "\n ============== PERL SHEBANG UPDATE =============\n\n"; if (perl_installed()) { $start_dir = $us_cgi_bin; // Main Perl folder $file_type = '/(\\.pl|\\.cgi)/'; // List of file types $search_str = "/#!.*/"; // Old shebang $replace_str = "#!" . $base_f . "/usr/bin/perl.exe"; // New shebang recursive_search_replace($start_dir, $file_type, $search_str, $replace_str); print " Updated shebang in files: *.pl and *.cgi\n\n"; print " In folder UniServer\\cgi-bin and all sub-folders.\n\n"; } else { print " No action taken!\n\n"; print " Perl not installed\n\n"; }
function run_location_tracker() { global $usf_location_tracker; // Tracker file previous location global $base_f; // Current server base folder global $usf_apache_cnf; // Apache configuration file global $usf_apache_ssl_cnf; // Apache SSL configuration file global $usf_my_ini; // MySQL configuration file global $usf_small_my_ini; // MySQL alternative configuration file global $usf_medium_my_ini; // MySQL alternativeconfiguration file global $usf_php_ini; // PHP configuration file global $usf_php_ini_prod; // PHP production configuration file global $usf_php_ini_dev; // PHP pdelvelopment configuration file global $usf_msmtp; // msmtp configuration file global $us_cgi_bin; // Per folder if (get_location_tracker() != $base_f) { // Server has been moved $s_str = get_location_tracker(); // yes: Get old location $s_str = preg_quote($s_str, '/'); // Convert to regex format $s_str = '/' . $s_str . '/'; // Create regex pattern file_search_replace($usf_apache_cnf, $s_str, $base_f); // Update Apache cnf file_search_replace($usf_apache_ssl_cnf, $s_str, $base_f); // Update Apache SSL cnf file_search_replace($usf_my_ini, $s_str, $base_f); // Update MySQL ini file_search_replace($usf_small_my_ini, $s_str, $base_f); // Update alternative MySQL ini file_search_replace($usf_medium_my_ini, $s_str, $base_f); // Update alternative MySQL ini file_search_replace($usf_php_ini, $s_str, $base_f); // Update PHP ini file_search_replace($usf_php_ini_prod, $s_str, $base_f); // Update PHP production ini file_search_replace($usf_php_ini_dev, $s_str, $base_f); // Update PHP delvelopment ini if (file_exists($usf_msmtp)) { // Only update if exists file_search_replace($usf_msmtp, $s_str, $base_f); // Update msmpt ini } //=== Docs redirect == $file = $base_f . "/unicon/docs/redirect.html"; // new location of file $old_str = get_location_tracker() . "/docs/"; // old folder location $new_str = $base_f . "/docs/"; // new folder location $old_str = preg_replace('/\\//', '\\', $old_str); // Replace / with \ to keeps IE happy $new_str = preg_replace('/\\//', '\\\\\\', $new_str); // Replace / with \ to keeps IE happy $s_str = preg_quote($old_str, '/'); // Convert to regex format $s_str = '/' . $s_str . '/'; // Create regex pattern file_search_replace($file, $s_str, $new_str); // Update redirection file //=== Update shebang in all files in folder cgi-bin and sub-folders =========== if (perl_installed()) { // Only update if Perl installed $start_dir = $us_cgi_bin; // Main Perl folder $file_type = '/(\\.pl|\\.cgi)/'; // List of file types $search_str = "/#!.*/"; // Old shebang $replace_str = "#!" . $base_f . "/usr/bin/perl.exe"; // New shebang recursive_search_replace($start_dir, $file_type, $search_str, $replace_str); } set_location_tracker(); // Update to new location } // no: return }