• Модуль: main
  • Путь к файлу: ~/bitrix/modules/main/classes/general/site_checker.php
  • Класс: CSiteCheckerTest
  • Вызов: CSiteCheckerTest::check_mysql_table_status
function check_mysql_table_status()
{
	global $DB;
	$time = time();

	$strError = '';
	$i = 0;
	$res = $DB->Query('SHOW TABLES');
	$cnt = $res->SelectedRowsCount();
	while($f = $res->Fetch())
	{
		$i++;
		$table = current($f);

		if ($this->arTestVars['last_value'])
		{
			if ($this->arTestVars['last_value'] == $table)
				unset($this->arTestVars['last_value']);
			continue;
		}

//			if ($f0['Data_length'] > $warn_size)
//				$result.= $this->Result(null,GetMessage('SC_TABLE_SIZE_WARN',array('#TABLE#'=>$table,'#SIZE#'=>floor($f0['Data_length']/1024/1024))))."
"; if (!$this->fix_mode) $res0 = $DB->Query('CHECK TABLE ' . $DB->quote($table)); else $res0 = $DB->Query('REPAIR TABLE ' . $DB->quote($table)); $f0 = $res0->Fetch(); if ($f0['Msg_type'] == 'error' || $f0['Msg_type'] == 'warning') $strError .= GetMessage('SC_TABLE_ERR', array('#VAL#' => $table)) . ' ' . $f0['Msg_text'] . "n
"; if (time()-$time >= $this->timeout) { $this->arTestVars['last_value'] = $table; $this->test_percent = floor($i / $cnt * 100); return true; } } if (!$strError) return true; if (!$this->fix_mode) { $this->arTestVars['check_table_status_fail'] = true; echo $strError; // to log return $this->Result(false, GetMessage('SC_TABLES_NEED_REPAIR').fix_link(1)); } return $this->Result(false, $strError); }