//Has user already set a port other than 80? $httpdFileContents = @file_get_contents($c_apacheConfFile) or die("httpd.conf file not found"); if (preg_match("/^Listen.+:([0-9]{2,5})\$/m", $httpdFileContents, $matches) > 0) { //port number is specified if ($matches[1] != $c_DefaultPort) { $apacheConf['apachePortUsed'] = $matches[1]; $apacheConf['apacheUseOtherPort'] = "on"; wampIniSet($configurationFile, $apacheConf); } } } //Settings for MySQL (port used and change port) for ($i = 0; $i < count($mysql_Param); $i++) { if (!isset($wampConf[$mysql_Param[$i]])) { //Parameter does not exist createWampConfParam($mysql_Param[$i], $mysql_Param_Value[$i], "[mysqloptions]", $configurationFile); } } //Language error messages of MySQL //Put MySQL error messages in English if the language is not French. //Warnings masked because the my.ini file defines comments by #, which is obsolete (Should be ;) $mysqlConf = @parse_ini_file($c_mysqlConfFile); if (isset($mysqlConf['lc-messages'])) { if ($mysqlConf['lc-messages'] == 'fr_FR' && $wampConf['language'] != 'french') { $mysqlConfNew['lc-messages'] = "en_US"; $iniFileContents = @file_get_contents($c_mysqlConfFile); foreach ($mysqlConfNew as $param => $value) { $iniFileContents = preg_replace('|^' . $param . '=.*|m', $param . '=' . $value, $iniFileContents); } $fp = fopen($c_mysqlConfFile, 'w'); fwrite($fp, $iniFileContents);
<?php // [modif oto] - script ajouté pour gérer les nouveaux paramètres // de configuration ajoutés à wampmanager.conf require 'wampserver.lib.php'; require 'config.inc.php'; if ($_SERVER['argv'][2] == 'create') { createWampConfParam($_SERVER['argv'][1], $_SERVER['argv'][3], $_SERVER['argv'][4], $configurationFile); } else { $wampIniNewContents[$_SERVER['argv'][1]] = $_SERVER['argv'][2]; wampIniSet($configurationFile, $wampIniNewContents); }
// on inclus les fichiers de langue de modules correspondant à la langue courante if ($handle = opendir($langDir . $modulesDir)) { while (false !== ($file = readdir($handle))) { if ($file != "." && $file != ".." && preg_match('|_' . $lang . '|', $file)) { include $langDir . $modulesDir . $file; } } closedir($handle); } //Check if some apache parameters exists //[modif oto] Settings for Apache (port used and change port) $create_param = false; for ($i = 0; $i < count($apache_Param); $i++) { if (!isset($wampConf[$apache_Param[$i]])) { //Paramètre n'existe pas dans wampmanager.conf) createWampConfParam($apache_Param[$i], $apache_Param_Value[$i], "[mysql]", "[apache]", $configurationFile); $create_param = true; } } //Reload config.inc.php if parameter created (Not very good code !) if ($create_param) { @(include 'config.inc.php'); } //Update string to use alternate port. $w_AlternatePort = sprintf($w_UseAlternatePort, $c_UsedPort); if ($c_UsedPort == $c_DefaultPort) { $UrlPort = ''; } else { $UrlPort = ':' . $c_UsedPort; } // ************************
fwrite($fpWampConf, $wampConfFileContents); fclose($fpWampConf); } //Parameters for Wampmanager settings for ($i = 0; $i < count($wamp_Param); $i++) { if (!isset($wampConf[$wamp_Param[$i]])) { //Parameter does not exist createWampConfParam($wamp_Param[$i], "off", "[options]", $configurationFile); } } $apache_create = false; //Settings for Apache (port used and change port) for ($i = 0; $i < count($apache_Param); $i++) { if (!isset($wampConf[$apache_Param[$i]])) { //Parameter does not exist createWampConfParam($apache_Param[$i], $apache_Param_Value[$i], "[apacheoptions]", $configurationFile); $apache_create = true; } } if ($apache_create) { //Has user already set a port other than 80? $httpdFileContents = @file_get_contents($c_apacheConfFile) or die("httpd.conf file not found"); if (preg_match("/^Listen.+:([0-9]{2,5})\$/m", $httpdFileContents, $matches) > 0) { //port number is specified if ($matches[1] != $c_DefaultPort) { $apacheConf['apachePortUsed'] = $matches[1]; $apacheConf['apacheUseOtherPort'] = "on"; wampIniSet($configurationFile, $apacheConf); } } }
if ($mysqlConf['lc-messages'] == 'fr_FR' && $wampConf['language'] != 'french') { $mysqlConfNew['lc-messages'] = "en_US"; $iniFileContents = @file_get_contents($c_mysqlConfFile); foreach ($mysqlConfNew as $param => $value) { $iniFileContents = preg_replace('|^' . $param . '=.*|m', $param . '=' . $value, $iniFileContents); } $fp = fopen($c_mysqlConfFile, 'w'); fwrite($fp, $iniFileContents); fclose($fp); } } //Settings for MariaDB (port used and change port) for ($i = 0; $i < count($mariadb_Param); $i++) { if (!isset($wampConf[$mariadb_Param[$i]])) { //Parameter does not exist createWampConfParam($mariadb_Param[$i], $mariadb_Param_Value[$i], "[mariadboptions]", $configurationFile); } } //Check some value in my.ini file $myIniContents = file_get_contents_dos($c_mariadbConfFile); $my_ini_modified = false; //Check name of the group [wamp...] under '# The MariaDB server' in my.ini file //must be the name of the mariadb service. if (strpos($myIniContents, "[" . $c_mariadbService . "]") === false) { $myIniNewContents = preg_replace("/^\\[wamp.*\\].*\n/m", "[" . $c_mariadbService . "]\r\n", $myIniContents, 1, $count); if (!is_null($myIniNewContents) && $count == 1) { $myIniContents = $myIniNewContents; $my_ini_modified = true; unset($myIniNewContents); } }