Deprecated: Assigning the return value of new by reference is deprecated in /home/bluestat/public_html/source/index.php on line 477
Bugdar - Blob - ViewGit - Blue Static
<?php

chdir('./../');
require_once('./global.php');

$comments = $db->query("SELECT * FROM " . TABLE_PREFIX . "comment ORDER BY bugid, dateline ASC");

foreach ($comments as $comment)
{
	if (!isset($replace["$comment[bugid]"]))
	{
		$replace["$comment[bugid]"] = array(
			'initialreport' => $comment['commentid'],
			'dateline' => $comment['dateline'],
			'lastposttime' => $comment['dateline'],
			'lastpostby' => $comment['userid']
		);
	}
	if (!$comment['hidden'] AND !isset($replace["$comment[bugid]"]['hiddenlastposttime']))
	{
		$replace["$comment[bugid]"]['hiddenlastposttime'] = $comment['dateline'];
		$replace["$comment[bugid]"]['hiddenlastpostby'] = $comment['userid'];
	}

	$replace["$comment[bugid]"]['lastposttime'] = $comment['dateline'];
}

foreach ($replace AS $bugid => $newfields)
{
	$db->query("
		UPDATE " . TABLE_PREFIX . "bug
		SET initialreport = $newfields[initialreport],
			dateline = $newfields[dateline],
			lastposttime = $newfields[lastposttime],
			lastpostby = $newfields[lastpostby],
			hiddenlastposttime = $newfields[hiddenlastposttime],
			hiddenlastpostby = $newfields[hiddenlastpostby]
		WHERE bugid = $bugid"
	);
	echo "<p>Updated $bugid</p>";
}

?>