contrib modules security updates
This commit is contained in:
@@ -42,10 +42,14 @@ function views_drush_command() {
|
||||
),
|
||||
'bootstrap' => DRUSH_BOOTSTRAP_DRUPAL_FULL,
|
||||
'aliases' => array('vr'),
|
||||
'options' => array(
|
||||
'all' => 'If provided, all views will be reverted.',
|
||||
),
|
||||
'examples' => array(
|
||||
'drush vr archive' => 'Reverts the "archive" view.',
|
||||
'drush rln archive frontpage' => 'Reverts the "archive" and "frontpage" view.',
|
||||
'drush vr' => 'Will present you with a list of overridden views to choose from, and an option to revert all overridden views.',
|
||||
'drush vr --all' => 'Will revert all overridden views.',
|
||||
),
|
||||
);
|
||||
$items['views-dev'] = array(
|
||||
@@ -126,15 +130,21 @@ function views_revert_views() {
|
||||
}
|
||||
}
|
||||
|
||||
// Return early if there are no overridden views in the system.
|
||||
// If there are no overridden views in the system, report it.
|
||||
if (empty($overridden)) {
|
||||
return drush_set_error(dt('There are no overridden views in the system.'));
|
||||
drush_log(dt('There are no overridden views in the system.'), 'ok');
|
||||
}
|
||||
|
||||
// If the user specified in the command the views to be overridden.
|
||||
if (!empty($viewnames)) {
|
||||
// If the user provided the "--all" option, revert all views.
|
||||
if (drush_get_option('all')) {
|
||||
$i = views_revert_allviews($views);
|
||||
}
|
||||
|
||||
// If the user specified a list of views on the CLI, revert those.
|
||||
elseif (!empty($viewnames)) {
|
||||
foreach ($viewnames as $key => $viewname) {
|
||||
$is_overridden = key_exists($viewname, $overridden);
|
||||
|
||||
// Check if the provided view name is in the system
|
||||
if ($viewname && !key_exists($viewname, $views)) {
|
||||
drush_set_error(dt("'@viewname' view is not present in the system.", array('@viewname' => $viewname)));
|
||||
@@ -144,18 +154,22 @@ function views_revert_views() {
|
||||
drush_set_error(dt("The view specified '@viewname' is not overridden.", array('@viewname' => $viewname)));
|
||||
}
|
||||
// If the view is overriden, revert it.
|
||||
elseif ($is_overridden){
|
||||
elseif ($is_overridden) {
|
||||
views_revert_view($views[$viewname]);
|
||||
$i++;
|
||||
}
|
||||
// We should never get here but well...
|
||||
else {
|
||||
drush_set_error(dt("The view specified '@viewname' is not provided in code, and thus cannot be reverted.", array('@viewname' => $viewname)));
|
||||
drush_set_error(dt(
|
||||
"The view specified '@viewname' is not provided in code, and thus cannot be reverted.",
|
||||
array('@viewname' => $viewname)
|
||||
));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// The user did not specify any views in the command, prompt the user
|
||||
// The user neither selected the "--all" option, nor provided a list of views to revert.
|
||||
// Prompt the user.
|
||||
else {
|
||||
// list of choices for the user
|
||||
$overridden['all'] = dt('Revert all overridden views'); // add a choice at the end
|
||||
|
Reference in New Issue
Block a user