You are here

function acquia_lift_update_7011 in Acquia Lift Connector 7.2

Same name and namespace in other branches
  1. 7 acquia_lift.install \acquia_lift_update_7011()

Update goals to the visitor actions machine name specification.

File

./acquia_lift.install, line 528
Acquia Lift - Installation file.

Code

function acquia_lift_update_7011() {
  $result = db_select('personalize_campaign_goals', 'g')
    ->fields('g', array(
    'id',
    'action',
  ))
    ->execute();
  foreach ($result as $row) {
    $updated = str_replace('-', '_', $row->action);
    if ($updated == $row->action) {
      continue;
    }
    db_update('personalize_campaign_goals')
      ->condition('id', $row->id)
      ->fields(array(
      'action' => $updated,
    ))
      ->execute();
    db_update('visitor_actions_actions')
      ->condition('machine_name', $row->action)
      ->fields(array(
      'machine_name' => $updated,
    ))
      ->execute();
  }
}