You are here

public function SiteAuditCheckViewsCacheOutput::getAction in Site Audit 7

Same name and namespace in other branches
  1. 8.2 Check/Views/CacheOutput.php \SiteAuditCheckViewsCacheOutput::getAction()

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

Overrides SiteAuditCheckAbstract::getAction

File

Check/Views/CacheOutput.php, line 62
Contains \SiteAudit\Check\Views\CacheOutput.

Class

SiteAuditCheckViewsCacheOutput
Class SiteAuditCheckViewsCacheOutput.

Code

public function getAction() {
  if (!in_array($this->score, array(
    SiteAuditCheckAbstract::AUDIT_CHECK_SCORE_INFO,
    SiteAuditCheckAbstract::AUDIT_CHECK_SCORE_PASS,
  ))) {
    $ret_val = dt('Rendered output should be cached for as long as possible (if the query changes, the output will be refreshed).');
    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('Rendered output: (something other than Never cache)'),
      );
      if (drush_get_option('html') == TRUE) {
        $ret_val .= '<ol><li>' . implode('</li><li>', $steps) . '</li></ol>';
      }
      elseif (drush_get_option('json')) {
        $ret_val = array(
          'Summary' => $ret_val,
          'Steps' => $steps,
        );
      }
      else {
        foreach ($steps as $step) {
          $ret_val .= PHP_EOL;
          $ret_val .= str_repeat(' ', 8);
          $ret_val .= '- ' . $step;
        }
      }
    }
    return $ret_val;
  }
}