function activity_update_6100 in Activity 6
A column for the user ID is being added back to make certain things easier to do going forward
File
- ./
activity.install, line 161 - Install file for activity module.
Code
function activity_update_6100() {
$ret = array();
if (!db_column_exists('activity', 'uid')) {
db_add_field($ret, 'activity', 'uid', array(
'type' => 'int',
'not null' => TRUE,
'default' => 0,
));
$activities = db_query('SELECT aid, module, data FROM {activity}');
while ($activity = db_fetch_object($activities)) {
$aid = $activity->aid;
$data = unserialize($activity->data);
$uid = $activity->module == 'user_relationshipsactivity' ? $data['requester-id'] : $data['author-uid'];
db_query('UPDATE {activity} SET uid = %d WHERE aid = %d', $uid, $aid);
}
}
return $ret;
}