You are here

function drush_acquia_purge_ap_purge in Acquia Purge 7

Same name and namespace in other branches
  1. 6 acquia_purge.drush.inc \drush_acquia_purge_ap_purge()

Purge a specified path from your balancers.

Parameters

string $paths: The Drupal path to be purged, e.g.: "news" or "<front>", multiple separated paths are also accepted: "news contact node/1".

File

./acquia_purge.drush.inc, line 204
Drush integration providing common maintenance tasks.

Code

function drush_acquia_purge_ap_purge($paths = NULL) {
  $service = _acquia_purge_service();

  // Stop invocation if we are not detecting Acquia Cloud heuristics.
  if (!$service
    ->hostingInfo()
    ->isThisAcquiaCloud()) {
    return drush_set_error("You must be on Acquia Cloud to use Acquia Purge.");
  }

  // Stop invocation if serious error conditions have been found.
  if ($service
    ->diagnostics()
    ->isSystemBlocked()) {
    return drush_acquia_purge_ap_diagnosis(ACQUIA_PURGE_SEVLEVEL_ERROR);
  }

  // The input may be space separated, split out and validate each path.
  $paths = explode(' ', $paths);
  foreach ($paths as $path) {
    if ($msg = _acquia_purge_input_validate($path)) {
      drush_print($path);
      return drush_set_error($msg);
    }
  }

  // Improve the administrative experience by automatically adding variations
  // on the given paths, which includes trailing slash versions and pagination.
  if (_acquia_purge_variable('acquia_purge_variations')) {
    _acquia_purge_input_path_variations($paths);
  }

  // Add all paths and dispatch processing to ap-process.
  $service
    ->addPaths($paths);
  drush_acquia_purge_ap_process();
}