admin_views.install in Administration Views 7
Same filename and directory in other branches
Update scripts for Admin Views.
File
admin_views.installView source
<?php
/**
* @file
* Update scripts for Admin Views.
*/
/**
* Implementations of hook_update_N().
*/
/**
* Remove deprecated views_plugin_access_menu plugin.
*/
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),
));
}
}
}
/**
* Enable the new system display submodule.
*/
function admin_views_update_7101() {
if (module_enable(array(
'admin_views_system_display',
))) {
return t('Enabled the new Admin Views System Display submodule.');
}
else {
throw new DrupalUpdateException('Unable to enable the new Admin Views System Display submodule.');
}
}
/**
* Reset this module's weight.
*/
function admin_views_update_7102() {
db_query("UPDATE {system} SET weight = 0 WHERE name = 'admin_views'");
}
Functions
Name | Description |
---|---|
admin_views_update_7100 | Remove deprecated views_plugin_access_menu plugin. |
admin_views_update_7101 | Enable the new system display submodule. |
admin_views_update_7102 | Reset this module's weight. |