Skip to content
Snippets Groups Projects

Update ClearCacheForm.php

1 file
+ 10
3
Compare changes
  • Side-by-side
  • Inline
@@ -110,20 +110,27 @@ class ClearCacheForm extends FormBase {
// Clear cache by particular tags.
case self::CACHE_CLEAR_TYPE_TAG:
$tags = explode(' ', trim($form_state->getValue('arguments')));
$this->cacheManager->purgeTags($tags);
$result = $this->cacheManager->purgeTags($tags);
break;
// Flush all cache of the site.
case self::CACHE_CLEAR_TYPE_FULL:
$this->cacheManager->flushAllCaches();
$result = $this->cacheManager->flushAllCaches();
break;
// Clear cache by URL.
case self::CACHE_CLEAR_TYPE_URI:
$this->cacheManager->purgeUri($form_state->getValue('arguments'));
$result = $this->cacheManager->purgeUri($form_state->getValue('arguments'));
break;
}
if (empty($result)) {
$this->messenger()->addError($this->t("The site wasn't banned. Please read Database logs by this channel: adv varnish."));
}
else {
$this->messenger()->addStatus($this->t('Site banned.'));
}
}
/**
Loading