You are here

varnish.drush.inc in Varnish 6

Same filename and directory in other branches
  1. 7 varnish.drush.inc

This file contains drush integration for the varnish module.

File

varnish.drush.inc
View source
<?php

// $id$

/**
 * @file
 * This file contains drush integration for the varnish module.
 */

/**
 * Implementation of hook_drush_command().
 */
function varnish_drush_command() {
  $items = array();
  $items['varnish-purge-all'] = array(
    'description' => 'Purge all pages in varnish.',
    'drupal dependencies' => array(
      'varnish',
    ),
    'aliases' => array(
      'vpa',
    ),
    'callback' => 'varnish_purge_all_pages',
  );
  $items['varnish-purge'] = array(
    'description' => "Purge a list of URLs in varnish.",
    'arguments' => array(
      'paths' => 'A list of paths to purge separated by spaces. Regular expressions allowed.',
    ),
    'aliases' => array(
      'vp',
    ),
    'drupal dependencies' => array(
      'varnish',
    ),
    'callback' => 'varnish_drush_purge',
  );
  return $items;
}

/**
 * Callback for varnish-purge drush command.
 * @param string $paths a space separated list of paths.
 */
function varnish_drush_purge($paths) {
  $paths = explode(' ', $paths);
  varnish_expire_cache($paths);
}

Functions

Namesort descending Description
varnish_drush_command Implementation of hook_drush_command().
varnish_drush_purge Callback for varnish-purge drush command.