You are here

function admin_views_update_7100 in Administration Views 7

Remove deprecated views_plugin_access_menu plugin.

File

./admin_views.install, line 15
Update scripts for Admin Views.

Code

function admin_views_update_7100() {
  $result = db_query("SELECT vid, id, display_options FROM {views_display}");
  foreach ($result as $record) {
    $options = unserialize($record->display_options);
    if (isset($options['access']) && is_array($options['access']) && isset($options['access']['type']) && $options['access']['type'] === 'menu') {
      $options['access'] = array(
        'type' => 'perm',
        'perm' => 'access administration pages',
      );
      db_query("UPDATE {views_display} SET display_options = :options WHERE vid = :vid AND id = :id", array(
        'vid' => $record->vid,
        'id' => $record->id,
        'options' => serialize($options),
      ));
    }
  }
}