Alternc
3.2
Alternc logiel libre pour l'hébergement
Main Page
Related Pages
Data Structures
Files
File List
Globals
All
Data Structures
Namespaces
Files
Functions
Variables
Pages
3.0.0~3.php
Go to the documentation of this file.
1
#!/usr/bin/php
2
<?php
3
4
// We check that mysql php module is loaded
5
if
(!function_exists(
'mysql_connect'
)) {
6
if
(!dl(
"mysql.so"
))
7
exit
(1);
8
}
9
10
// If we upgrade directly to 3.1 the panel directory change
11
$panel
=
''
;
12
if
(chdir(
"/usr/share/alternc/panel"
))
$panel
=
'/usr/share/alternc/panel'
;
13
elseif (chdir(
"/var/alternc/bureau"
))
$panel
='/var/alternc/bureau';
14
15
if
(empty(
$panel
)) { echo
"Problem to load panel library"
;
exit
(1); }
16
17
require(
"$panel/class/config_nochk.php"
);
18
19
$db2
=
new
DB_System();
20
// we go super-admin
21
$admin->enabled=1;
22
23
$db
->query(
"SELECT * FROM sub_domaines WHERE type='webmail'"
);
24
if
(
$db
->num_rows()) {
25
echo
"################################################################################\n"
;
26
echo
"WARNING: You have WEBMAIL domain-types, you need to install alternc-squirrelmail or alternc-roundcube\n"
;
27
echo
"to be able to use them again. those subdomains will be broken until you do that\n"
;
28
echo
"Also, a script converts your procmail-builder filters to the new SIEVE protocol.\n"
;
29
echo
"This script is in /usr/lib/alternc/procmail_to_sieve.php once to migrate\n"
;
30
echo
"PRESS ENTER TO CONTINUE\n"
;
31
echo
"################################################################################\n"
;
32
}
33
34
//updating db and dbusers tables
35
36
$db
->query(
"Alter table dbusers add column password varchar(32);"
);
37
$db
->query(
"Alter table dbusers add column enable enum('ACTIVATED','HIDDEN','ADMIN') not NULL default 'ACTIVATED';"
);
38
$db
->query(
"Alter table db add column id bigint(20) unsigned NOT NULL AUTO INCREMENT primary key;"
);
39
40
41
$db
->query(
"select distinct uid,login,pass from db;"
);
42
//on insere dans dbusers avec enabled = admin
43
$query
=array();
44
while
(
$db
->next_record()){
45
$db2
->query(
"select id from dbusers where name ='"
.
$db
->f(
'login'
).
"' and password='"
.
$db
->f(
'pass'
).
"';"
);
46
if
(
$db2
->num_rows() ==0 ){
47
$query
[]=
"insert ignore into dbusers values('',"
.$db->f(
'uid'
).
",'"
.
$db
->f(
'login'
).
"','"
.
$db
->f(
'pass'
).
"',\"ADMIN\");"
;
48
}
49
}
50
51
foreach
(
$query
as
$q
){
52
$db
->query($q);
53
}
54
55
//Updating mysql.db table to fix the "_" wildcard bug
56
57
$db
->query(
"select Db from mysql.db ;"
);
58
$query2
=array();
59
while
(
$db
->next_record()){
60
$dbn=preg_replace(
"/^([A-Za-z0-9]*)_([A-Za-z0-9]*)/"
,
"$1\_$2"
,
$db
->f(
'Db'
));
61
$query2
[]=
"update mysql.db set Db=replace(Db,'"
.$db->f(
'Db'
).
"','"
.$dbn.
"');"
;
62
}
63
64
foreach
($query2 as $q2){
65
$db
->query($q2);
66
}
67
?>
68
//done ? :)
code
alternc
install
upgrades
3.0.0~3.php
Generated on Mon Mar 24 2014 17:14:20 for Alternc by
1.8.1.2