You are here

public function SiteAuditCheckViewsCacheResults::getAction in Site Audit 8.2

Same name and namespace in other branches
  1. 7 Check/Views/CacheResults.php \SiteAuditCheckViewsCacheResults::getAction()

Implements \SiteAudit\Check\Abstract\getAction().

Overrides SiteAuditCheckAbstract::getAction

File

Check/Views/CacheResults.php, line 59
Contains \SiteAudit\Check\Views\CacheResults.

Class

SiteAuditCheckViewsCacheResults
Class SiteAuditCheckViewsCacheResults.

Code

public function getAction() {
  if (!in_array($this->score, array(
    SiteAuditCheckAbstract::AUDIT_CHECK_SCORE_INFO,
    SiteAuditCheckAbstract::AUDIT_CHECK_SCORE_PASS,
  ))) {
    $ret_val = dt('Query results should be cached for at least 1 minute or use tag caching.');
    if (drush_get_option('detail')) {
      $steps = array(
        dt('Go to /admin/structure/views/'),
        dt('Edit the View in question'),
        dt('Select the Display'),
        dt('Click Advanced'),
        dt('Next to Caching, click to edit.'),
        dt('Caching: (something other than None)'),
      );
      if (drush_get_option('html')) {
        $ret_val .= '<ol><li>' . implode('</li><li>', $steps) . '</li></ol>';
      }
      else {
        foreach ($steps as $step) {
          $ret_val .= PHP_EOL;
          if (!drush_get_option('json')) {
            $ret_val .= str_repeat(' ', 8);
          }
          $ret_val .= '- ' . $step;
        }
      }
    }
    return $ret_val;
  }
}