$_REQUEST['real_row_count_all'] ?? null, 'table' => $_REQUEST['table'] ?? null, ]; $this->checkParameters(['db']); $GLOBALS['errorUrl'] = Util::getScriptNameForOption($GLOBALS['cfg']['DefaultTabDatabase'], 'database'); $GLOBALS['errorUrl'] .= Url::getCommon(['db' => $GLOBALS['db']], '&'); if (! $this->hasDatabase() || ! $this->response->isAjax()) { return; } [$tables] = Util::getDbInfo($request, $GLOBALS['db']); // If there is a request to update all table's row count. if (! isset($parameters['real_row_count_all'])) { // Get the real row count for the table. $realRowCount = (int) $this->dbi ->getTable($GLOBALS['db'], (string) $parameters['table']) ->getRealRowCountTable(); // Format the number. $realRowCount = Util::formatNumber($realRowCount, 0); $this->response->addJSON(['real_row_count' => $realRowCount]); return; } // Array to store the results. $realRowCountAll = []; // Iterate over each table and fetch real row count. foreach ($tables as $table) { $rowCount = $this->dbi ->getTable($GLOBALS['db'], $table['TABLE_NAME']) ->getRealRowCountTable(); $realRowCountAll[] = ['table' => $table['TABLE_NAME'], 'row_count' => $rowCount]; } $this->response->addJSON(['real_row_count_all' => json_encode($realRowCountAll)]); } }