Commit | Line | Data |
---|---|---|
b42b2bf9 H |
1 | <?php |
2 | //requiring main config file with path/database etc. constants | |
3 | require('../config/config.inc'); | |
4 | error_reporting(0); | |
5 | ||
6 | //connecting to database and creating universal $db object | |
7 | require(SYSTEM_ROOT.'/inc/log.inc'); | |
8 | require(SYSTEM_ROOT.'/inc/database.inc'); | |
9 | require(SYSTEM_ROOT.'/inc/nodes.inc'); | |
10 | $db=new CLASS_DATABASE(); | |
11 | ||
12 | $q="select node_id,node_thread_vector from nodes order by node_id asc"; | |
13 | $set=$db->query($q); | |
14 | while ($set->next()) { | |
15 | unset($new_vector); | |
16 | $node_id=$set->getString('node_id'); | |
17 | $old_vector=$set->getString('node_thread_vector'); | |
18 | $old_vector=ltrim($old_vector,";"); | |
19 | $vector_array=explode(";",$old_vector); | |
20 | foreach($vector_array as $vector_item) { | |
21 | $new_item=str_pad($vector_item,VECTOR_CHARS,"0",STR_PAD_LEFT); | |
22 | $new_vector .= ";".$new_item; | |
23 | } | |
24 | $new_id=str_pad($set->getString('node_id'),VECTOR_CHARS,"0",STR_PAD_LEFT); | |
25 | // echo "AAAA".$new_id."BBBB"; | |
26 | $new_vector=$new_vector.";".$new_id; | |
27 | $q="update nodes set node_vector='$new_vector' where node_id='$node_id'"; | |
28 | echo $q; | |
29 | $db->query($q); | |
30 | } | |
31 | ?> | |
32 |