You are here

function recommender_update_7005 in Recommender API 7.4

Replace sql as table.

File

./recommender.install, line 356
Installation file for the Recommender API module. Note: Not compatible with 6.x releases. Please uninstall 6.x releases before installing the D7 release.

Code

function recommender_update_7005() {
  $results = db_query('SELECT id, params FROM {recommender_app}');
  foreach ($results as $row) {
    $params = json_decode($row->params, TRUE);
    if (isset($params['sql'])) {
      $params['table'] = $params['sql'];
      unset($params['sql']);
      db_query('UPDATE {recommender_app} SET params=:params WHERE id=:id', array(
        ':params' => json_encode($params),
        ':id' => $row->id,
      ));
    }
  }
}