function http_response_headers_drush_command in HTTP Response Headers 7
Implements hook_drush_command().
File
- ./
http_response_headers.drush.inc, line 11 - HTTP response headers drush command.
Code
function http_response_headers_drush_command() {
$items = array();
// The 'http-header-add' command.
$items['http-header-add'] = array(
'description' => 'Creates new HTTP header rule',
'arguments' => array(
'machine_name' => 'The machine name rule ID) of the header rule.',
'header' => 'The HTTP header.',
'header_value' => 'Value of the header.',
),
'options' => array(
'description' => array(
'description' => 'Human readable name of the header rule',
'example-value' => 'Global cache header',
),
'pages' => array(
'description' => 'Specific pages to set HTTP headers',
'example-value' => 'admin/*, node/123',
),
'visibility' => array(
'description' => 'Visibility option for page settings. Allowed values are 0 (HTTP_RESPONSE_HEADERS_VISIBILITY_NOTLISTED) and 1 (HTTP_RESPONSE_HEADERS_VISIBILITY_LISTED)',
'example-value' => '0 or 1',
),
'types' => array(
'description' => 'Specific content types(comma separated) t to set HTTP headers.',
'example-value' => 'article, page',
),
'roles' => array(
'description' => 'Specific role IDs(comma separated) to set HTTP headers. Check "drush role-list" for available role IDs',
'example-value' => '1, 2',
),
),
'examples' => array(
'drush http-header-add global_expires "Global expires" Expires 6000 --path=node/* --type=article --role=anonymous' => 'Make a header rule with cache set for 30 seconds on pages under node/ and type article viewed by anonymous user.',
),
'aliases' => array(
'header-add',
),
'bootstrap' => DRUSH_BOOTSTRAP_DRUSH,
);
// The 'http-header-set' command.
$items['http-header-set'] = array(
'description' => 'Modify HTTP header rule',
'arguments' => array(
'machine_name' => 'The machine name (rule ID) of the header rule.',
),
'options' => array(
'visibility' => array(
'description' => 'Visibility option for page settings. Allowed values are 0 (HTTP_RESPONSE_HEADERS_VISIBILITY_NOTLISTED) and 1 (HTTP_RESPONSE_HEADERS_VISIBILITY_LISTED)',
'example-value' => '0 or 1',
),
'pages' => array(
'description' => 'Specific pages to set HTTP headers',
'example-value' => 'admin/*, node/123',
),
'types' => array(
'description' => 'Specific content types to set HTTP headers',
'example-value' => 'article, page',
),
'roles' => array(
'description' => 'Specific roles to set HTTP headers',
'example-value' => 'anonymous, authenticated',
),
),
'examples' => array(
'drush http-header-set global_expires --path=node/* --type=article --role=anonymous' => 'Update the header rule with with path as node/* and article content type viewed by anonymous user.',
),
'aliases' => array(
'header-set',
),
'bootstrap' => DRUSH_BOOTSTRAP_DRUSH,
);
// The 'http-header-get' command.
$items['http-header-get'] = array(
'description' => 'Retrieves HTTP header rule by machine name',
'arguments' => array(
'machine_name' => 'The machine name of the header rule.',
),
'examples' => array(
'drush http-header-get global_expires' => 'Get the header rule with machine name global_expires',
),
'aliases' => array(
'header-get',
),
'bootstrap' => DRUSH_BOOTSTRAP_DRUSH,
);
// The 'http-header-del' command.
$items['http-header-del'] = array(
'description' => 'Delete a HTTP header rule by machine name',
'arguments' => array(
'machine_name' => 'The machine name of the header rule.',
),
'examples' => array(
'drush http-header-del global_expires' => 'Delete the header rule with machine name global_expires',
),
'aliases' => array(
'header-del',
),
'bootstrap' => DRUSH_BOOTSTRAP_DRUSH,
);
// The 'http-header-list' command.
$items['http-header-list'] = array(
'description' => 'Lists all HTTP header rules available',
'examples' => array(
'drush http-header-list' => 'List of all HTTP header rules available.',
),
'aliases' => array(
'header-list',
),
'bootstrap' => DRUSH_BOOTSTRAP_DRUSH,
);
return $items;
}