Jeste jednou trasovani
[mirrors/Kyberia-bloodline.git] / scripts / descendantcounter.php
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
11 $set=$db->query("select node_thread_vector,node_id from nodes");
12 while ($set->next()) {
13 unset($pocet);
14 $ancestor=$set->getString('node_id');
15 $vector=$set->getString('node_thread_vector');
16 $countset=$db->query("select count(*) as pocet from nodes where node_thread_vector like '$vector;$ancestor'");
17 $countset->next(); $pocet=$countset->getString('pocet');
18 $countset=$db->query("select count(*) as pocet from nodes where node_thread_vector like '$vector;$ancestor;%'");
19 $countset->next(); $pocet+=$countset->getString('pocet');
20 $db->query("update nodes set node_descendant_count='$pocet' where node_id='$ancestor'");
21 }
22
23 ?>
24
This page took 0.38153 seconds and 4 git commands to generate.