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