From 57706ba5242510c3d755883f048179e55292a98b Mon Sep 17 00:00:00 2001 From: pedro_morgan <pedro_morgan@ispconfig3> Date: Sat, 18 Aug 2007 02:14:02 +0000 Subject: [PATCH] Pedro makes the code look like its a PEAR, sorry adam. Aalso enquring for interface and sanity checks" --- install/install.php | 128 +++++++++++++++++++-------------------- install/options.conf.php | 40 ++++++------ 2 files changed, 80 insertions(+), 88 deletions(-) diff --git a/install/install.php b/install/install.php index 8f4bf5c0c..9f4f54cf1 100644 --- a/install/install.php +++ b/install/install.php @@ -32,120 +32,115 @@ EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ISPConfig 3 installer. */ -// Check for existing installation +//** Check for existing installation //if(is_dir("/usr/local/ispconfig")) die('We will stop here. There is already a ISPConfig installation, use the update script to update this installation.'); -// Include the library with the basic installer functions +//** Include the library with the basic installer functions require_once('lib/install.lib.php'); -// Include the base class of the installer class +//** Include the base class of the installer class require_once('lib/installer_base.lib.php'); include_once('options.conf.php'); $distname = get_distname(); -// Include the distribution specific installer class library -// and configuration +//** Include the distribution specific installer class library and configuration include_once('dist/lib/'.$conf['distname'].'.lib.php'); include_once('dist/conf/'.$conf['distname'].'.conf.php'); $conf['dist'] = $dist; +//** Lets go ! $inst = new installer(); +swriteln($inst->lng('This application will install ISPConfig 3 on your server.')); +//** Select the language +$conf['language'] = $inst->simple_query('Select language', array('en','de'), 'en'); +//** Select installation mode +$install_mode = $inst->simple_query('Installation mode', array('Standard','Expert'), 'Standard'); -swriteln($inst->lng("This application will install ISPConfig 3 on your server.")); - -// Select the language -$conf["language"] = $inst->simple_query('Select language',array('en','de'),'en'); - -// Select installation mode -$install_mode = $inst->simple_query('Installation mode',array('Standard','Expert'),'Standard'); - -// Get the hostname +//** Get the hostname $tmp_out = array(); -exec("hostname -f",$tmp_out); -$conf["hostname"] = $inst->free_query('Full qualified hostname (FQDN) of the server',$tmp_out[0]); +exec('hostname -f', $tmp_out); +$conf['hostname'] = $inst->free_query('Full qualified hostname (FQDN) of the server', $tmp_out[0]); unset($tmp_out); - - -// Get MySQL root password +//** Get MySQL root credentials $finished = false; do { - $tmp_mysql_server_host = $inst->free_query('MySQL server hostname',$conf["mysql"]["host"]); - $tmp_mysql_server_admin_user = $inst->free_query('MySQL root username',$conf["mysql"]["admin_user"]); - $tmp_mysql_server_admin_password = $inst->free_query('MySQL root password',$conf["mysql"]["admin_password"]); + $tmp_mysql_server_host = $inst->free_query('MySQL server hostname',$conf['mysql']['host']); + $tmp_mysql_server_admin_user = $inst->free_query('MySQL root username',$conf['mysql']['admin_user']); + $tmp_mysql_server_admin_password = $inst->free_query('MySQL root password',$conf['mysql']['admin_password']); - // Initialize the MySQL server connection + //* Initialize the MySQL server connection if(@mysql_connect($tmp_mysql_server_host, $tmp_mysql_server_admin_user, $tmp_mysql_server_admin_password)) { - $conf["mysql"]["host"] = $tmp_mysql_server_host; - $conf["mysql"]["admin_user"] = $tmp_mysql_server_admin_user; - $conf["mysql"]["admin_password"] = $tmp_mysql_server_admin_password; + $conf['mysql']['host'] = $tmp_mysql_server_host; + $conf['mysql']['admin_user'] = $tmp_mysql_server_admin_user; + $conf['mysql']['admin_password'] = $tmp_mysql_server_admin_password; $finished = true; } else { - swriteln($inst->lng("Unable to connect to mysql server").' '.mysql_error()); + swriteln($inst->lng('Unable to connect to mysql server').' '.mysql_error()); } } while ($finished == false); unset($finished); -// initializing database connection +//** initializing database connection include_once('lib/mysql.lib.php'); $inst->db = new db(); -// Begin with standard or expert installation +//** Begin with standard or expert installation if($install_mode == 'Standard') { - // Create the mysql database + //* Create the mysql database $inst->configure_database(); - // Configure postfix + //* Configure postfix $inst->configure_postfix(); - // Configure saslauthd + //* Configure saslauthd swriteln('Configuring SASL'); $inst->configure_saslauthd(); - // Configure PAM + //* Configure PAM swriteln('Configuring PAM'); $inst->configure_pam(); - // Configure courier + //* Configure courier swriteln('Configuring Courier'); $inst->configure_courier(); - // Configure Spamasassin + //* Configure Spamasassin swriteln('Configuring Spamassassin'); $inst->configure_spamassassin(); - // Configure Amavis + //* Configure Amavis swriteln('Configuring Amavisd'); $inst->configure_amavis(); - // Configure Getmail + //* Configure Getmail swriteln('Configuring Getmail'); $inst->configure_getmail(); - // Configure Pureftpd + //* Configure Pureftpd swriteln('Configuring Pureftpd'); $inst->configure_pureftpd(); - // Configure MyDNS + //* Configure MyDNS swriteln('Configuring MyDNS'); $inst->configure_mydns(); - // Configure Apache + //* Configure Apache swriteln('Configuring Apache'); $inst->configure_apache(); - // Configure ISPConfig + //* Configure ISPConfig swriteln('Installing ISPConfig'); $inst->install_ispconfig(); - // Configure ISPConfig + //* Configure ISPConfig swriteln('Installing Crontab'); $inst->install_crontab(); @@ -164,40 +159,40 @@ if($install_mode == 'Standard') { system($conf['dist']["init_scripts"].'/'.$conf['dist']['pureftpd']['init_script'].' restart'); system($conf['dist']["init_scripts"].'/'.$conf['dist']['mydns']['init_script'].' restart'); -} else { - - // Get Server ID - $conf["server_id"] = $inst->free_query('Unique Numeric ID of the server','1'); +}else{ + + //** Get Server ID + $conf['server_id'] = $inst->free_query('Unique Numeric ID of the server','1'); if(strtolower($inst->simple_query('Create Database',array('y','n'),'y')) == 'y') { - // Create the mysql database + //* Create the mysql database $inst->configure_database(); - system("/etc/init.d/mysql restart"); + system('/etc/init.d/mysql restart'); } - if(strtolower($inst->simple_query('Configure Mail',array('y','n'),'y')) == 'y') { + if(strtolower($inst->simple_query('Configure Mail', array('y','n') ,'y') ) == 'y') { - // Configure Postfix + //* Configure Postfix swriteln('Configuring Postfix'); $inst->configure_postfix(); - // Configure PAM + //* Configure PAM swriteln('Configuring PAM'); $inst->configure_pam(); - // Configure courier + //* Configure courier swriteln('Configuring Courier'); $inst->configure_courier(); - // Configure Spamasassin + //* Configure Spamasassin swriteln('Configuring Spamassassin'); $inst->configure_spamassassin(); - // Configure Amavis + //* Configure Amavis swriteln('Configuring Amavisd'); $inst->configure_amavis(); - // Configure Getmail + //* Configure Getmail swriteln('Configuring Getmail'); $inst->configure_getmail(); @@ -212,42 +207,41 @@ if($install_mode == 'Standard') { system($conf['dist']["init_scripts"].'/'.$conf['dist']['courier']['courier-pop-ssl'].' restart'); } - if(strtolower($inst->simple_query('Configure FTP Server',array('y','n'),'y')) == 'y') { - // Configure Pureftpd + //** Configure Pureftpd + if(strtolower($inst->simple_query('Configure FTP Server', array('y','n'),'y') ) == 'y') { swriteln('Configuring Pureftpd'); $inst->configure_pureftpd(); system($conf['dist']["init_scripts"].'/'.$conf['dist']['pureftpd']['init_script'].' restart'); } + //** Configure MyDNS if(strtolower($inst->simple_query('Configure DNS Server',array('y','n'),'y')) == 'y') { - // Configure MyDNS swriteln('Configuring MyDNS'); $inst->configure_mydns(); system($conf['dist']["init_scripts"].'/'.$conf['dist']['mydns']['init_script'].' restart'); } - if(strtolower($inst->simple_query('Configure Apache Server',array('y','n'),'y')) == 'y') { - // Configure Apache + //** Configure Apache + if(strtolower($inst->simple_query('Configure Apache Server',array('y','n'),'y')) == 'y') { swriteln('Configuring Apache'); $inst->configure_apache(); } + //** Configure ISPConfig :-) if(strtolower($inst->simple_query('Install ISPConfig',array('y','n'),'y')) == 'y') { - // Configure ISPConfig swriteln('Installing ISPConfig'); $inst->install_ispconfig(); - - // Configure ISPConfig + + //* Configure ISPConfig swriteln('Installing Crontab'); $inst->install_crontab(); system($conf['dist']["init_scripts"].'/'.$conf['dist']['apache']['init_script'].' restart'); } - -} +} //* << $install_mode / 'Standard' or Genius -echo "Installation finished.\n"; +echo "Installation completed.\n"; -?> +?> \ No newline at end of file diff --git a/install/options.conf.php b/install/options.conf.php index 269c9e68d..e76aa3b3f 100644 --- a/install/options.conf.php +++ b/install/options.conf.php @@ -1,26 +1,24 @@ <?php -/* - Installation Options -*/ +//** TODO: These options need to be in an install script somehow -$conf["language"] = "en"; -$conf["distname"] = "debian40"; -$conf["hostname"] = "server1.example.com"; // Full hostname -$conf["ispconfig_install_dir"] = "/usr/local/ispconfig"; -$conf["ispconfig_config_dir"] = "/usr/local/ispconfig"; -$conf["server_id"] = 1; +//** Installation Options -/* - MySQL Database settings -*/ -$conf["mysql"]["host"] = "localhost"; -$conf["mysql"]["ip"] = "127.0.0.1"; -$conf["mysql"]["port"] = "3306"; -$conf["mysql"]["database"] = "dbispconfig"; -$conf["mysql"]["admin_user"] = "root"; -$conf["mysql"]["admin_password"] = ""; -$conf["mysql"]["ispconfig_user"] = "ispconfig"; -$conf["mysql"]["ispconfig_password"] = "5sDrewBhk"; +$conf['language'] = 'en'; +$conf['distname'] = 'debian40'; +$conf['hostname'] = 'server1.example.com'; // Full hostname +$conf['ispconfig_install_dir'] = '/usr/local/ispconfig'; +$conf['ispconfig_config_dir'] = '/usr/local/ispconfig'; +$conf['server_id'] = 1; -?> +//**MySQL Database settings +$conf['mysql']['host'] = 'localhost'; +$conf['mysql']['ip'] = '127.0.0.1'; +$conf['mysql']['port'] = '3306'; +$conf['mysql']['database'] = 'dbispconfig'; +$conf['mysql']['admin_user'] = 'root'; +$conf['mysql']['admin_password'] = ''; +$conf['mysql']['ispconfig_user'] = 'ispconfig'; +$conf['mysql']['ispconfig_password'] = '5sDrewBhk'; + +?> \ No newline at end of file -- GitLab