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 | require(SYSTEM_ROOT.'/inc/nodes.inc'); | |
9 | $db=new CLASS_DATABASE(); | |
10 | $db_old=new CLASS_DATABASE("kyberia","kyberia","cyb3ry","127.0.0.1"); | |
11 | ||
12 | $q="select * from nodes where node_type='7'"; | |
13 | $userset=$db->query($q); | |
14 | while ($userset->next()) { | |
15 | $users[$userset->getString('old_id')]=$userset->getString('node_id'); | |
16 | } | |
17 | ||
18 | $q="select * from nodes where node_type='3'"; | |
19 | $forumset=$db->query($q); | |
20 | while ($forumset->next()) { | |
21 | $forums[$forumset->getString('old_id')]=$forumset->getString('node_id'); | |
22 | } | |
23 | ||
24 | $q="select * from nodes where node_type='10'"; | |
25 | $bookcatset=$db->query($q); | |
26 | while ($bookcatset->next()) { | |
27 | $bookcats[$bookcatset->getString('node_creator')][$bookcatset->getString('old_id')]=$bookcatset->getString('node_id'); | |
28 | } | |
29 | ||
30 | ||
31 | ||
32 | foreach ($forums as $forum_old => $forum_new) { | |
33 | $q="select user_forum.*,node_access.*,user_forum.user_id as user_id from user_forum left join node_access on (node_access.node_id=user_forum.forum_id and node_access.user_id=user_forum.user_id) where forum_id='$forum_old'"; | |
34 | echo $q; | |
35 | $set=$db_old->query($q); | |
36 | ||
37 | while ($set->next()) { | |
38 | $user_id=$users[$set->getString('user_id')]; | |
39 | $q="insert into node_access set | |
40 | node_id='$forum_new',user_id='$user_id',node_bookmark='".$set->getString('user_bookmark')."' | |
41 | ,node_permission='".$set->getString('access_type')."', | |
42 | bookmark_category='".($bookcats[$user_id][$set->getString('parent_id')])."', | |
43 | node_user_subchild_count='".$set->getString('submission_count')."', | |
44 | last_visit='".$set->getString('last_visit')."'"; | |
45 | ||
46 | if ($forum_new>0 AND $user_id>0) $db->query($q); | |
47 | ||
48 | } | |
49 | echo "forum $forum_new flushed<br>"; | |
50 | ||
51 | } | |
52 | ||
53 | ||
54 | ?> |