You are here

function flag_views_bookmark_update_3 in Flag 6.2

Same name and namespace in other branches
  1. 5 includes/flag.views_bookmark.inc \flag_views_bookmark_update_3()
  2. 6 includes/flag.views_bookmark.inc \flag_views_bookmark_update_3()

File

includes/flag.views_bookmark.inc, line 209
Upgrade code to migrate from Views bookmark to Flag module.

Code

function flag_views_bookmark_update_3() {
  $ret = array();
  switch ($GLOBALS['db_type']) {
    case 'mysql':
    case 'mysqli':
      $result = db_query('SELECT vbid, nid, count(uid) as count FROM {views_bookmark_nodes} GROUP BY vbid, nid');
      while ($row = db_fetch_object($result)) {
        $ret[] = update_sql("INSERT INTO {views_bookmark_node_count} VALUES ({$row->vbid}, {$row->nid}, {$row->count})");
      }
      break;
  }
  return $ret;
}