]> src.bluestatic.org Git - bugdar.git/blob - docs/update_bug_table_cache.php
Add the login template
[bugdar.git] / docs / update_bug_table_cache.php
1 <?php
2
3 chdir('./../');
4 require_once('./global.php');
5
6 $comments = $db->query("SELECT * FROM " . TABLE_PREFIX . "comment ORDER BY bugid, dateline ASC");
7
8 foreach ($comments as $comment)
9 {
10 if (!isset($replace["$comment[bugid]"]))
11 {
12 $replace["$comment[bugid]"] = array(
13 'initialreport' => $comment['commentid'],
14 'dateline' => $comment['dateline'],
15 'lastposttime' => $comment['dateline'],
16 'lastpostby' => $comment['userid']
17 );
18 }
19 if (!$comment['hidden'] AND !isset($replace["$comment[bugid]"]['hiddenlastposttime']))
20 {
21 $replace["$comment[bugid]"]['hiddenlastposttime'] = $comment['dateline'];
22 $replace["$comment[bugid]"]['hiddenlastpostby'] = $comment['userid'];
23 }
24
25 $replace["$comment[bugid]"]['lastposttime'] = $comment['dateline'];
26 }
27
28 foreach ($replace AS $bugid => $newfields)
29 {
30 $db->query("
31 UPDATE " . TABLE_PREFIX . "bug
32 SET initialreport = $newfields[initialreport],
33 dateline = $newfields[dateline],
34 lastposttime = $newfields[lastposttime],
35 lastpostby = $newfields[lastpostby],
36 hiddenlastposttime = $newfields[hiddenlastposttime],
37 hiddenlastpostby = $newfields[hiddenlastpostby]
38 WHERE bugid = $bugid"
39 );
40 echo "<p>Updated $bugid</p>";
41 }
42
43 ?>