Skip to content

Commit 57706ba

Browse files
author
pedro_morgan
committed
Pedro makes the code look like its a PEAR, sorry adam. Aalso enquring for interface and sanity checks"
1 parent b10427b commit 57706ba

File tree

2 files changed

+80
-88
lines changed

2 files changed

+80
-88
lines changed

install/install.php

Lines changed: 61 additions & 67 deletions
Original file line numberDiff line numberDiff line change
@@ -32,120 +32,115 @@
3232
ISPConfig 3 installer.
3333
*/
3434

35-
// Check for existing installation
35+
//** Check for existing installation
3636
//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.');
3737

3838

39-
// Include the library with the basic installer functions
39+
//** Include the library with the basic installer functions
4040
require_once('lib/install.lib.php');
4141

42-
// Include the base class of the installer class
42+
//** Include the base class of the installer class
4343
require_once('lib/installer_base.lib.php');
4444

4545
include_once('options.conf.php');
4646
$distname = get_distname();
4747

48-
// Include the distribution specific installer class library
49-
// and configuration
48+
//** Include the distribution specific installer class library and configuration
5049
include_once('dist/lib/'.$conf['distname'].'.lib.php');
5150
include_once('dist/conf/'.$conf['distname'].'.conf.php');
5251

5352
$conf['dist'] = $dist;
5453

54+
//** Lets go !
5555
$inst = new installer();
56+
swriteln($inst->lng('This application will install ISPConfig 3 on your server.'));
5657

58+
//** Select the language
59+
$conf['language'] = $inst->simple_query('Select language', array('en','de'), 'en');
5760

61+
//** Select installation mode
62+
$install_mode = $inst->simple_query('Installation mode', array('Standard','Expert'), 'Standard');
5863

59-
swriteln($inst->lng("This application will install ISPConfig 3 on your server."));
60-
61-
// Select the language
62-
$conf["language"] = $inst->simple_query('Select language',array('en','de'),'en');
63-
64-
// Select installation mode
65-
$install_mode = $inst->simple_query('Installation mode',array('Standard','Expert'),'Standard');
66-
67-
// Get the hostname
64+
//** Get the hostname
6865
$tmp_out = array();
69-
exec("hostname -f",$tmp_out);
70-
$conf["hostname"] = $inst->free_query('Full qualified hostname (FQDN) of the server',$tmp_out[0]);
66+
exec('hostname -f', $tmp_out);
67+
$conf['hostname'] = $inst->free_query('Full qualified hostname (FQDN) of the server', $tmp_out[0]);
7168
unset($tmp_out);
7269

73-
74-
75-
// Get MySQL root password
70+
//** Get MySQL root credentials
7671
$finished = false;
7772
do {
78-
$tmp_mysql_server_host = $inst->free_query('MySQL server hostname',$conf["mysql"]["host"]);
79-
$tmp_mysql_server_admin_user = $inst->free_query('MySQL root username',$conf["mysql"]["admin_user"]);
80-
$tmp_mysql_server_admin_password = $inst->free_query('MySQL root password',$conf["mysql"]["admin_password"]);
73+
$tmp_mysql_server_host = $inst->free_query('MySQL server hostname',$conf['mysql']['host']);
74+
$tmp_mysql_server_admin_user = $inst->free_query('MySQL root username',$conf['mysql']['admin_user']);
75+
$tmp_mysql_server_admin_password = $inst->free_query('MySQL root password',$conf['mysql']['admin_password']);
8176

82-
// Initialize the MySQL server connection
77+
//* Initialize the MySQL server connection
8378
if(@mysql_connect($tmp_mysql_server_host, $tmp_mysql_server_admin_user, $tmp_mysql_server_admin_password)) {
84-
$conf["mysql"]["host"] = $tmp_mysql_server_host;
85-
$conf["mysql"]["admin_user"] = $tmp_mysql_server_admin_user;
86-
$conf["mysql"]["admin_password"] = $tmp_mysql_server_admin_password;
79+
$conf['mysql']['host'] = $tmp_mysql_server_host;
80+
$conf['mysql']['admin_user'] = $tmp_mysql_server_admin_user;
81+
$conf['mysql']['admin_password'] = $tmp_mysql_server_admin_password;
8782
$finished = true;
8883
} else {
89-
swriteln($inst->lng("Unable to connect to mysql server").' '.mysql_error());
84+
swriteln($inst->lng('Unable to connect to mysql server').' '.mysql_error());
9085
}
9186
} while ($finished == false);
9287
unset($finished);
9388

94-
// initializing database connection
89+
//** initializing database connection
9590
include_once('lib/mysql.lib.php');
9691
$inst->db = new db();
9792

98-
// Begin with standard or expert installation
93+
//** Begin with standard or expert installation
9994
if($install_mode == 'Standard') {
10095

101-
// Create the mysql database
96+
//* Create the mysql database
10297
$inst->configure_database();
10398

104-
// Configure postfix
99+
//* Configure postfix
105100
$inst->configure_postfix();
106101

107-
// Configure saslauthd
102+
//* Configure saslauthd
108103
swriteln('Configuring SASL');
109104
$inst->configure_saslauthd();
110105

111-
// Configure PAM
106+
//* Configure PAM
112107
swriteln('Configuring PAM');
113108
$inst->configure_pam();
114109

115-
// Configure courier
110+
//* Configure courier
116111
swriteln('Configuring Courier');
117112
$inst->configure_courier();
118113

119-
// Configure Spamasassin
114+
//* Configure Spamasassin
120115
swriteln('Configuring Spamassassin');
121116
$inst->configure_spamassassin();
122117

123-
// Configure Amavis
118+
//* Configure Amavis
124119
swriteln('Configuring Amavisd');
125120
$inst->configure_amavis();
126121

127-
// Configure Getmail
122+
//* Configure Getmail
128123
swriteln('Configuring Getmail');
129124
$inst->configure_getmail();
130125

131126

132-
// Configure Pureftpd
127+
//* Configure Pureftpd
133128
swriteln('Configuring Pureftpd');
134129
$inst->configure_pureftpd();
135130

136-
// Configure MyDNS
131+
//* Configure MyDNS
137132
swriteln('Configuring MyDNS');
138133
$inst->configure_mydns();
139134

140-
// Configure Apache
135+
//* Configure Apache
141136
swriteln('Configuring Apache');
142137
$inst->configure_apache();
143138

144-
// Configure ISPConfig
139+
//* Configure ISPConfig
145140
swriteln('Installing ISPConfig');
146141
$inst->install_ispconfig();
147142

148-
// Configure ISPConfig
143+
//* Configure ISPConfig
149144
swriteln('Installing Crontab');
150145
$inst->install_crontab();
151146

@@ -164,40 +159,40 @@
164159
system($conf['dist']["init_scripts"].'/'.$conf['dist']['pureftpd']['init_script'].' restart');
165160
system($conf['dist']["init_scripts"].'/'.$conf['dist']['mydns']['init_script'].' restart');
166161

167-
} else {
168-
169-
// Get Server ID
170-
$conf["server_id"] = $inst->free_query('Unique Numeric ID of the server','1');
162+
}else{
163+
164+
//** Get Server ID
165+
$conf['server_id'] = $inst->free_query('Unique Numeric ID of the server','1');
171166

172167
if(strtolower($inst->simple_query('Create Database',array('y','n'),'y')) == 'y') {
173-
// Create the mysql database
168+
//* Create the mysql database
174169
$inst->configure_database();
175-
system("/etc/init.d/mysql restart");
170+
system('/etc/init.d/mysql restart');
176171
}
177172

178-
if(strtolower($inst->simple_query('Configure Mail',array('y','n'),'y')) == 'y') {
173+
if(strtolower($inst->simple_query('Configure Mail', array('y','n') ,'y') ) == 'y') {
179174

180-
// Configure Postfix
175+
//* Configure Postfix
181176
swriteln('Configuring Postfix');
182177
$inst->configure_postfix();
183178

184-
// Configure PAM
179+
//* Configure PAM
185180
swriteln('Configuring PAM');
186181
$inst->configure_pam();
187182

188-
// Configure courier
183+
//* Configure courier
189184
swriteln('Configuring Courier');
190185
$inst->configure_courier();
191186

192-
// Configure Spamasassin
187+
//* Configure Spamasassin
193188
swriteln('Configuring Spamassassin');
194189
$inst->configure_spamassassin();
195190

196-
// Configure Amavis
191+
//* Configure Amavis
197192
swriteln('Configuring Amavisd');
198193
$inst->configure_amavis();
199194

200-
// Configure Getmail
195+
//* Configure Getmail
201196
swriteln('Configuring Getmail');
202197
$inst->configure_getmail();
203198

@@ -212,42 +207,41 @@
212207
system($conf['dist']["init_scripts"].'/'.$conf['dist']['courier']['courier-pop-ssl'].' restart');
213208
}
214209

215-
if(strtolower($inst->simple_query('Configure FTP Server',array('y','n'),'y')) == 'y') {
216-
// Configure Pureftpd
210+
//** Configure Pureftpd
211+
if(strtolower($inst->simple_query('Configure FTP Server', array('y','n'),'y') ) == 'y') {
217212
swriteln('Configuring Pureftpd');
218213
$inst->configure_pureftpd();
219214
system($conf['dist']["init_scripts"].'/'.$conf['dist']['pureftpd']['init_script'].' restart');
220215
}
221216

217+
//** Configure MyDNS
222218
if(strtolower($inst->simple_query('Configure DNS Server',array('y','n'),'y')) == 'y') {
223-
// Configure MyDNS
224219
swriteln('Configuring MyDNS');
225220
$inst->configure_mydns();
226221
system($conf['dist']["init_scripts"].'/'.$conf['dist']['mydns']['init_script'].' restart');
227222
}
228223

229-
if(strtolower($inst->simple_query('Configure Apache Server',array('y','n'),'y')) == 'y') {
230-
// Configure Apache
224+
//** Configure Apache
225+
if(strtolower($inst->simple_query('Configure Apache Server',array('y','n'),'y')) == 'y') {
231226
swriteln('Configuring Apache');
232227
$inst->configure_apache();
233228
}
234229

230+
//** Configure ISPConfig :-)
235231
if(strtolower($inst->simple_query('Install ISPConfig',array('y','n'),'y')) == 'y') {
236-
// Configure ISPConfig
237232
swriteln('Installing ISPConfig');
238233
$inst->install_ispconfig();
239-
240-
// Configure ISPConfig
234+
235+
//* Configure ISPConfig
241236
swriteln('Installing Crontab');
242237
$inst->install_crontab();
243238
system($conf['dist']["init_scripts"].'/'.$conf['dist']['apache']['init_script'].' restart');
244239
}
245240

246-
247-
}
241+
} //* << $install_mode / 'Standard' or Genius
248242

249243

250-
echo "Installation finished.\n";
244+
echo "Installation completed.\n";
251245

252246

253-
?>
247+
?>

install/options.conf.php

Lines changed: 19 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,24 @@
11
<?php
22

3-
/*
4-
Installation Options
5-
*/
3+
//** TODO: These options need to be in an install script somehow
64

7-
$conf["language"] = "en";
8-
$conf["distname"] = "debian40";
9-
$conf["hostname"] = "server1.example.com"; // Full hostname
10-
$conf["ispconfig_install_dir"] = "/usr/local/ispconfig";
11-
$conf["ispconfig_config_dir"] = "/usr/local/ispconfig";
12-
$conf["server_id"] = 1;
5+
//** Installation Options
136

14-
/*
15-
MySQL Database settings
16-
*/
17-
$conf["mysql"]["host"] = "localhost";
18-
$conf["mysql"]["ip"] = "127.0.0.1";
19-
$conf["mysql"]["port"] = "3306";
20-
$conf["mysql"]["database"] = "dbispconfig";
21-
$conf["mysql"]["admin_user"] = "root";
22-
$conf["mysql"]["admin_password"] = "";
23-
$conf["mysql"]["ispconfig_user"] = "ispconfig";
24-
$conf["mysql"]["ispconfig_password"] = "5sDrewBhk";
7+
$conf['language'] = 'en';
8+
$conf['distname'] = 'debian40';
9+
$conf['hostname'] = 'server1.example.com'; // Full hostname
10+
$conf['ispconfig_install_dir'] = '/usr/local/ispconfig';
11+
$conf['ispconfig_config_dir'] = '/usr/local/ispconfig';
12+
$conf['server_id'] = 1;
2513

26-
?>
14+
//**MySQL Database settings
15+
$conf['mysql']['host'] = 'localhost';
16+
$conf['mysql']['ip'] = '127.0.0.1';
17+
$conf['mysql']['port'] = '3306';
18+
$conf['mysql']['database'] = 'dbispconfig';
19+
$conf['mysql']['admin_user'] = 'root';
20+
$conf['mysql']['admin_password'] = '';
21+
$conf['mysql']['ispconfig_user'] = 'ispconfig';
22+
$conf['mysql']['ispconfig_password'] = '5sDrewBhk';
23+
24+
?>

0 commit comments

Comments
 (0)