function heartbeat_comments_update_410 in Heartbeat 6.4
Update to version 4.10.x
Return value
sql statements array
File
- modules/
heartbeat_comments/ heartbeat_comments.install, line 76 - Installation file for heartbeat comments by Stalski - Menhir - www.menhir.be
Code
function heartbeat_comments_update_410() {
// Due to racing conditions it's possible the update hook in heartbeat.install
// has not ran yet. Check for the 'uaid_comments' field and in case it doesn't
// exists, run heartbeat_update_410 first.
if (!db_column_exists('heartbeat_activity', 'uaid_comments')) {
module_load_include('install', 'heartbeat');
heartbeat_update_410();
}
// Crazy, but hey, who cares :)
$result = db_query("SELECT uaid FROM {heartbeat_activity}");
while ($row = db_fetch_object($result)) {
$count = db_result(db_query("SELECT COUNT(*) FROM {heartbeat_comments} WHERE uaid = %d ", $row->uaid));
$update_q = "UPDATE {heartbeat_activity} set uaid_comments = %d WHERE uaid = %d";
db_query($update_q, $count, $row->uaid);
}
return array();
}