|
28 | 28 | EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
29 | 29 | */ |
30 | 30 |
|
31 | | -/* |
32 | | - ISPConfig 3 installer. |
33 | | -*/ |
| 31 | + |
| 32 | +//** ISPConfig 3 installer. |
34 | 33 |
|
35 | 34 |
|
36 | | -// Include the library with the basic installer functions |
| 35 | +//** Include the library with the basic installer functions |
37 | 36 | require_once('lib/install.lib.php'); |
38 | 37 |
|
39 | | -// Include the base class of the installer class |
| 38 | +//** Include the base class of the installer class |
40 | 39 | require_once('lib/installer_base.lib.php'); |
41 | 40 |
|
42 | | -//** Install logfile |
| 41 | +//** Installer/updater logfile |
43 | 42 | define('ISPC_LOG_FILE', '/var/log/ispconfig_install.log'); |
44 | 43 |
|
45 | 44 | //** Get distribution identifier |
|
49 | 48 | $conf_old = $conf; |
50 | 49 | unset($conf); |
51 | 50 |
|
52 | | -// Include the distribution specific installer class library |
53 | | -// and configuration |
| 51 | +//** Include the distribution specific installer class library and configuration |
54 | 52 | include_once('dist/lib/'.$distname.'.lib.php'); |
55 | 53 | include_once('dist/conf/'.$distname.'.conf.php'); |
56 | 54 |
|
57 | | -// Set the mysql login information |
| 55 | +//** Set the mysql login information |
58 | 56 | $conf["mysql"]["host"] = $conf_old["db_host"]; |
59 | 57 | $conf["mysql"]["database"] = $conf_old["db_database"]; |
60 | 58 | $conf["mysql"]["ispconfig_user"] = $conf_old["db_user"]; |
61 | 59 | $conf["mysql"]["ispconfig_password"] = $conf_old["db_password"]; |
62 | 60 |
|
63 | 61 | $inst = new installer(); |
64 | 62 |
|
65 | | - |
66 | 63 | echo "This application will update ISPConfig 3 on your server.\n"; |
67 | 64 |
|
68 | | -// $conf["language"] = $inst->request_language(); |
69 | | - |
70 | | -// TODO: all other queries, for testing I will setup everything in $conf |
| 65 | +//** TODO: all other queries, for testing I will setup everything in $conf |
71 | 66 |
|
72 | | -// Initialize the MySQL server connection |
| 67 | +//** Initialize the MySQL server connection |
73 | 68 | include_once('lib/mysql.lib.php'); |
74 | 69 |
|
75 | | -// Database update is a bit brute force and should be rebuild later ;) |
| 70 | +//** Database update is a bit brute force and should be rebuild later ;) |
76 | 71 |
|
77 | | -// export the current database data |
| 72 | +//** Ask user for mysql admin_password if empty |
78 | 73 | if( empty($conf["mysql"]["admin_password"]) ) { |
79 | 74 |
|
80 | 75 | $conf["mysql"]["admin_password"] = $inst->free_query('MySQL root password', $conf['mysql']['admin_password']); |
81 | 76 | } |
82 | 77 |
|
| 78 | +//** export the current database data |
83 | 79 | if( !empty($conf["mysql"]["admin_password"]) ) { |
84 | 80 |
|
85 | 81 | system("mysqldump -h ".$conf['mysql']['host']." -u ".$conf['mysql']['admin_user']." -p".$conf['mysql']['admin_password']." -c -t --add-drop-table --all --quick ".$conf['mysql']['database']." > existing_db.sql"); |
|
89 | 85 | system("mysqldump -h ".$conf['mysql']['host']." -u ".$conf['mysql']['admin_user']." -c -t --add-drop-table --all --quick ".$conf['mysql']['database']." > existing_db.sql"); |
90 | 86 | } |
91 | 87 |
|
92 | | -// Delete the old database |
| 88 | +//** Delete the old database |
93 | 89 | $inst->db = new db(); |
94 | 90 |
|
95 | 91 | if( !$inst->db->query('DROP DATABASE IF EXISTS '.$conf['mysql']['database']) ) { |
96 | 92 |
|
97 | 93 | $inst->error('Unable to drop MySQL database: '.$conf['mysql']['database'].'.'); |
98 | 94 | } |
99 | 95 |
|
100 | | - |
101 | | -/*exec("/etc/init.d/mysql stop"); |
102 | | -sleep(3); |
103 | | -if($conf["mysql"]["database"] != '') exec("rm -rf /var/lib/mysql/".$conf["mysql"]["database"]); |
104 | | -exec("/etc/init.d/mysql start"); |
105 | | -sleep(5);*/ |
106 | | - |
107 | | -// Create the mysql database |
| 96 | +//** Create the mysql database |
108 | 97 | $inst->configure_database(); |
109 | 98 |
|
110 | | -// empty all databases |
| 99 | +//** empty all databases |
111 | 100 | $db_tables = $inst->db->getTables(); |
| 101 | + |
112 | 102 | foreach($db_tables as $table) { |
| 103 | + |
113 | 104 | $inst->db->query("TRUNCATE $table"); |
114 | 105 | } |
115 | 106 |
|
116 | | -// load old data back into database |
117 | | -if($conf["mysql"]["admin_password"] != '') { |
| 107 | +//** load old data back into database |
| 108 | +if( !empty($conf["mysql"]["admin_password"]) ) { |
| 109 | + |
118 | 110 | system("mysql -h ".$conf['mysql']['host']." -u ".$conf['mysql']['admin_user']." -p".$conf['mysql']['admin_password']." ".$conf['mysql']['database']." < existing_db.sql"); |
119 | 111 | } else { |
| 112 | + |
120 | 113 | system("mysql -h ".$conf['mysql']['host']." -u ".$conf['mysql']['admin_user']." ".$conf['mysql']['database']." < existing_db.sql"); |
121 | 114 | } |
122 | | -// Configure postfix |
| 115 | + |
| 116 | +//** Configure postfix |
123 | 117 | $inst->configure_postfix('dont-create-certs'); |
124 | 118 |
|
125 | | -// Configure saslauthd |
| 119 | +//** Configure saslauthd |
126 | 120 | swriteln('Configuring SASL'); |
127 | 121 | $inst->configure_saslauthd(); |
128 | 122 |
|
129 | | - |
130 | | -// Configure PAM |
| 123 | +//** Configure PAM |
131 | 124 | swriteln('Configuring PAM'); |
132 | 125 | $inst->configure_pam(); |
133 | 126 |
|
134 | | -// Configure courier |
| 127 | +//** Configure courier |
135 | 128 | swriteln('Configuring Courier'); |
136 | 129 | $inst->configure_courier(); |
137 | 130 |
|
138 | | -// Configure Spamasassin |
| 131 | +//** Configure Spamasassin |
139 | 132 | swriteln('Configuring Spamassassin'); |
140 | 133 | $inst->configure_spamassassin(); |
141 | 134 |
|
142 | | -// Configure Amavis |
| 135 | +//** Configure Amavis |
143 | 136 | swriteln('Configuring Amavisd'); |
144 | 137 | $inst->configure_amavis(); |
145 | 138 |
|
146 | | -// Configure Getmail |
| 139 | +//** Configure Getmail |
147 | 140 | swriteln('Configuring Getmail'); |
148 | 141 | $inst->configure_getmail(); |
149 | 142 |
|
150 | | -// Configure Pureftpd |
| 143 | +//** Configure Pureftpd |
151 | 144 | swriteln('Configuring Pureftpd'); |
152 | 145 | $inst->configure_pureftpd(); |
153 | 146 |
|
154 | | -// Configure MyDNS |
| 147 | +//** Configure MyDNS |
155 | 148 | swriteln('Configuring MyDNS'); |
156 | 149 | $inst->configure_mydns(); |
157 | 150 |
|
158 | | -// Configure Apache |
| 151 | +//** Configure Apache |
159 | 152 | swriteln('Configuring Apache'); |
160 | 153 | $inst->configure_apache(); |
161 | 154 |
|
162 | | -// Configure ISPConfig |
| 155 | +//** Configure ISPConfig |
163 | 156 | swriteln('Installing ISPConfig'); |
164 | 157 | $inst->install_ispconfig(); |
165 | 158 |
|
166 | | -// Configure ISPConfig |
| 159 | +//** Configure ISPConfig |
167 | 160 | swriteln('Installing Crontab'); |
168 | 161 | $inst->install_crontab(); |
169 | 162 |
|
170 | | - |
171 | | -/* |
172 | | -Restart services: |
173 | | -*/ |
174 | | - |
| 163 | +//** Restart services: |
175 | 164 | swriteln('Restarting services ...'); |
176 | 165 | system("/etc/init.d/mysql restart"); |
177 | 166 | system("/etc/init.d/postfix restart"); |
|
189 | 178 |
|
190 | 179 | echo "Update finished.\n"; |
191 | 180 |
|
192 | | - |
193 | 181 | ?> |
0 commit comments