You are here

function varnish_menu in Varnish 6

Same name and namespace in other branches
  1. 5 varnish.module \varnish_menu()
  2. 7 varnish.module \varnish_menu()

Implementation of hook_menu()

Set up admin settings callbacks, etc.

File

./varnish.module, line 25
varnish.module Provide drupal hooks for integration with the Varnish control layer.

Code

function varnish_menu() {
  $items = array();
  $items['admin/settings/varnish'] = array(
    'title' => 'Varnish settings',
    'description' => 'Configure your varnish integration.',
    'page callback' => 'drupal_get_form',
    'page arguments' => array(
      'varnish_admin_settings_form',
    ),
    'access arguments' => array(
      'administer varnish',
    ),
    'file' => 'varnish.admin.inc',
  );
  $items['admin/settings/varnish/general'] = array(
    'title' => 'General',
    'description' => 'Configure Varnish servers and cache invalidation settings',
    'type' => MENU_DEFAULT_LOCAL_TASK,
    'weight' => -5,
  );

  // Varnish 3 has removed the stats command from the terminal, so
  // we can't provide this functionality for varnish 3 users
  // currently.
  if (floatval(variable_get('varnish_version', 2.1)) < 3) {
    $items['admin/reports/varnish'] = array(
      'title' => 'Varnish status',
      'description' => 'Get the output of varnishstat.',
      'page callback' => 'varnish_admin_reports_page',
      'access arguments' => array(
        'administer varnish',
      ),
      'file' => 'varnish.admin.inc',
    );
  }
  return $items;
}