mirror of
https://github.com/Combodo/iTop.git
synced 2026-05-19 07:12:26 +02:00
Added investigation means: DB dump from the ITopConsultant page, this feature should not rely on mySQL statements that are not allowed in the OVH hosting setup. The feature is 100% new and does not interfere with any existing code. Therefore I would advise to upgrade the official build as quickly as possible.
SVN:code[190]
This commit is contained in:
@@ -207,6 +207,46 @@ function DebugQuery($sConfigFile)
|
||||
$oSet = new CMDBObjectSet($oFlt);
|
||||
echo $oSet; // __toString()
|
||||
}
|
||||
|
||||
function DumpDatabase()
|
||||
{
|
||||
$aData = MetaModel::DBDump();
|
||||
foreach ($aData as $sTable => $aRows)
|
||||
{
|
||||
echo "<h1>".htmlentities($sTable)."</h1>\n";
|
||||
|
||||
if (count($aRows) == 0)
|
||||
{
|
||||
echo "<p>no data</p>\n";
|
||||
}
|
||||
else
|
||||
{
|
||||
echo "<p>".count($aRows)." row(s)</p>\n";
|
||||
// Table header
|
||||
echo "<table border=\"1\">\n";
|
||||
echo "<tr>\n";
|
||||
foreach (reset($aRows) as $key => $value)
|
||||
{
|
||||
echo "<th>".htmlentities($key)."</th>";
|
||||
}
|
||||
echo "</tr>\n";
|
||||
|
||||
// Table body
|
||||
foreach ($aRows as $aRow)
|
||||
{
|
||||
echo "<tr>\n";
|
||||
foreach ($aRow as $key => $value)
|
||||
{
|
||||
echo "<td>".htmlentities($value)."</td>";
|
||||
}
|
||||
echo "</tr>\n";
|
||||
}
|
||||
|
||||
echo "</table>\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////////////
|
||||
// Helper functions
|
||||
/////////////////////////////////////////////////////////////////////////////////////
|
||||
@@ -234,6 +274,7 @@ function printMenu($sConfigFile)
|
||||
echo " <li><a href=\"$sUrl&todo=checkall\">Check business model, DB format and data integrity</a></li>";
|
||||
echo " <li><a href=\"$sUrl&todo=showtables\">Show Tables</a></li>";
|
||||
echo " <li><a href=\"$sUrl&todo=debugquery\">Test an OQL query (debug)</a></li>";
|
||||
echo " <li><a href=\"$sUrl&todo=dumpdb\">Dump database</a></li>";
|
||||
// echo " <li>".htmlentities($sUrl)."&<b>todo=execsql</b>&<b>sql=xxx</b>, to execute a specific sql request</li>";
|
||||
}
|
||||
else
|
||||
@@ -443,6 +484,11 @@ else
|
||||
MetaModel::DBCheckIntegrity($sBaseUrl, "sql");
|
||||
echo "done...</br>\n";
|
||||
break;
|
||||
case "dumpdb":
|
||||
echo "Dump DB data...</br>\n";
|
||||
DumpDatabase();
|
||||
echo "done...</br>\n";
|
||||
break;
|
||||
case "userrightssetup":
|
||||
echo "Setup user rights module (init DB)...</br>\n";
|
||||
UserRights::Setup();
|
||||
|
||||
Reference in New Issue
Block a user