Location: PHPKode > projects > HypatiaDB > hypatiadb/xhr/doMaintenanceAction.php
<?php
include('../common_db.php');
include('../functions.php');
dbconnect($host, $username, $password);

$strings = loadStrings($lang, 'MAINT');

header("Content-Type: application/xml");

if(isset($_REQUEST['action'])) {
	include('../includes/maint.php');
	switch($_REQUEST['action']) {
		case 'opt':
			$result = optimise_table($_REQUEST['db'], $_REQUEST['tbl']);
			if(is_string($result)) {
				$out = '<tr><td colspan="5">' . sprintf($strings['MAINT_OPTIMISEFAILED'], $result) . '</td></tr>';
			} else {
				$out = '<tr><td colspan="5">' . sprintf($strings['MAINT_OPTIMISERESULTS'], "$_REQUEST[db].$_REQUEST[tbl]") . '</td></tr>';
				while($row=mysql_fetch_array($result)) {
					$out .= "<tr><td>$row[Msg_type]</td><td>$row[Msg_text]</td></tr>";
				}
			}
		break;
		case 'an':
			$result = analyse_table($_REQUEST['db'], $_REQUEST['tbl']);
			if(is_string($result)) {
				$out = '<tr><td colspan="5">' . sprintf($strings['MAINT_ANALYSEFAILED'], $result) . '</td></tr>';
			} else {
				$out = '<tr><td colspan="5">' . sprintf($strings['MAINT_ANALYSERESULTS'], "$_REQUEST[db].$_REQUEST[tbl]") . '</td></tr>';
				while($row=mysql_fetch_array($result)) {
					$out .= "<tr><td>$row[Msg_type]</td><td>$row[Msg_text]</td></tr>";
				}
			}
		break;
		case 'check':
			$result = check_table($_REQUEST['db'], $_REQUEST['tbl']);
			if(is_string($result)) {
				$out = '<tr><td colspan="5">' . sprintf($strings['MAINT_CHECKFAILED'], $result) . '</td></tr>';
			} else {
				$out = '<tr><td colspan="5">' . sprintf($strings['MAINT_CHECKRESULTS'], "$_REQUEST[db].$_REQUEST[tbl]") . '</td></tr>';
				while($row=mysql_fetch_array($result)) {
					$out .= "<tr><td>$row[Msg_type]</td><td>$row[Msg_text]</td></tr>";
				}
			}
		break;
		case 'repair':
			$result = repair_table($_REQUEST['db'], $_REQUEST['tbl']);
			if(is_string($result)) {
				$out = '<tr><td colspan="5">' . sprintf($strings['MAINT_REPAIRFAILED'], $result) . '</td></tr>';
			} else {
				$out = '<tr><td colspan="5">' . sprintf($strings['MAINT_REPAIRRESULTS'], "$_REQUEST[db].$_REQUEST[tbl]") . '</td></tr>';
				while($row=mysql_fetch_array($result)) {
					$out .= "<tr><td>$row[Msg_type]</td><td>$row[Msg_text]</td></tr>";
				}
			}
		break;
	}
}

echo("<root>$out</root>");

?>
Return current item: HypatiaDB