Commit | Line | Data |
---|---|---|
b42b2bf9 H |
1 | <?php |
2 | //requiring main config file with path/database etc. constants | |
3 | require('../config/config.inc'); | |
4 | ||
5 | //connecting to database and creating universal $db object | |
6 | require(SYSTEM_ROOT.'/inc/log.inc'); | |
7 | require(SYSTEM_ROOT.'/inc/database.inc'); | |
8 | $db=new CLASS_DATABASE(); | |
9 | $db_old=new CLASS_DATABASE("kyberia","kyberia","cyb3ry","127.0.0.1"); | |
10 | ||
11 | $userset=$db->query("select old_id,node_id from nodes where node_type='7'"); | |
12 | ||
13 | while ($userset->next()) { | |
14 | $old_id=$userset->getString('old_id'); | |
15 | $user_id=$userset->getString('node_id'); | |
16 | $db->query("update mail set mail_user_new='yes',mail_user='$user_id' where mail_user='$old_id' and mail_user_new='no'"); | |
17 | $db->query("update mail set mail_from_new='yes',mail_from='$user_id' where mail_from='$old_id' and mail_from_new='no'"); | |
18 | $db->query("update mail set mail_to_new='yes',mail_to='$user_id' where mail_to='$old_id' and mail_to_new='no'"); | |
19 | } | |
20 | ||
21 | $db->query("create index uf on mail (mail_user,mail_from)"); | |
22 | $db->query("create index ut on mail (mail_user,mail_to)"); | |
23 | ||
24 | ||
25 | $userset=$db->query("select old_id,node_id from nodes where node_type='7'"); | |
26 | while ($userset->next()) { | |
27 | $old_id=$userset->getString('old_id'); | |
28 | $user_id=$userset->getString('node_id'); | |
29 | $db->query("insert into mail_folders set user_id='$user_id',folder_name='sent'"); | |
30 | $sent_id=$db->getLastInsertId(); | |
31 | $db->query("insert into mail_folders set user_id='$user_id',folder_name='received'"); | |
32 | $received_id=$db->getLastInsertId(); | |
33 | $db->query("insert into mail_folders set user_id='$user_id',folder_name='trash'"); | |
34 | $db->query("update users set folder_id='$sent_id' where mail_user='$user_id' and mail_from='$user_id'"); | |
35 | $db->query("update users set folder_id='$received_id' where mail_user='$user_id' and mail_to'$user_id'"); | |
36 | } | |
37 | ||
38 | ?> |