You are here

public function SiteAuditCheckDatabaseRowCount::getResultInfo in Site Audit 8.2

Same name and namespace in other branches
  1. 7 Check/Database/RowCount.php \SiteAuditCheckDatabaseRowCount::getResultInfo()

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

Overrides SiteAuditCheckAbstract::getResultInfo

1 call to SiteAuditCheckDatabaseRowCount::getResultInfo()
SiteAuditCheckDatabaseRowCount::getResultWarn in Check/Database/RowCount.php
Implements \SiteAudit\Check\Abstract\getResultWarn().

File

Check/Database/RowCount.php, line 39
Contains \SiteAudit\Check\Database\RowCount.

Class

SiteAuditCheckDatabaseRowCount
Class SiteAuditCheckDatabaseRowCount.

Code

public function getResultInfo() {
  if (empty($this->registry['rows_by_table'])) {
    return dt('No tables with more than @min_rows rows.', array(
      '@min_rows' => drush_get_option('min_rows', SiteAuditCheckDatabaseRowCount::AUDIT_CHECK_DB_ROW_MIN_DEFAULT),
    ));
  }
  if (drush_get_option('html')) {
    $ret_val = '<table class="table table-condensed">';
    $ret_val .= '<thead><tr><th>Table Name</th><th>Rows</th></tr></thead>';
    $ret_val .= '<tbody>';
    foreach ($this->registry['rows_by_table'] as $table_name => $rows) {
      $ret_val .= '<tr>';
      $ret_val .= '<td>' . $table_name . '</td>';
      $ret_val .= '<td>' . $rows . '</td>';
      $ret_val .= '</tr>';
    }
    $ret_val .= '</tbody>';
    $ret_val .= '</table>';
  }
  else {
    $ret_val = dt('Table Name: Rows') . PHP_EOL;
    if (!drush_get_option('json')) {
      $ret_val .= str_repeat(' ', 4);
    }
    $ret_val .= '----------------';
    foreach ($this->registry['rows_by_table'] as $table_name => $rows) {
      $ret_val .= PHP_EOL;
      if (!drush_get_option('json')) {
        $ret_val .= str_repeat(' ', 4);
      }
      $ret_val .= "{$table_name}: {$rows}";
    }
  }
  return $ret_val;
}