ITopConsultant.php 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566
  1. <?php
  2. // Copyright (C) 2010 Combodo SARL
  3. //
  4. // This program is free software; you can redistribute it and/or modify
  5. // it under the terms of the GNU General Public License as published by
  6. // the Free Software Foundation; version 3 of the License.
  7. //
  8. // This program is distributed in the hope that it will be useful,
  9. // but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  11. // GNU General Public License for more details.
  12. //
  13. // You should have received a copy of the GNU General Public License
  14. // along with this program; if not, write to the Free Software
  15. // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
  16. /**
  17. * ITop consultant home page
  18. * tool box
  19. * object model analysis
  20. * DB integrity check and repair
  21. *
  22. * @author Erwan Taloc <erwan.taloc@combodo.com>
  23. * @author Romain Quetiez <romain.quetiez@combodo.com>
  24. * @author Denis Flaven <denis.flaven@combodo.com>
  25. * @license http://www.opensource.org/licenses/gpl-3.0.html LGPL
  26. */
  27. function sexyclass($sClass, $sBaseArgs)
  28. {
  29. return "Class <a href=\"?$sBaseArgs&todo=showclass&class=$sClass\">$sClass</a>";
  30. }
  31. function sexyclasslist($aClasses, $sBaseArgs)
  32. {
  33. if (count($aClasses) == 0) return "";
  34. $aRes = array();
  35. foreach($aClasses as $sClass)
  36. {
  37. $aRes[] = sexyclass($sClass, $sBaseArgs);
  38. }
  39. return ("'".implode("', '", $aRes)."'");
  40. }
  41. function ShowClass($sClass, $sBaseArgs)
  42. {
  43. if (!MetaModel::IsValidClass($sClass))
  44. {
  45. echo "Invalid class, expecting a value in {".sexyclasslist(MetaModel::GetClasses(), $sBaseArgs)."}<br/>\n";
  46. return;
  47. }
  48. // en recursif jusque "": MetaModel::GetParentPersistentClass($sClass)
  49. $aProps["Root class"] = MetaModel::GetRootClass($sClass);
  50. $aProps["Parent classes"] = sexyclasslist(MetaModel::EnumParentClasses($sClass), $sBaseArgs);
  51. $aProps["Child classes"] = sexyclasslist(MetaModel::EnumChildClasses($sClass), $sBaseArgs);
  52. $aProps["Subclasses (children + pure PHP)"] = sexyclasslist(MetaModel::GetSubclasses($sClass), $sBaseArgs);
  53. $aProps["Description"] = MetaModel::GetClassDescription($sClass);
  54. $aProps["Autoincrement id?"] = MetaModel::IsAutoIncrementKey($sClass);
  55. $aProps["Key label"] = MetaModel::GetKeyLabel($sClass);
  56. $aProps["Name attribute"] = MetaModel::GetNameAttributeCode($sClass);
  57. $aProps["Reconciliation keys"] = implode(", ", MetaModel::GetReconcKeys($sClass));
  58. $aProps["DB key column"] = MetaModel::DBGetKey($sClass);
  59. $aProps["DB class column"] = MetaModel::DBGetClassField($sClass);
  60. $aProps["Is standalone?"] = MetaModel::IsStandaloneClass($sClass);
  61. foreach (MetaModel::ListAttributeDefs($sClass) as $oAttDef)
  62. {
  63. $aAttProps = array();
  64. $aAttProps["Direct field"] = $oAttDef->IsDirectField();
  65. $aAttProps["External key"] = $oAttDef->IsExternalKey();
  66. $aAttProps["External field"] = $oAttDef->IsExternalField();
  67. $aAttProps["Link set"] = $oAttDef->IsLinkSet();
  68. $aAttProps["Code"] = $oAttDef->GetCode();
  69. $aAttProps["Label"] = $oAttDef->GetLabel();
  70. $aAttProps["Description"] = $oAttDef->GetDescription();
  71. $oValDef = $oAttDef->GetValuesDef();
  72. if (is_object($oValDef))
  73. {
  74. //$aAttProps["Allowed values"] = $oValDef->Describe();
  75. $aAttProps["Allowed values"] = "... object of class ".get_class($oValDef);
  76. }
  77. else
  78. {
  79. $aAttProps["Allowed values"] = "";
  80. }
  81. // MetaModel::IsAttributeInZList($sClass, $sListCode, $sAttCodeOrFltCode)
  82. }
  83. // $aProps["Description"] = MetaModel::DBGetTable($sClass, $sAttCode = null)
  84. $aAttributes = array();
  85. foreach (MetaModel::GetClassFilterDefs($sClass) as $oFilterDef)
  86. {
  87. $aAttProps = array();
  88. $aAttProps["Label"] = $oFilterDef->GetLabel();
  89. $aOpDescs = array();
  90. foreach ($oFilterDef->GetOperators() as $sOpCode => $sOpDescription)
  91. {
  92. $sIsTheLooser = ($sOpCode == $oFilterDef->GetLooseOperator()) ? " (loose search)" : "";
  93. $aOpDescs[] = "$sOpCode ($sOpDescription)$sIsTheLooser";
  94. }
  95. $aAttProps["Operators"] = implode(" / ", $aOpDescs);
  96. $aAttributes[] = $aAttProps;
  97. }
  98. $aProps["Filters"] = MyHelpers::make_table_from_assoc_array($aAttributes);
  99. foreach ($aProps as $sKey => $sDesc)
  100. {
  101. echo "<h4>$sKey</h4>\n";
  102. echo "<p>$sDesc</p>\n";
  103. }
  104. }
  105. function ShowBizModel($sBaseArgs)
  106. {
  107. echo "<ul>\n";
  108. foreach(MetaModel::GetClasses() as $sClass)
  109. {
  110. echo "<li>".sexyclass($sClass, $sBaseArgs)."</li>\n";
  111. }
  112. echo "</ul>\n";
  113. }
  114. function ShowZLists($sBaseArgs)
  115. {
  116. $aData = array();
  117. // 1 row per class, header made after the first row keys
  118. //
  119. foreach(MetaModel::GetClasses() as $sClass)
  120. {
  121. $aRow = array();
  122. $aRow["_"] = $sClass;
  123. foreach (MetaModel::EnumZLists() as $sListCode)
  124. {
  125. $aRow[$sListCode] = implode(", ", MetaModel::GetZListItems($sClass, $sListCode));
  126. }
  127. $aData[] = $aRow;
  128. }
  129. echo MyHelpers::make_table_from_assoc_array($aData);
  130. }
  131. function ShowDatabaseInfo()
  132. {
  133. $aTables = array();
  134. foreach (CMDBSource::EnumTables() as $sTable)
  135. {
  136. $aTableData = array();
  137. $aTableData["Name"] = $sTable;
  138. $aTableDesc = CMDBSource::GetTableInfo($sTable);
  139. $aTableData["Fields"] = MyHelpers::make_table_from_assoc_array($aTableDesc["Fields"]);
  140. $aTables[$sTable] = $aTableData;
  141. }
  142. echo MyHelpers::make_table_from_assoc_array($aTables);
  143. }
  144. function CreateDB()
  145. {
  146. $sRes = "<p>Creating the DB...</p>\n";
  147. if (MetaModel::DBExists(false))
  148. {
  149. $sRes .= "<p>It appears that the DB already exists (at least one table).</p>\n";
  150. }
  151. else
  152. {
  153. MetaModel::DBCreate();
  154. $sRes .= "<p>Done!</p>\n";
  155. }
  156. return $sRes;
  157. }
  158. function DebugQuery($sConfigFile)
  159. {
  160. $sQuery = ReadParam("oql");
  161. if (empty($sQuery))
  162. {
  163. $sQueryTemplate = "SELECT Foo AS f JOIN Dummy AS D ON d.spirit = f.id WHERE f.age * d.height > TO_DAYS(NOW()) OR d.alive";
  164. }
  165. else
  166. {
  167. $sQueryTemplate = $sQuery;
  168. }
  169. echo "<form>\n";
  170. echo "<input type=\"hidden\" name=\"todo\" value=\"debugquery\">\n";
  171. echo "<input type=\"hidden\" name=\"config\" value=\"$sConfigFile\">\n";
  172. echo "<textarea name=\"oql\" rows=\"10\" cols=\"120\" name=\"csvdata\" wrap=\"soft\">$sQueryTemplate</textarea>\n";
  173. echo "<input type=\"submit\" name=\"foo\">\n";
  174. echo "</form>\n";
  175. if (empty($sQuery)) return;
  176. echo "<h1>Testing query</h1>\n";
  177. echo "<p>$sQuery</p>\n";
  178. echo "<h1>Follow up the query build</h1>\n";
  179. MetaModel::StartDebugQuery();
  180. $oFlt = DBObjectSearch::FromOQL($sQuery);
  181. echo "<p>To OQL: ".$oFlt->ToOQL()."</p>";
  182. $sSQL = MetaModel::MakeSelectQuery($oFlt);
  183. MetaModel::StopDebugQuery();
  184. echo "<h1>Explain</h1>\n";
  185. echo "<table border=\"1\">\n";
  186. foreach (CMDBSource::ExplainQuery($sSQL) as $aRow)
  187. {
  188. echo " <tr>\n";
  189. echo " <td>".implode('</td><td>', $aRow)."</td>\n";
  190. echo " </tr>\n";
  191. }
  192. echo "</table>\n";
  193. echo "<h1>Results</h1>\n";
  194. $oSet = new CMDBObjectSet($oFlt);
  195. echo $oSet; // __toString()
  196. }
  197. function DumpDatabase()
  198. {
  199. $aData = MetaModel::DBDump();
  200. foreach ($aData as $sTable => $aRows)
  201. {
  202. echo "<h1>".htmlentities($sTable)."</h1>\n";
  203. if (count($aRows) == 0)
  204. {
  205. echo "<p>no data</p>\n";
  206. }
  207. else
  208. {
  209. echo "<p>".count($aRows)." row(s)</p>\n";
  210. // Table header
  211. echo "<table border=\"1\">\n";
  212. echo "<tr>\n";
  213. foreach (reset($aRows) as $key => $value)
  214. {
  215. echo "<th>".htmlentities($key)."</th>";
  216. }
  217. echo "</tr>\n";
  218. // Table body
  219. foreach ($aRows as $aRow)
  220. {
  221. echo "<tr>\n";
  222. foreach ($aRow as $key => $value)
  223. {
  224. echo "<td>".htmlentities($value)."</td>";
  225. }
  226. echo "</tr>\n";
  227. }
  228. echo "</table>\n";
  229. }
  230. }
  231. }
  232. /////////////////////////////////////////////////////////////////////////////////////
  233. // Helper functions
  234. /////////////////////////////////////////////////////////////////////////////////////
  235. function printMenu($sConfigFile)
  236. {
  237. $sClassCount = count(MetaModel::GetClasses());
  238. $bHasDB = MetaModel::DBExists(false); // no need to be complete to consider that something already exists
  239. $sUrl = "?config=".urlencode($sConfigFile);
  240. echo "<div style=\"background-color:eeeeee; padding:10px;\">\n";
  241. echo "<h2>phpMyORM integration sandbox</h2>\n";
  242. echo "<h4>Target database: $sConfigFile</h4>\n";
  243. echo "<p>$sClassCount classes referenced in the model</p>\n";
  244. echo "<ul>";
  245. echo " <li><a href=\"$sUrl&todo=checkdictionary&categories=bizmodel&outputfilter=NotInDictionary\">Dictionary - missing entries (EN US)</a></li>";
  246. echo " <li><a href=\"$sUrl&todo=dictionarystats\">Dictionary - statistics by language</a></li>";
  247. echo " <li><a href=\"$sUrl&todo=checkmodel\">Biz model consistency</a></li>";
  248. echo " <li><a href=\"$sUrl&todo=showzlists\">Show ZLists</a></li>";
  249. echo " <li><a href=\"$sUrl&todo=showbizmodel\">Browse business model</a></li>";
  250. if ($bHasDB)
  251. {
  252. echo " <li><a href=\"$sUrl&todo=checkmodeltodb\">Concordance between Biz model and <b>DB format</b></a></li>";
  253. echo " <li><a href=\"$sUrl&todo=checkmodeltoviews\">Concordance between Biz model and <b>Views</b></a></li>";
  254. echo " <li><a href=\"$sUrl&todo=checkdb\">DB integrity check</a></li>";
  255. echo " <li><a href=\"$sUrl&todo=checkall\">Any check at once (see list above)</a></li>";
  256. echo " <li><a href=\"$sUrl&todo=userrightssetup\">Setup userrights (init DB)</a></li>";
  257. echo " <li><a href=\"$sUrl&todo=showtables\">Show Tables</a></li>";
  258. echo " <li><a href=\"$sUrl&todo=debugquery\">Test an OQL query (debug)</a></li>";
  259. echo " <li><a href=\"$sUrl&todo=dumpdb\">Dump database</a></li>";
  260. // echo " <li>".htmlentities($sUrl)."&amp;<b>todo=execsql</b>&amp;<b>sql=xxx</b>, to execute a specific sql request</li>";
  261. }
  262. else
  263. {
  264. echo " <li><a href=\"$sUrl&todo=createdb\">Create the DB</a></li>";
  265. }
  266. echo "</ul>";
  267. echo "</div>\n";
  268. }
  269. function printConfigList()
  270. {
  271. echo "<h2>phpMyORM integration sandbox</h2>\n";
  272. echo "<h4>Configuration sumary</h4>\n";
  273. $sBasePath = '..';
  274. $aConfigs = array();
  275. foreach(scandir($sBasePath) as $sFile)
  276. {
  277. if (preg_match('/^config-.+\\.php$/', $sFile)) $aConfigs[] = $sFile;
  278. }
  279. $aConfigDetails = array();
  280. foreach ($aConfigs as $sConfigFile)
  281. {
  282. $sRealPath = $sBasePath.'/'.$sConfigFile;
  283. $oConfig = new Config($sRealPath);
  284. $sAppModules = implode(', ', $oConfig->GetAppModules());
  285. $sDataModels = implode(', ', $oConfig->GetDataModels());
  286. $sAddons = implode(', ', $oConfig->GetAddons());
  287. $sDBSubname = (strlen($oConfig->GetDBSubname()) > 0) ? '('.$oConfig->GetDBSubname().')' : '';
  288. $sUrl = "?config=".urlencode($sRealPath);
  289. $sHLink = "<a href=\"$sUrl\">Manage <b>$sConfigFile</b></a></br>\n";
  290. $aConfigDetails[] = array('Config'=>$sHLink, 'Application'=>$sAppModules, 'Data models'=>$sDataModels, 'Addons'=>$sAddons, 'Database'=>$oConfig->GetDBHost().'/'.$oConfig->GetDBName().$sDBSubname.' as '.$oConfig->GetDBUser());
  291. }
  292. echo MyHelpers::make_table_from_assoc_array($aConfigDetails);
  293. }
  294. function ReadParam($sName, $defaultValue = "")
  295. {
  296. return isset($_REQUEST[$sName]) ? $_REQUEST[$sName] : $defaultValue;
  297. }
  298. function ReadMandatoryParam($sName)
  299. {
  300. $value = ReadParam($sName, null);
  301. if (is_null($value))
  302. {
  303. echo "<p>Missing mandatory argument <b>$sName</b></p>";
  304. exit;
  305. }
  306. return $value;
  307. }
  308. function DisplayDBFormatIssues($aErrors, $aSugFix, $sRepairUrl = "", $sSQLStatementArgName = "")
  309. {
  310. $aSQLFixes = array(); // each and every SQL repair statement
  311. if (count($aErrors) > 0)
  312. {
  313. echo "<div style=\"width:100%;padding:10px;background:#FFAAAA;display:;\">";
  314. echo "<h1>Wrong Database format</h1>\n";
  315. echo "<p>The current database is not consistent with the given business model. Please investigate.</p>\n";
  316. foreach ($aErrors as $sClass => $aTarget)
  317. {
  318. echo "<p>Wrong declaration (or DB format ?) for class <b>$sClass</b></p>\n";
  319. echo "<ul class=\"treeview\">\n";
  320. $i = 0;
  321. foreach ($aTarget as $sTarget => $aMessages)
  322. {
  323. if ($sTarget != '*')
  324. {
  325. echo "<p>Wrong declaration for attribute <b>$sTarget</b></p>\n";
  326. }
  327. $sMsg = implode(' AND ', $aMessages);
  328. if (!empty($sRepairUrl))
  329. {
  330. $aSQLFixes = array_merge($aSQLFixes, $aSugFix[$sClass][$sTarget]);
  331. $sSQLFixes = implode('; ', $aSugFix[$sClass][$sTarget]);
  332. $sUrl = "$sRepairUrl&$sSQLStatementArgName=".urlencode($sSQLFixes);
  333. echo "<li>$sMsg (<a href=\"$sUrl\" title=\"".htmlentities($sSQLFixes)."\" target=\"_blank\">fix it now!</a>)</li>\n";
  334. }
  335. else
  336. {
  337. echo "<li>$sMsg (".htmlentities($sSQLFixes).")</li>\n";
  338. }
  339. $i++;
  340. }
  341. echo "</ul>\n";
  342. }
  343. if (count($aSQLFixes) > 1)
  344. {
  345. MetaModel::DBShowApplyForm($sRepairUrl, $sSQLStatementArgName, $aSQLFixes);
  346. }
  347. echo "<p>Aborting...</p>\n";
  348. echo "</div>\n";
  349. exit;
  350. }
  351. }
  352. /////////////////////////////////////////////////////////////////////////////////////////////////
  353. //
  354. // M a i n P r o g r a m
  355. //
  356. /////////////////////////////////////////////////////////////////////////////////////////////////
  357. require_once('../core/cmdbobject.class.inc.php');
  358. $sConfigFile = ReadParam("config", '');
  359. if (empty($sConfigFile))
  360. {
  361. printConfigList();
  362. exit;
  363. }
  364. MetaModel::Startup($sConfigFile, true); // allow missing DB
  365. $sBaseArgs = "config=".urlencode($sConfigFile);
  366. $sTodo = ReadParam("todo", "");
  367. if ($sTodo == 'execsql')
  368. {
  369. $sSql = ReadMandatoryParam("sql");
  370. $aSql = explode("##SEP##", $sSql);
  371. $sConfirm = ReadParam("confirm");
  372. if (empty($sConfirm) || ($sConfirm != "Yes"))
  373. {
  374. echo "<form method=\"post\" action=\"?$sBaseArgs\">\n";
  375. echo "<input type=\"hidden\" name=\"todo\" value=\"execsql\">\n";
  376. echo "<input type=\"hidden\" name=\"sql\" value=\"".htmlentities($sSql)."\">\n";
  377. if (count($aSql) == 1)
  378. {
  379. echo "Do you confirm that you want to execute this command: <b>".htmlentities($aSql[0])."</b> ?</br>\n";
  380. }
  381. else
  382. {
  383. $sAllQueries = "<li>".implode("</li>\n<li>", $aSql)."</li>\n";
  384. echo "Please confirm that you want to execute these commands: <ul style=\"font-size: smaller;\">".$sAllQueries."</ul>\n";
  385. }
  386. echo "<input type=\"submit\" name=\"confirm\" value=\"Yes\">\n";
  387. echo "</form>\n";
  388. }
  389. else
  390. {
  391. foreach ($aSql as $sOneSingleSql)
  392. {
  393. echo "Executing command: <b>$sOneSingleSql</b></br>\n";
  394. CMDBSource::Query($sOneSingleSql);
  395. echo "... done!</br>\n";
  396. }
  397. }
  398. }
  399. else
  400. {
  401. $sBaseUrl = "?$sBaseArgs&todo=execsql";
  402. switch ($sTodo)
  403. {
  404. case "createdb":
  405. // do NOT print the menu, because it will change...
  406. break;
  407. default:
  408. printMenu($sConfigFile);
  409. }
  410. switch ($sTodo)
  411. {
  412. case "showtables":
  413. ShowDatabaseInfo();
  414. break;
  415. case "showbizmodel":
  416. ShowBizModel($sBaseArgs);
  417. break;
  418. case "showclass":
  419. $sClass = ReadMandatoryParam("class");
  420. ShowClass($sClass, $sBaseArgs);
  421. break;
  422. case "showzlists":
  423. ShowZLists($sBaseArgs);
  424. break;
  425. case "debugquery":
  426. DebugQuery($sConfigFile);
  427. break;
  428. case "createdb":
  429. $sRes = CreateDB();
  430. // As the menu depends on the existence of the DB, we have to do display it right after the job is done
  431. printMenu($sConfigFile);
  432. echo $sRes;
  433. break;
  434. case "dictionarystats":
  435. echo "Dictionary: statistics by language<br/>\n";
  436. foreach (Dict::GetLanguages() as $sLanguageCode => $aLanguageData)
  437. {
  438. list($aMissing, $aUnexpected, $aNotTranslated, $aOK) = Dict::MakeStats($sLanguageCode, 'EN US');
  439. echo "<p>Stats for language: $sLanguageCode</p>\n";
  440. echo "<ul><li>Missing:".count($aMissing)."</li><li>Unexpected:".count($aUnexpected)."</li><li>NotTranslated:".count($aNotTranslated)."</li><li>OK:".count($aOK)."</li></ul>\n";
  441. }
  442. break;
  443. case "checkdictionary":
  444. $sCategories = ReadMandatoryParam("categories");
  445. $sOutputFilter = ReadParam("outputfilter", '');
  446. echo "Dictionary: missing entries (categories: $sCategories, output: '$sOutputFilter')</br>\n";
  447. echo "<pre>\n";
  448. echo MetaModel::MakeDictionaryTemplate($sCategories, $sOutputFilter);
  449. echo "</pre>\n";
  450. break;
  451. case "checkmodel":
  452. echo "Check definitions...</br>\n";
  453. MetaModel::CheckDefinitions();
  454. echo "done...</br>\n";
  455. break;
  456. case "checkmodeltodb":
  457. echo "Check DB format...</br>\n";
  458. list($aErrors, $aSugFix) = MetaModel::DBCheckFormat();
  459. DisplayDBFormatIssues($aErrors, $aSugFix, $sBaseUrl, $sSQLStatementArgName = "sql");
  460. echo "done...</br>\n";
  461. break;
  462. case "checkmodeltoviews":
  463. echo "Check Views...</br>\n";
  464. list($aErrors, $aSugFix) = MetaModel::DBCheckViews();
  465. DisplayDBFormatIssues($aErrors, $aSugFix, $sBaseUrl, $sSQLStatementArgName = "sql");
  466. echo "done...</br>\n";
  467. break;
  468. case "checkdb":
  469. echo "Check DB integrity...</br>\n";
  470. MetaModel::DBCheckIntegrity($sBaseUrl, "sql");
  471. echo "done...</br>\n";
  472. break;
  473. case "dumpdb":
  474. echo "Dump DB data...</br>\n";
  475. DumpDatabase();
  476. echo "done...</br>\n";
  477. break;
  478. case "userrightssetup":
  479. echo "Setup user rights module (init DB)...</br>\n";
  480. UserRights::Setup();
  481. echo "done...</br>\n";
  482. break;
  483. case "checkall":
  484. echo "Check definitions...</br>\n";
  485. MetaModel::CheckDefinitions();
  486. echo "done...</br>\n";
  487. echo "Check DB format...</br>\n";
  488. list($aErrors, $aSugFix) = MetaModel::DBCheckFormat();
  489. DisplayDBFormatIssues($aErrors, $aSugFix, $sBaseUrl, $sSQLStatementArgName = "sql");
  490. echo "done...</br>\n";
  491. echo "Check Views...</br>\n";
  492. list($aErrors, $aSugFix) = MetaModel::DBCheckViews();
  493. DisplayDBFormatIssues($aErrors, $aSugFix, $sBaseUrl, $sSQLStatementArgName = "sql");
  494. echo "done...</br>\n";
  495. echo "Check DB integrity...</br>\n";
  496. MetaModel::DBCheckIntegrity($sBaseUrl, "sql");
  497. echo "done...</br>\n";
  498. break;
  499. }
  500. }
  501. ?>