You are here

public function SiteAuditCheckDatabaseFragmentation::getResultWarn in Site Audit 8.2

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

Overrides SiteAuditCheckAbstract::getResultWarn

File

Check/Database/Fragmentation.php, line 46
Contains \SiteAudit\Check\Database\Fragmentation.

Class

SiteAuditCheckDatabaseFragmentation
Class SiteAuditCheckDatabaseFragmentation.

Code

public function getResultWarn() {
  arsort($this->registry['database_fragmentation']);
  if (drush_get_option('html')) {
    $ret_val = '<table class="table table-condensed">';
    $ret_val .= '<thead><tr><th>' . dt('Table Name') . '</th><th>' . dt('Fragmentation Ratio') . '</th></tr></thead>';
    $ret_val .= '<tbody>';
    foreach ($this->registry['database_fragmentation'] as $name => $ratio) {
      $ret_val .= '<tr>';
      $ret_val .= '<td>' . $name . '</td>';
      $ret_val .= '<td>' . $ratio . '</td>';
      $ret_val .= '</tr>';
    }
    $ret_val .= '</tbody>';
    $ret_val .= '</table>';
  }
  else {
    $ret_val = dt('Table Name: Fragmentation Ratio') . PHP_EOL;
    if (!drush_get_option('json')) {
      $ret_val .= str_repeat(' ', 4);
    }
    $ret_val .= '---------------------';
    foreach ($this->registry['database_fragmentation'] as $name => $ratio) {
      $ret_val .= PHP_EOL;
      if (!drush_get_option('json')) {
        $ret_val .= str_repeat(' ', 4);
      }
      $ret_val .= "{$name}: {$ratio}";
    }
  }
  return $ret_val;
}