mirror of
https://github.com/Combodo/iTop.git
synced 2026-02-13 07:24:13 +01:00
Enhanced reporting during the setup: all the queries (create table / alter table) are now logged into "setup.log" along with their execution time.
SVN:trunk[3446]
This commit is contained in:
@@ -46,6 +46,18 @@ class RunTimeEnvironment
|
||||
$this->sTargetEnv = $sEnvironment;
|
||||
}
|
||||
|
||||
/**
|
||||
* Callback function for logging the queries run by the setup.
|
||||
* According to the documentation the function must be defined before passing it to call_user_func...
|
||||
* @param string $sQuery
|
||||
* @param float $fDuration
|
||||
* @return void
|
||||
*/
|
||||
public function LogQueryCallback($sQuery, $fDuration)
|
||||
{
|
||||
$this->log_info(sprintf('%.3fs - query: %s ', $fDuration, $sQuery));
|
||||
}
|
||||
|
||||
/**
|
||||
* Helper function to initialize the ORM and load the data model
|
||||
* from the given file
|
||||
@@ -411,7 +423,7 @@ class RunTimeEnvironment
|
||||
{
|
||||
if (!MetaModel::DBExists(/* bMustBeComplete */ false))
|
||||
{
|
||||
MetaModel::DBCreate();
|
||||
MetaModel::DBCreate(array($this, 'LogQueryCallback'));
|
||||
$this->log_ok("Database structure successfully created.");
|
||||
}
|
||||
else
|
||||
@@ -430,7 +442,7 @@ class RunTimeEnvironment
|
||||
{
|
||||
if (MetaModel::DBExists(/* bMustBeComplete */ false))
|
||||
{
|
||||
MetaModel::DBCreate();
|
||||
MetaModel::DBCreate(array($this, 'LogQueryCallback'));
|
||||
$this->log_ok("Database structure successfully updated.");
|
||||
|
||||
// Check (and update only if it seems needed) the hierarchical keys
|
||||
|
||||
Reference in New Issue
Block a user