r27: Added extra fields to the database so that we don't have to put so much strain...
[bugdar.git] / docs / update_bug_table_cache.php
1 <?php
2
3 chdir('./../');
4 require_once('./global.php');
5
6 $comments = $DB_sql->query("SELECT * FROM comment ORDER BY bugid, dateline ASC");
7
8 while ($comment = $DB_sql->fetch_array($comments))
9 {
10 if (!isset($replace["$comment[bugid]"]))
11 {
12 $replace["$comment[bugid]"] = array('initialreport' => $comment['commentid'], 'dateline' => $comment['dateline'], 'lastposttime' => $comment['dateline'], 'lastpostby' => $comment['userid']);
13 }
14 $replace["$comment[bugid]"]['lastposttime'] = $comment['dateline'];
15 }
16
17 foreach ($replace AS $bugid => $newfields)
18 {
19 $DB_sql->query("UPDATE bug SET initialreport = $newfields[initialreport], dateline = $newfields[dateline], lastposttime = $newfields[lastposttime], lastpostby = $newfields[lastpostby] WHERE bugid = $bugid");
20 echo "<p>Updated $bugid</p>";
21 }
22
23 ?>