function flag_update_6003 in Flag 6
Same name and namespace in other branches
- 6.2 flag.install \flag_update_6003()
Remove the previous default views that are no longer bundled with Flag.
These views are saved to the database so that they are preserved.
File
- ./
flag.install, line 425 - Flag module install/schema/update hooks.
Code
function flag_update_6003() {
$ret = array();
// Bail out if Views doesn't exist.
if (!function_exists('views_get_view')) {
return $ret;
}
drupal_load('module', 'flag');
$flags = flag_get_flags();
foreach ($flags as $name => $flag) {
if ($view = views_get_view('flags_' . $name)) {
if (!$view->disabled && $view->type == t('Default')) {
$view
->save();
$ret[] = array(
'success' => TRUE,
'query' => t('The view %name as been saved to the database. Flag no longer provides this view by default.', array(
'%name' => $view->name,
)),
);
}
}
}
return $ret;
}