N°2522 - API : Deprecate SetupPage:log*

This commit is contained in:
acognet
2020-08-20 17:42:49 +02:00
parent 1afc6cd4c5
commit c4b7be5b6f
11 changed files with 300 additions and 299 deletions

View File

@@ -97,14 +97,14 @@ if (!class_exists('AttachmentInstaller'))
$iCount = CMDBSource::QueryToScalar($sCountQuery);
if ($iCount > 0)
{
SetupPage::log_info("Cleanup of orphan attachments that cannot be migrated to the new ObjKey model: $iCount record(s) must be deleted.");
SetupLog::Info("Cleanup of orphan attachments that cannot be migrated to the new ObjKey model: $iCount record(s) must be deleted.");
$sRepairQuery = "DELETE FROM `$sTableName` WHERE (`item_id`='' OR `item_id` IS NULL)";
$iRet = CMDBSource::Query($sRepairQuery); // Throws an exception in case of error
SetupPage::log_info("Cleanup of orphan attachments successfully completed.");
SetupLog::Info("Cleanup of orphan attachments successfully completed.");
}
else
{
SetupPage::log_info("No orphan attachment found.");
SetupLog::Info("No orphan attachment found.");
}
}
}
@@ -121,12 +121,12 @@ if (!class_exists('AttachmentInstaller'))
// get the org_id from the container object
//
// Prerequisite: change null into 0 (workaround to the fact that we cannot use IS NULL in OQL)
SetupPage::log_info("Initializing attachment/item_org_id - null to zero");
SetupLog::Info("Initializing attachment/item_org_id - null to zero");
$sTableName = MetaModel::DBGetTable('Attachment');
$sRepair = "UPDATE `$sTableName` SET `item_org_id` = 0 WHERE `item_org_id` IS NULL";
CMDBSource::Query($sRepair);
SetupPage::log_info("Initializing attachment/item_org_id - zero to the container");
SetupLog::Info("Initializing attachment/item_org_id - zero to the container");
$oSearch = DBObjectSearch::FromOQL("SELECT Attachment WHERE item_org_id = 0");
$oSet = new DBObjectSet($oSearch);
$iUpdated = 0;
@@ -140,7 +140,7 @@ if (!class_exists('AttachmentInstaller'))
}
}
SetupPage::log_info("Initializing attachment/item_org_id - $iUpdated records have been adjusted");
SetupLog::Info("Initializing attachment/item_org_id - $iUpdated records have been adjusted");
}
}
}

View File

@@ -182,218 +182,218 @@ try
switch ($sOperation)
{
case 'check_before_backup':
require_once (APPROOT.'/application/startup.inc.php');
require_once (APPROOT.'/application/loginwebpage.class.inc.php');
LoginWebPage::DoLogin(true); // Check user rights and prompt if needed (must be admin)
$sDBBackupPath = APPROOT.'data/backups/manual';
$aChecks = SetupUtils::CheckBackupPrerequisites($sDBBackupPath);
$bFailed = false;
foreach ($aChecks as $oCheckResult)
{
if ($oCheckResult->iSeverity==CheckResult::ERROR)
{
$bFailed = true;
ReportError($oCheckResult->sLabel, -2);
}
}
if (!$bFailed)
{
// Continue the checks
$fFreeSpace = SetupUtils::CheckDiskSpace($sDBBackupPath);
if ($fFreeSpace!==false)
{
$sMessage = Dict::Format('iTopHub:BackupFreeDiskSpaceIn', SetupUtils::HumanReadableSize($fFreeSpace), dirname($sDBBackupPath));
ReportSuccess($sMessage);
}
else
{
ReportError(Dict::S('iTopHub:FailedToCheckFreeDiskSpace'), -1);
}
}
break;
case 'do_backup':
require_once (APPROOT.'/application/startup.inc.php');
require_once (APPROOT.'/application/loginwebpage.class.inc.php');
LoginWebPage::DoLogin(true); // Check user rights and prompt if needed (must be admin)
try
{
if (MetaModel::GetConfig()->Get('demo_mode')) throw new Exception('Sorry the installation of extensions is not allowed in demo mode');
SetupPage::log_info('Backup starts...');
set_time_limit(0);
$sBackupPath = APPROOT.'/data/backups/manual/backup-';
$iSuffix = 1;
$sSuffix = '';
// Generate a unique name...
do
{
$sBackupFile = $sBackupPath.date('Y-m-d-His').$sSuffix;
$sSuffix = '-'.$iSuffix;
$iSuffix++ ;
}
while (file_exists($sBackupFile));
$oBackup = DoBackup($sBackupFile);
$aErrors = $oBackup->GetErrors();
if (count($aErrors)>0)
{
SetupPage::log_error('Backup failed.');
SetupPage::log_error(implode("\n", $aErrors));
ReportError(Dict::S('iTopHub:BackupFailed'), -1, $aErrors);
}
else
{
SetupPage::log_info('Backup successfully completed.');
ReportSuccess(Dict::S('iTopHub:BackupOk'));
}
}
catch (Exception $e)
{
SetupPage::log_error($e->getMessage());
ReportError($e->getMessage(), $e->getCode());
}
break;
case 'compile':
SetupPage::log_info('Deployment starts...');
$sAuthent = utils::ReadParam('authent', '', false, 'raw_data');
if (!file_exists(APPROOT.'data/hub/compile_authent') || $sAuthent !== file_get_contents(APPROOT.'data/hub/compile_authent'))
{
throw new SecurityException(Dict::S('iTopHub:FailAuthent'));
}
// First step: prepare the datamodel, if it fails, roll-back
$aSelectedExtensionCodes = utils::ReadParam('extension_codes', array());
$aSelectedExtensionDirs = utils::ReadParam('extension_dirs', array());
$oRuntimeEnv = new HubRunTimeEnvironment('production', false); // use a temp environment: production-build
$oRuntimeEnv->MoveSelectedExtensions(APPROOT.'/data/downloaded-extensions/', $aSelectedExtensionDirs);
$oConfig = new Config(APPCONF.'production/'.ITOP_CONFIG_FILE);
if ($oConfig->Get('demo_mode')) throw new Exception('Sorry the installation of extensions is not allowed in demo mode');
$aSelectModules = $oRuntimeEnv->CompileFrom('production', false); // WARNING symlinks does not seem to be compatible with manual Commit
$oRuntimeEnv->UpdateIncludes($oConfig);
$oRuntimeEnv->InitDataModel($oConfig, true /* model only */);
// Safety check: check the inter dependencies, will throw an exception in case of inconsistency
$oRuntimeEnv->AnalyzeInstallation($oConfig, $oRuntimeEnv->GetBuildDir(), true);
$oRuntimeEnv->CheckMetaModel(); // Will throw an exception if a problem is detected
// Everything seems Ok so far, commit in env-production!
$oRuntimeEnv->WriteConfigFileSafe($oConfig);
$oRuntimeEnv->Commit();
// Report the success in a way that will be detected by the ajax caller
SetupPage::log_info('Compilation completed...');
ReportSuccess('Ok'); // No access to Dict::S here
break;
case 'move_to_production':
// Second step: update the schema and the data
// Everything happening below is based on env-production
$oRuntimeEnv = new RunTimeEnvironment('production', true);
try
{
SetupPage::log_info('Move to production starts...');
$sAuthent = utils::ReadParam('authent', '', false, 'raw_data');
if (!file_exists(APPROOT.'data/hub/compile_authent') || $sAuthent !== file_get_contents(APPROOT.'data/hub/compile_authent'))
{
throw new SecurityException(Dict::S('iTopHub:FailAuthent'));
}
unlink(APPROOT.'data/hub/compile_authent');
// Load the "production" config file to clone & update it
$oConfig = new Config(APPCONF.'production/'.ITOP_CONFIG_FILE);
SetupUtils::EnterReadOnlyMode($oConfig);
require_once (APPROOT.'/application/startup.inc.php');
require_once (APPROOT.'/application/loginwebpage.class.inc.php');
LoginWebPage::DoLogin(true); // Check user rights and prompt if needed (must be admin)
$oRuntimeEnv->InitDataModel($oConfig, true /* model only */);
$aAvailableModules = $oRuntimeEnv->AnalyzeInstallation($oConfig, $oRuntimeEnv->GetBuildDir(), true);
$aSelectedModules = array();
foreach ($aAvailableModules as $sModuleId => $aModule)
$sDBBackupPath = APPROOT.'data/backups/manual';
$aChecks = SetupUtils::CheckBackupPrerequisites($sDBBackupPath);
$bFailed = false;
foreach ($aChecks as $oCheckResult)
{
if (($sModuleId == ROOT_MODULE) || ($sModuleId == DATAMODEL_MODULE))
if ($oCheckResult->iSeverity==CheckResult::ERROR)
{
continue;
$bFailed = true;
ReportError($oCheckResult->sLabel, -2);
}
}
if (!$bFailed)
{
// Continue the checks
$fFreeSpace = SetupUtils::CheckDiskSpace($sDBBackupPath);
if ($fFreeSpace!==false)
{
$sMessage = Dict::Format('iTopHub:BackupFreeDiskSpaceIn', SetupUtils::HumanReadableSize($fFreeSpace), dirname($sDBBackupPath));
ReportSuccess($sMessage);
}
else
{
$aSelectedModules[] = $sModuleId;
ReportError(Dict::S('iTopHub:FailedToCheckFreeDiskSpace'), -1);
}
}
$oRuntimeEnv->CallInstallerHandlers($aAvailableModules, $aSelectedModules, 'BeforeDatabaseCreation');
$oRuntimeEnv->CreateDatabaseStructure($oConfig, 'upgrade');
$oRuntimeEnv->CallInstallerHandlers($aAvailableModules, $aSelectedModules, 'AfterDatabaseCreation');
$oRuntimeEnv->UpdatePredefinedObjects();
$oRuntimeEnv->CallInstallerHandlers($aAvailableModules, $aSelectedModules, 'AfterDatabaseSetup');
$oRuntimeEnv->LoadData($aAvailableModules, $aSelectedModules, false /* no sample data*/);
break;
case 'do_backup':
require_once (APPROOT.'/application/startup.inc.php');
require_once (APPROOT.'/application/loginwebpage.class.inc.php');
LoginWebPage::DoLogin(true); // Check user rights and prompt if needed (must be admin)
$oRuntimeEnv->CallInstallerHandlers($aAvailableModules, $aSelectedModules, 'AfterDataLoad');
// Record the installation so that the "about box" knows about the installed modules
$sDataModelVersion = $oRuntimeEnv->GetCurrentDataModelVersion();
$oExtensionsMap = new iTopExtensionsMap();
// Default choices = as before
$oExtensionsMap->LoadChoicesFromDatabase($oConfig);
foreach ($oExtensionsMap->GetAllExtensions() as $oExtension)
try
{
// Plus all "remote" extensions
if ($oExtension->sSource==iTopExtension::SOURCE_REMOTE)
if (MetaModel::GetConfig()->Get('demo_mode')) throw new Exception('Sorry the installation of extensions is not allowed in demo mode');
SetupLog::Info('Backup starts...');
set_time_limit(0);
$sBackupPath = APPROOT.'/data/backups/manual/backup-';
$iSuffix = 1;
$sSuffix = '';
// Generate a unique name...
do
{
$oExtensionsMap->MarkAsChosen($oExtension->sCode);
$sBackupFile = $sBackupPath.date('Y-m-d-His').$sSuffix;
$sSuffix = '-'.$iSuffix;
$iSuffix++ ;
}
while (file_exists($sBackupFile));
$oBackup = DoBackup($sBackupFile);
$aErrors = $oBackup->GetErrors();
if (count($aErrors)>0)
{
SetupLog::Error('Backup failed.');
SetupLog::Error(implode("\n", $aErrors));
ReportError(Dict::S('iTopHub:BackupFailed'), -1, $aErrors);
}
else
{
SetupLog::Info('Backup successfully completed.');
ReportSuccess(Dict::S('iTopHub:BackupOk'));
}
}
$aSelectedExtensionCodes = array();
foreach ($oExtensionsMap->GetChoices() as $oExtension)
catch (Exception $e)
{
$aSelectedExtensionCodes[] = $oExtension->sCode;
SetupLog::Error($e->getMessage());
ReportError($e->getMessage(), $e->getCode());
}
$aSelectedExtensions = $oExtensionsMap->GetChoices();
$oRuntimeEnv->RecordInstallation($oConfig, $sDataModelVersion, $aSelectedModules, $aSelectedExtensionCodes, 'Done by the iTop Hub Connector');
break;
case 'compile':
SetupLog::Info('Deployment starts...');
$sAuthent = utils::ReadParam('authent', '', false, 'raw_data');
if (!file_exists(APPROOT.'data/hub/compile_authent') || $sAuthent !== file_get_contents(APPROOT.'data/hub/compile_authent'))
{
throw new SecurityException(Dict::S('iTopHub:FailAuthent'));
}
// First step: prepare the datamodel, if it fails, roll-back
$aSelectedExtensionCodes = utils::ReadParam('extension_codes', array());
$aSelectedExtensionDirs = utils::ReadParam('extension_dirs', array());
$oRuntimeEnv = new HubRunTimeEnvironment('production', false); // use a temp environment: production-build
$oRuntimeEnv->MoveSelectedExtensions(APPROOT.'/data/downloaded-extensions/', $aSelectedExtensionDirs);
$oConfig = new Config(APPCONF.'production/'.ITOP_CONFIG_FILE);
if ($oConfig->Get('demo_mode')) throw new Exception('Sorry the installation of extensions is not allowed in demo mode');
$aSelectModules = $oRuntimeEnv->CompileFrom('production', false); // WARNING symlinks does not seem to be compatible with manual Commit
$oRuntimeEnv->UpdateIncludes($oConfig);
$oRuntimeEnv->InitDataModel($oConfig, true /* model only */);
// Safety check: check the inter dependencies, will throw an exception in case of inconsistency
$oRuntimeEnv->AnalyzeInstallation($oConfig, $oRuntimeEnv->GetBuildDir(), true);
$oRuntimeEnv->CheckMetaModel(); // Will throw an exception if a problem is detected
// Everything seems Ok so far, commit in env-production!
$oRuntimeEnv->WriteConfigFileSafe($oConfig);
$oRuntimeEnv->Commit();
// Report the success in a way that will be detected by the ajax caller
SetupPage::log_info('Deployment successfully completed.');
ReportSuccess(Dict::S('iTopHub:CompiledOK'));
}
catch (Exception $e)
{
if(file_exists(APPROOT.'data/hub/compile_authent'))
SetupLog::Info('Compilation completed...');
ReportSuccess('Ok'); // No access to Dict::S here
break;
case 'move_to_production':
// Second step: update the schema and the data
// Everything happening below is based on env-production
$oRuntimeEnv = new RunTimeEnvironment('production', true);
try
{
SetupLog::Info('Move to production starts...');
$sAuthent = utils::ReadParam('authent', '', false, 'raw_data');
if (!file_exists(APPROOT.'data/hub/compile_authent') || $sAuthent !== file_get_contents(APPROOT.'data/hub/compile_authent'))
{
throw new SecurityException(Dict::S('iTopHub:FailAuthent'));
}
unlink(APPROOT.'data/hub/compile_authent');
// Load the "production" config file to clone & update it
$oConfig = new Config(APPCONF.'production/'.ITOP_CONFIG_FILE);
SetupUtils::EnterReadOnlyMode($oConfig);
$oRuntimeEnv->InitDataModel($oConfig, true /* model only */);
$aAvailableModules = $oRuntimeEnv->AnalyzeInstallation($oConfig, $oRuntimeEnv->GetBuildDir(), true);
$aSelectedModules = array();
foreach ($aAvailableModules as $sModuleId => $aModule)
{
if (($sModuleId == ROOT_MODULE) || ($sModuleId == DATAMODEL_MODULE))
{
continue;
}
else
{
$aSelectedModules[] = $sModuleId;
}
}
$oRuntimeEnv->CallInstallerHandlers($aAvailableModules, $aSelectedModules, 'BeforeDatabaseCreation');
$oRuntimeEnv->CreateDatabaseStructure($oConfig, 'upgrade');
$oRuntimeEnv->CallInstallerHandlers($aAvailableModules, $aSelectedModules, 'AfterDatabaseCreation');
$oRuntimeEnv->UpdatePredefinedObjects();
$oRuntimeEnv->CallInstallerHandlers($aAvailableModules, $aSelectedModules, 'AfterDatabaseSetup');
$oRuntimeEnv->LoadData($aAvailableModules, $aSelectedModules, false /* no sample data*/);
$oRuntimeEnv->CallInstallerHandlers($aAvailableModules, $aSelectedModules, 'AfterDataLoad');
// Record the installation so that the "about box" knows about the installed modules
$sDataModelVersion = $oRuntimeEnv->GetCurrentDataModelVersion();
$oExtensionsMap = new iTopExtensionsMap();
// Default choices = as before
$oExtensionsMap->LoadChoicesFromDatabase($oConfig);
foreach ($oExtensionsMap->GetAllExtensions() as $oExtension)
{
// Plus all "remote" extensions
if ($oExtension->sSource==iTopExtension::SOURCE_REMOTE)
{
$oExtensionsMap->MarkAsChosen($oExtension->sCode);
}
}
$aSelectedExtensionCodes = array();
foreach ($oExtensionsMap->GetChoices() as $oExtension)
{
$aSelectedExtensionCodes[] = $oExtension->sCode;
}
$aSelectedExtensions = $oExtensionsMap->GetChoices();
$oRuntimeEnv->RecordInstallation($oConfig, $sDataModelVersion, $aSelectedModules, $aSelectedExtensionCodes, 'Done by the iTop Hub Connector');
// Report the success in a way that will be detected by the ajax caller
SetupLog::Info('Deployment successfully completed.');
ReportSuccess(Dict::S('iTopHub:CompiledOK'));
}
catch (Exception $e)
{
if(file_exists(APPROOT.'data/hub/compile_authent'))
{
unlink(APPROOT.'data/hub/compile_authent');
}
// Note: at this point, the dictionnary is not necessarily loaded
SetupLog::Error(get_class($e).': '.Dict::S('iTopHub:ConfigurationSafelyReverted')."\n".$e->getMessage());
SetupLog::Error('Debug trace: '.$e->getTraceAsString());
ReportError($e->getMessage(), $e->getCode());
}
finally
{
SetupUtils::ExitReadOnlyMode();
}
// Note: at this point, the dictionnary is not necessarily loaded
SetupPage::log_error(get_class($e).': '.Dict::S('iTopHub:ConfigurationSafelyReverted')."\n".$e->getMessage());
SetupPage::log_error('Debug trace: '.$e->getTraceAsString());
ReportError($e->getMessage(), $e->getCode());
}
finally
{
SetupUtils::ExitReadOnlyMode();
}
break;
default:
ReportError("Invalid operation: '$sOperation'", -1);
ReportError("Invalid operation: '$sOperation'", -1);
}
}
catch (Exception $e)
{
SetupPage::log_error(get_class($e).': '.Dict::S('iTopHub:ConfigurationSafelyReverted')."\n".$e->getMessage());
SetupPage::log_error('Debug trace: '.$e->getTraceAsString());
SetupLog::Error(get_class($e).': '.Dict::S('iTopHub:ConfigurationSafelyReverted')."\n".$e->getMessage());
SetupLog::Error('Debug trace: '.$e->getTraceAsString());
utils::PopArchiveMode();

View File

@@ -48,7 +48,7 @@ if (empty($sMemoryLimit))
// On some PHP installations, memory_limit does not exist as a PHP setting!
// (encountered on a 5.2.0 under Windows)
// In that case, ini_set will not work, let's keep track of this and proceed with the data load
SetupPage::log_info("No memory limit has been defined in this instance of PHP");
SetupLog::Info("No memory limit has been defined in this instance of PHP");
}
else
{
@@ -59,11 +59,11 @@ else
{
if (ini_set('memory_limit', SAFE_MINIMUM_MEMORY) === FALSE)
{
SetupPage::log_error("memory_limit is too small: $iMemoryLimit and can not be increased by the script itself.");
SetupLog::Error("memory_limit is too small: $iMemoryLimit and can not be increased by the script itself.");
}
else
{
SetupPage::log_info("memory_limit increased from $iMemoryLimit to ".SAFE_MINIMUM_MEMORY.".");
SetupLog::Info("memory_limit increased from $iMemoryLimit to ".SAFE_MINIMUM_MEMORY.".");
}
}
}
@@ -89,7 +89,7 @@ function ShutdownCallback()
$errline = $error["line"];
$errstr = $error["message"];
$sLogMessage = "PHP error occured : msg=$errstr, no=$errno, file=$errfile, line=$errline";
SetupPage::log_error("Setup error: $sLogMessage");
SetupLog::Error("Setup error: $sLogMessage");
echo '<'.PHP_FATAL_ERROR_TAG.'>'.$sLogMessage.'</'.PHP_FATAL_ERROR_TAG.'>';
}
@@ -188,17 +188,17 @@ catch(Exception $e)
header("HTTP/1.0 500 Internal server error.");
echo "<p>An error happened while processing the installation:</p>\n";
echo '<p>'.$e."</p>\n";
SetupPage::log_error("An error happened while processing the installation: ".$e);
SetupLog::Error("An error happened while processing the installation: ".$e);
}
if (function_exists('memory_get_peak_usage'))
{
if ($sOperation == 'file')
{
SetupPage::log_info("loading file '$sFileName', peak memory usage. ".memory_get_peak_usage());
SetupLog::Info("loading file '$sFileName', peak memory usage. ".memory_get_peak_usage());
}
else
{
SetupPage::log_info("operation '$sOperation', peak memory usage. ".memory_get_peak_usage());
SetupLog::Info("operation '$sOperation', peak memory usage. ".memory_get_peak_usage());
}
}

View File

@@ -189,7 +189,7 @@ class ApplicationInstaller
try
{
$fStart = microtime(true);
SetupPage::log_info("##### STEP {$sStep} start");
SetupLog::Info("##### STEP {$sStep} start");
$this->EnterReadOnlyMode();
switch ($sStep)
{
@@ -209,7 +209,7 @@ class ApplicationInstaller
$this->oParams->ToXML($oDoc, null, 'installation');
$sXML = $oDoc->saveXML();
$sSafeXml = preg_replace("|<pwd>([^<]*)</pwd>|", "<pwd>**removed**</pwd>", $sXML);
SetupPage::log_info("======= Installation starts =======\nParameters:\n$sSafeXml\n");
SetupLog::Info("======= Installation starts =======\nParameters:\n$sSafeXml\n");
// Save the response file as a stand-alone file as well
$sFileName = 'install-'.date('Y-m-d');
@@ -281,11 +281,11 @@ class ApplicationInstaller
if (function_exists('symlink'))
{
$bUseSymbolicLinks = true;
SetupPage::log_info("Using symbolic links instead of copying data model files (for developers only!)");
SetupLog::Info("Using symbolic links instead of copying data model files (for developers only!)");
}
else
{
SetupPage::log_info("Symbolic links (function symlinks) does not seem to be supported on this platform (OS/PHP version).");
SetupLog::Info("Symbolic links (function symlinks) does not seem to be supported on this platform (OS/PHP version).");
}
}
@@ -409,10 +409,10 @@ class ApplicationInstaller
'percentage-completed' => 100,
);
SetupPage::log_error('An exception occurred: '.$e->getMessage().' at line '.$e->getLine().' in file '.$e->getFile());
SetupLog::Error('An exception occurred: '.$e->getMessage().' at line '.$e->getLine().' in file '.$e->getFile());
$idx = 0;
// Log the call stack, but not the parameters since they may contain passwords or other sensitive data
SetupPage::log("Call stack:");
SetupLog::Ok("Call stack:");
foreach ($e->getTrace() as $aTrace)
{
$sLine = empty($aTrace['line']) ? "" : $aTrace['line'];
@@ -421,14 +421,14 @@ class ApplicationInstaller
$sType = empty($aTrace['type']) ? "" : $aTrace['type'];
$sFunction = empty($aTrace['function']) ? "" : $aTrace['function'];
$sVerb = empty($sClass) ? $sFunction : "$sClass{$sType}$sFunction";
SetupPage::log("#$idx $sFile($sLine): $sVerb(...)");
SetupLog::Ok("#$idx $sFile($sLine): $sVerb(...)");
$idx++;
}
}
finally
{
$fDuration = round(microtime(true) - $fStart, 2);
SetupPage::log_info("##### STEP {$sStep} duration: {$fDuration}s");
SetupLog::Info("##### STEP {$sStep} duration: {$fDuration}s");
}
return $aResult;
@@ -516,7 +516,7 @@ class ApplicationInstaller
protected static function DoCompile($aSelectedModules, $sSourceDir, $sExtensionDir, $sTargetDir, $sEnvironment, $bUseSymbolicLinks = false)
{
SetupPage::log_info("Compiling data model.");
SetupLog::Info("Compiling data model.");
require_once(APPROOT.'setup/modulediscovery.class.inc.php');
require_once(APPROOT.'setup/modelfactory.class.inc.php');
@@ -624,7 +624,7 @@ class ApplicationInstaller
$oMFCompiler->Compile($sTargetPath, null, $bUseSymbolicLinks);
//$aCompilerLog = $oMFCompiler->GetLog();
//SetupPage::log_info(implode("\n", $aCompilerLog));
SetupPage::log_info("Data model successfully compiled to '$sTargetPath'.");
SetupLog::Info("Data model successfully compiled to '$sTargetPath'.");
$sCacheDir = APPROOT.'/data/cache-'.$sEnvironment.'/';
SetupUtils::builddir($sCacheDir);
@@ -669,7 +669,7 @@ class ApplicationInstaller
*/
protected static function DoUpdateDBSchema($aSelectedModules, $sModulesDir, $aParamValues, $sTargetEnvironment = '', $bOldAddon = false, $sAppRootUrl = '')
{
SetupPage::log_info("Update Database Schema for environment '$sTargetEnvironment'.");
SetupLog::Info("Update Database Schema for environment '$sTargetEnvironment'.");
$sMode = $aParamValues['mode'];
$sDBPrefix = $aParamValues['db_prefix'];
$sDBName = $aParamValues['db_name'];
@@ -699,7 +699,7 @@ class ApplicationInstaller
// Starting 2.0, all table names must be lowercase
if ($sMode != 'install')
{
SetupPage::log_info("Renaming '{$sDBPrefix}priv_internalUser' into '{$sDBPrefix}priv_internaluser' (lowercase)");
SetupLog::Info("Renaming '{$sDBPrefix}priv_internalUser' into '{$sDBPrefix}priv_internaluser' (lowercase)");
// This command will have no effect under Windows...
// and it has been written in two steps so as to make it work under windows!
CMDBSource::SelectDB($sDBName);
@@ -710,36 +710,36 @@ class ApplicationInstaller
}
catch (Exception $e)
{
SetupPage::log_info("Renaming '{$sDBPrefix}priv_internalUser' failed (already done in a previous upgrade?)");
SetupLog::Info("Renaming '{$sDBPrefix}priv_internalUser' failed (already done in a previous upgrade?)");
}
// let's remove the records in priv_change which have no counterpart in priv_changeop
SetupPage::log_info("Cleanup of '{$sDBPrefix}priv_change' to remove orphan records");
SetupLog::Info("Cleanup of '{$sDBPrefix}priv_change' to remove orphan records");
CMDBSource::SelectDB($sDBName);
try
{
$sTotalCount = "SELECT COUNT(*) FROM `{$sDBPrefix}priv_change`";
$iTotalCount = (int)CMDBSource::QueryToScalar($sTotalCount);
SetupPage::log_info("There is a total of $iTotalCount records in {$sDBPrefix}priv_change.");
SetupLog::Info("There is a total of $iTotalCount records in {$sDBPrefix}priv_change.");
$sOrphanCount = "SELECT COUNT(c.id) FROM `{$sDBPrefix}priv_change` AS c left join `{$sDBPrefix}priv_changeop` AS o ON c.id = o.changeid WHERE o.id IS NULL";
$iOrphanCount = (int)CMDBSource::QueryToScalar($sOrphanCount);
SetupPage::log_info("There are $iOrphanCount useless records in {$sDBPrefix}priv_change (".sprintf('%.2f', ((100.0*$iOrphanCount)/$iTotalCount))."%)");
SetupLog::Info("There are $iOrphanCount useless records in {$sDBPrefix}priv_change (".sprintf('%.2f', ((100.0*$iOrphanCount)/$iTotalCount))."%)");
if ($iOrphanCount > 0)
{
SetupPage::log_info("Removing the orphan records...");
SetupLog::Info("Removing the orphan records...");
$sCleanup = "DELETE FROM `{$sDBPrefix}priv_change` USING `{$sDBPrefix}priv_change` LEFT JOIN `{$sDBPrefix}priv_changeop` ON `{$sDBPrefix}priv_change`.id = `{$sDBPrefix}priv_changeop`.changeid WHERE `{$sDBPrefix}priv_changeop`.id IS NULL;";
CMDBSource::Query($sCleanup);
SetupPage::log_info("Cleanup completed successfully.");
SetupLog::Info("Cleanup completed successfully.");
}
else
{
SetupPage::log_info("Ok, nothing to cleanup.");
SetupLog::Info("Ok, nothing to cleanup.");
}
}
catch (Exception $e)
{
SetupPage::log_info("Cleanup of orphan records in `{$sDBPrefix}priv_change` failed: ".$e->getMessage());
SetupLog::Info("Cleanup of orphan records in `{$sDBPrefix}priv_change` failed: ".$e->getMessage());
}
}
@@ -772,7 +772,7 @@ class ApplicationInstaller
$iCount = (int)CMDBSource::QueryToScalar($sCount);
if ($iCount > 0)
{
SetupPage::log_info("Initializing '{$sDBPrefix}priv_change.origin' ($iCount records to update)");
SetupLog::Info("Initializing '{$sDBPrefix}priv_change.origin' ($iCount records to update)");
// By default all uninitialized values are considered as 'interactive'
$sInit = "UPDATE `{$sDBPrefix}priv_change` SET `origin` = 'interactive' WHERE `origin` IS NULL";
@@ -802,17 +802,17 @@ class ApplicationInstaller
$sInit = "UPDATE `{$sDBPrefix}priv_change` SET `origin` = 'synchro-data-source' WHERE ($sCondition)";
CMDBSource::Query($sInit);
SetupPage::log_info("Initialization of '{$sDBPrefix}priv_change.origin' completed.");
SetupLog::Info("Initialization of '{$sDBPrefix}priv_change.origin' completed.");
}
else
{
SetupPage::log_info("'{$sDBPrefix}priv_change.origin' already initialized, nothing to do.");
SetupLog::Info("'{$sDBPrefix}priv_change.origin' already initialized, nothing to do.");
}
}
catch (Exception $e)
{
SetupPage::log_error("Initializing '{$sDBPrefix}priv_change.origin' failed: ".$e->getMessage());
SetupLog::Error("Initializing '{$sDBPrefix}priv_change.origin' failed: ".$e->getMessage());
}
// priv_async_task now has a 'status' field to distinguish between the various statuses rather than just relying on the date columns
@@ -824,27 +824,27 @@ class ApplicationInstaller
$iCount = (int)CMDBSource::QueryToScalar($sCount);
if ($iCount > 0)
{
SetupPage::log_info("Initializing '{$sDBPrefix}priv_async_task.status' ($iCount records to update)");
SetupLog::Info("Initializing '{$sDBPrefix}priv_async_task.status' ($iCount records to update)");
$sInit = "UPDATE `{$sDBPrefix}priv_async_task` SET `status` = 'planned' WHERE (`status` IS NULL) AND (`started` IS NULL)";
CMDBSource::Query($sInit);
$sInit = "UPDATE `{$sDBPrefix}priv_async_task` SET `status` = 'error' WHERE (`status` IS NULL) AND (`started` IS NOT NULL)";
CMDBSource::Query($sInit);
SetupPage::log_info("Initialization of '{$sDBPrefix}priv_async_task.status' completed.");
SetupLog::Info("Initialization of '{$sDBPrefix}priv_async_task.status' completed.");
}
else
{
SetupPage::log_info("'{$sDBPrefix}priv_async_task.status' already initialized, nothing to do.");
SetupLog::Info("'{$sDBPrefix}priv_async_task.status' already initialized, nothing to do.");
}
}
catch (Exception $e)
{
SetupPage::log_error("Initializing '{$sDBPrefix}priv_async_task.status' failed: ".$e->getMessage());
SetupLog::Error("Initializing '{$sDBPrefix}priv_async_task.status' failed: ".$e->getMessage());
}
SetupPage::log_info("Database Schema Successfully Updated for environment '$sTargetEnvironment'.");
SetupLog::Info("Database Schema Successfully Updated for environment '$sTargetEnvironment'.");
}
/**
@@ -864,7 +864,7 @@ class ApplicationInstaller
$bOldAddon
)
{
SetupPage::log_info('After Database Creation');
SetupLog::Info('After Database Creation');
$sMode = $aParamValues['mode'];
$oConfig = new Config();
@@ -898,7 +898,7 @@ class ApplicationInstaller
}
else
{
SetupPage::log_info("Administrator account '$sAdminUser' created.");
SetupLog::Info("Administrator account '$sAdminUser' created.");
}
}
@@ -913,7 +913,7 @@ class ApplicationInstaller
*/
protected static function CreateAdminAccount(Config $oConfig, $sAdminUser, $sAdminPwd, $sLanguage)
{
SetupPage::log_info('CreateAdminAccount');
SetupLog::Info('CreateAdminAccount');
if (UserRights::CreateAdministrator($sAdminUser, $sAdminPwd, $sLanguage))
{
@@ -1032,7 +1032,7 @@ class ApplicationInstaller
{
mkdir(APPCONF);
chmod(APPCONF, 0770); // RWX for owner and group, nothing for others
SetupPage::log_info("Created configuration directory: ".APPCONF);
SetupLog::Info("Created configuration directory: ".APPCONF);
}
// Write the final configuration file
@@ -1056,11 +1056,11 @@ class SetupDBBackup extends DBBackup
{
protected function LogInfo($sMsg)
{
SetupPage::log('Info - '.$sMsg);
SetupLog::Ok('Info - '.$sMsg);
}
protected function LogError($sMsg)
{
SetupPage::log('Error - '.$sMsg);
SetupLog::Ok('Error - '.$sMsg);
}
}

View File

@@ -450,18 +450,18 @@ class iTopExtensionsMap
if (count($aModuleInfo) === 0)
{
SetupPage::log_warning("Eval of $sModuleFile did not return the expected information...");
SetupLog::Warning("Eval of $sModuleFile did not return the expected information...");
}
}
catch(ParseError $e)
{
// Continue...
SetupPage::log_warning("Eval of $sModuleFile caused a parse error: ".$e->getMessage()." at line ".$e->getLine());
SetupLog::Warning("Eval of $sModuleFile caused a parse error: ".$e->getMessage()." at line ".$e->getLine());
}
catch(Exception $e)
{
// Continue...
SetupPage::log_warning("Eval of $sModuleFile caused an exception: ".$e->getMessage());
SetupLog::Warning("Eval of $sModuleFile caused an exception: ".$e->getMessage());
}
return $aModuleInfo;
}

View File

@@ -337,7 +337,7 @@ class ModuleDiscovery
$bOk = @eval('$bResult = '.$sBooleanExpr.'; return true;');
if ($bOk == false)
{
SetupPage::log_warning("Eval of '$sBooleanExpr' returned false");
SetupLog::Warning("Eval of '$sBooleanExpr' returned false");
echo "Failed to parse the boolean Expression = '$sBooleanExpr'<br/>";
}
}
@@ -467,7 +467,7 @@ class ModuleDiscovery
if ($bRet === false)
{
SetupPage::log_warning("Eval of $sRelDir/$sFile returned false");
SetupLog::Warning("Eval of $sRelDir/$sFile returned false");
}
//echo "<p>Done.</p>\n";
@@ -475,12 +475,12 @@ class ModuleDiscovery
catch(ParseError $e)
{
// PHP 7
SetupPage::log_warning("Eval of $sRelDir/$sFile caused an exception: ".$e->getMessage()." at line ".$e->getLine());
SetupLog::Warning("Eval of $sRelDir/$sFile caused an exception: ".$e->getMessage()." at line ".$e->getLine());
}
catch(Exception $e)
{
// Continue...
SetupPage::log_warning("Eval of $sRelDir/$sFile caused an exception: ".$e->getMessage());
SetupLog::Warning("Eval of $sRelDir/$sFile caused an exception: ".$e->getMessage());
}
}
}
@@ -503,27 +503,27 @@ class SetupWebPage extends ModuleDiscovery
// For backward compatibility with old modules...
public static function log_error($sText)
{
SetupPage::log_error($sText);
SetupLog::Error($sText);
}
public static function log_warning($sText)
{
SetupPage::log_warning($sText);
SetupLog::Warning($sText);
}
public static function log_info($sText)
{
SetupPage::log_info($sText);
SetupLog::Info($sText);
}
public static function log_ok($sText)
{
SetupPage::log_ok($sText);
SetupLog::Ok($sText);
}
public static function log($sText)
{
SetupPage::log($sText);
SetupLog::Ok($sText);
}
}

View File

@@ -95,12 +95,12 @@ abstract class ModuleInstallerAPI
$sRepair = "UPDATE `$sTableName` SET `$sFinalClassCol` = '$sTo' WHERE `$sFinalClassCol` = BINARY '$sFrom'";
CMDBSource::Query($sRepair);
$iAffectedRows = CMDBSource::AffectedRows();
SetupPage::log_info("Renaming class in DB - final class from '$sFrom' to '$sTo': $iAffectedRows rows affected");
SetupLog::Info("Renaming class in DB - final class from '$sFrom' to '$sTo': $iAffectedRows rows affected");
}
}
catch(Exception $e)
{
SetupPage::log_warning("Failed to rename class in DB - final class from '$sFrom' to '$sTo'. Reason: ".$e->getMessage());
SetupLog::Warning("Failed to rename class in DB - final class from '$sFrom' to '$sTo'. Reason: ".$e->getMessage());
}
}
@@ -122,7 +122,7 @@ abstract class ModuleInstallerAPI
{
if (!MetaModel::IsValidAttCode($sClass, $sAttCode))
{
SetupPage::log_warning("Changing enum in DB - $sClass::$sAttCode - from '$sFrom' to '$sTo' failed. Reason '$sAttCode' is not a valid attribute of the class '$sClass'.");
SetupLog::Warning("Changing enum in DB - $sClass::$sAttCode - from '$sFrom' to '$sTo' failed. Reason '$sAttCode' is not a valid attribute of the class '$sClass'.");
return;
}
$sOriginClass = MetaModel::GetAttributeOrigin($sClass, $sAttCode);
@@ -162,7 +162,7 @@ abstract class ModuleInstallerAPI
if (strtolower($sTo) == strtolower($sFrom))
{
SetupPage::log_info("Changing enum in DB - $sClass::$sAttCode from '$sFrom' to '$sTo' (just a change in the case)");
SetupLog::Info("Changing enum in DB - $sClass::$sAttCode from '$sFrom' to '$sTo' (just a change in the case)");
$aTargetValues = array();
foreach ($aCurrentValues as $sValue)
{
@@ -180,7 +180,7 @@ abstract class ModuleInstallerAPI
{
// 1st - Allow both values in the column definition
//
SetupPage::log_info("Changing enum in DB - $sClass::$sAttCode from '$sFrom' to '$sTo'");
SetupLog::Info("Changing enum in DB - $sClass::$sAttCode from '$sFrom' to '$sTo'");
$aAllValues = $aCurrentValues;
$aAllValues[] = $sTo;
$sColumnDefinition = "ENUM(".implode(",", CMDBSource::Quote($aAllValues)).") $sNullSpec";
@@ -192,7 +192,7 @@ abstract class ModuleInstallerAPI
$sRepair = "UPDATE `$sTableName` SET `$sEnumCol` = '$sTo' WHERE `$sEnumCol` = BINARY '$sFrom'";
CMDBSource::Query($sRepair);
$iAffectedRows = CMDBSource::AffectedRows();
SetupPage::log_info("Changing enum in DB - $iAffectedRows rows updated");
SetupLog::Info("Changing enum in DB - $iAffectedRows rows updated");
// 3rd - Remove the useless value from the column definition
//
@@ -208,25 +208,25 @@ abstract class ModuleInstallerAPI
$sColumnDefinition = "ENUM(".implode(",", CMDBSource::Quote($aTargetValues)).") $sNullSpec";
$sRepair = "ALTER TABLE `$sTableName` MODIFY `$sEnumCol` $sColumnDefinition";
CMDBSource::Query($sRepair);
SetupPage::log_info("Changing enum in DB - removed useless value '$sFrom'");
SetupLog::Info("Changing enum in DB - removed useless value '$sFrom'");
}
}
}
else
{
SetupPage::log_warning("Changing enum in DB - $sClass::$sAttCode - '$sFrom' is still a valid value (".implode(', ', $aNewValues).")");
SetupLog::Warning("Changing enum in DB - $sClass::$sAttCode - '$sFrom' is still a valid value (".implode(', ', $aNewValues).")");
}
}
else
{
SetupPage::log_warning("Changing enum in DB - $sClass::$sAttCode - '$sTo' is not a known value (".implode(', ', $aNewValues).")");
SetupLog::Warning("Changing enum in DB - $sClass::$sAttCode - '$sTo' is not a known value (".implode(', ', $aNewValues).")");
}
}
}
}
catch(Exception $e)
{
SetupPage::log_warning("Changing enum in DB - $sClass::$sAttCode - '$sTo' failed. Reason ".$e->getMessage());
SetupLog::Warning("Changing enum in DB - $sClass::$sAttCode - '$sTo' failed. Reason ".$e->getMessage());
}
}

View File

@@ -884,19 +884,19 @@ class RunTimeEnvironment
*/
protected function log_error($sText)
{
SetupPage::log_error($sText);
SetupLog::Error($sText);
}
protected function log_warning($sText)
{
SetupPage::log_warning($sText);
SetupLog::Warning($sText);
}
protected function log_info($sText)
{
SetupPage::log_info($sText);
SetupLog::Info($sText);
}
protected function log_ok($sText)
{
SetupPage::log_ok($sText);
SetupLog::Ok($sText);
}
/**
@@ -1088,7 +1088,7 @@ class RunTimeEnvironment
isset($aAvailableModules[$sModuleId]['installer']) )
{
$sModuleInstallerClass = $aAvailableModules[$sModuleId]['installer'];
SetupPage::log_info("Calling Module Handler: $sModuleInstallerClass::$sHandlerName(oConfig, {$aModule['version_db']}, {$aModule['version_code']})");
SetupLog::Info("Calling Module Handler: $sModuleInstallerClass::$sHandlerName(oConfig, {$aModule['version_db']}, {$aModule['version_code']})");
$aCallSpec = array($sModuleInstallerClass, $sHandlerName);
if (is_callable($aCallSpec))
{
@@ -1110,8 +1110,8 @@ class RunTimeEnvironment
CMDBObject::SetTrackInfo("Initialization");
$oMyChange = CMDBObject::GetCurrentChange();
SetupPage::log_info("starting data load session");
SetupLog::Info("starting data load session");
$oDataLoader->StartSession($oMyChange);
$aFiles = array();
@@ -1161,7 +1161,7 @@ class RunTimeEnvironment
foreach($aPreviouslyLoadedFiles as $sFileRelativePath)
{
$sFileName = APPROOT.$sFileRelativePath;
SetupPage::log_info("Loading file: $sFileName (just to get the keys mapping)");
SetupLog::Info("Loading file: $sFileName (just to get the keys mapping)");
if (empty($sFileName) || !file_exists($sFileName))
{
throw(new Exception("File $sFileName does not exist"));
@@ -1169,13 +1169,13 @@ class RunTimeEnvironment
$oDataLoader->LoadFile($sFileName, true);
$sResult = sprintf("loading of %s done.", basename($sFileName));
SetupPage::log_info($sResult);
SetupLog::Info($sResult);
}
foreach($aFiles as $sFileRelativePath)
{
$sFileName = APPROOT.$sFileRelativePath;
SetupPage::log_info("Loading file: $sFileName");
SetupLog::Info("Loading file: $sFileName");
if (empty($sFileName) || !file_exists($sFileName))
{
throw(new Exception("File $sFileName does not exist"));
@@ -1183,11 +1183,11 @@ class RunTimeEnvironment
$oDataLoader->LoadFile($sFileName);
$sResult = sprintf("loading of %s done.", basename($sFileName));
SetupPage::log_info($sResult);
SetupLog::Info($sResult);
}
$oDataLoader->EndSession();
SetupPage::log_info("ending data load session");
SetupLog::Info("ending data load session");
}
/**

View File

@@ -151,26 +151,27 @@ class SetupPage extends NiceWebPage
return parent::output();
}
//@deprecated since 2.8.0 use SetupLog::Error
public static function log_error($sText)
{
SetupLog::Error($sText);
}
//@deprecated since 2.8.0 use SetupLog::Warning
public static function log_warning($sText)
{
SetupLog::Warning($sText);
}
//@deprecated since 2.8.0 use SetupLog::Info
public static function log_info($sText)
{
SetupLog::Info($sText);
}
//@deprecated since 2.8.0 use SetupLog::Ok
public static function log_ok($sText)
{
SetupLog::Ok($sText);
}
//@deprecated since 2.8.0 use SetupLog::Ok
public static function log($sText)
{
SetupLog::Ok($sText);

View File

@@ -253,7 +253,7 @@ class SetupUtils
}
}
}
SetupPage::log("Info - php.ini file(s): '$sPhpIniFile'");
SetupLog::Ok("Info - php.ini file(s): '$sPhpIniFile'");
}
if (!ini_get('file_uploads'))
@@ -280,7 +280,7 @@ class SetupUtils
}
else
{
SetupPage::log("Info - Temporary directory for files upload ($sUploadTmpDir) is writable.");
SetupLog::Ok("Info - Temporary directory for files upload ($sUploadTmpDir) is writable.");
}
}
@@ -305,9 +305,9 @@ class SetupUtils
}
SetupPage::log("Info - upload_max_filesize: ".ini_get('upload_max_filesize'));
SetupPage::log("Info - post_max_size: ".ini_get('post_max_size'));
SetupPage::log("Info - max_file_uploads: ".ini_get('max_file_uploads'));
SetupLog::Ok("Info - upload_max_filesize: ".ini_get('upload_max_filesize'));
SetupLog::Ok("Info - post_max_size: ".ini_get('post_max_size'));
SetupLog::Ok("Info - max_file_uploads: ".ini_get('max_file_uploads'));
// Check some more ini settings here, needed for file upload
$sMemoryLimit = trim(ini_get('memory_limit'));
@@ -329,7 +329,7 @@ class SetupUtils
}
else
{
SetupPage::log("Info - memory_limit is $iMemoryLimit, ok.");
SetupLog::Ok("Info - memory_limit is $iMemoryLimit, ok.");
}
}
@@ -353,7 +353,7 @@ class SetupUtils
}
else
{
SetupPage::log("Info - suhosin.get.max_value_length = $iGetMaxValueLength, ok.");
SetupLog::Ok("Info - suhosin.get.max_value_length = $iGetMaxValueLength, ok.");
}
}
@@ -380,7 +380,7 @@ class SetupUtils
if (ini_get('session.save_handler') == 'files')
{
$sSavePath = ini_get('session.save_path');
SetupPage::log("Info - session.save_path is: '$sSavePath'.");
SetupLog::Ok("Info - session.save_path is: '$sSavePath'.");
// According to the PHP documentation, the format can be /path/where/to_save_sessions or "N;/path/where/to_save_sessions" or "N;MODE;/path/where/to_save_sessions"
$sSavePath = ltrim(rtrim($sSavePath, '"'), '"'); // remove surrounding quotes (if any)
@@ -450,7 +450,7 @@ class SetupUtils
*/
private static function CheckPhpVersion(&$aResult)
{
SetupPage::log('Info - CheckPHPVersion');
SetupLog::Ok('Info - CheckPHPVersion');
$sPhpVersion = phpversion();
if (version_compare($sPhpVersion, self::PHP_MIN_VERSION, '>='))
@@ -497,7 +497,7 @@ class SetupUtils
public static function CheckSelectedModules($sSourceDir, $sExtensionDir, $aSelectedModules)
{
$aResult = array();
SetupPage::log('Info - CheckSelectedModules');
SetupLog::Ok('Info - CheckSelectedModules');
$aDirsToScan = array(APPROOT.$sSourceDir);
$sExtensionsPath = APPROOT.$sExtensionDir;
@@ -528,7 +528,7 @@ class SetupUtils
public static function CheckBackupPrerequisites($sDBBackupPath, $sMySQLBinDir = null)
{
$aResult = array();
SetupPage::log('Info - CheckBackupPrerequisites');
SetupLog::Ok('Info - CheckBackupPrerequisites');
// zip extension
//
@@ -546,7 +546,7 @@ class SetupUtils
// availability of exec()
//
$aDisabled = explode(', ', ini_get('disable_functions'));
SetupPage::log('Info - PHP functions disabled: '.implode(', ', $aDisabled));
SetupLog::Ok('Info - PHP functions disabled: '.implode(', ', $aDisabled));
if (in_array('exec', $aDisabled))
{
$aResult[] = new CheckResult(CheckResult::ERROR, "The PHP exec() function has been disabled on this server");
@@ -564,7 +564,7 @@ class SetupUtils
}
else
{
SetupPage::log('Info - Found mysql_bindir: '.$sMySQLBinDir);
SetupLog::Ok('Info - Found mysql_bindir: '.$sMySQLBinDir);
$sMySQLDump = '"'.$sMySQLBinDir.'/mysqldump"';
}
$sCommand = "$sMySQLDump -V 2>&1";
@@ -588,7 +588,7 @@ class SetupUtils
}
foreach($aOutput as $sLine)
{
SetupPage::log('Info - mysqldump -V said: '.$sLine);
SetupLog::Ok('Info - mysqldump -V said: '.$sLine);
}
// create and test destination location
@@ -618,12 +618,12 @@ class SetupUtils
public static function CheckGraphviz($sGraphvizPath)
{
$oResult = null;
SetupPage::log('Info - CheckGraphviz');
SetupLog::Ok('Info - CheckGraphviz');
// availability of exec()
//
$aDisabled = explode(', ', ini_get('disable_functions'));
SetupPage::log('Info - PHP functions disabled: '.implode(', ', $aDisabled));
SetupLog::Ok('Info - PHP functions disabled: '.implode(', ', $aDisabled));
if (in_array('exec', $aDisabled))
{
$aResult[] = new CheckResult(CheckResult::ERROR, "The PHP exec() function has been disabled on this server");
@@ -653,7 +653,7 @@ class SetupUtils
}
foreach($aOutput as $sLine)
{
SetupPage::log('Info - '.$sGraphvizPath.' -V said: '.$sLine);
SetupLog::Ok('Info - '.$sGraphvizPath.' -V said: '.$sLine);
}
return $oResult;
@@ -726,11 +726,11 @@ class SetupUtils
{
if (!unlink($dir.'/'.$file))
{
SetupPage::log("Warning - FAILED to remove file '$dir/$file'");
SetupLog::Ok("Warning - FAILED to remove file '$dir/$file'");
}
else if (file_exists($dir.'/'.$file))
{
SetupPage::log("Warning - FAILED to remove file '$dir/.$file'");
SetupLog::Ok("Warning - FAILED to remove file '$dir/.$file'");
}
}
}
@@ -2115,7 +2115,7 @@ JS
{
if (class_exists('SetupPage'))
{
SetupPage::log($sText);
SetupLog::Ok($sText);
}
else
{

View File

@@ -193,7 +193,7 @@ class XMLDataLoader
{
if (!MetaModel::IsValidClass($sClass))
{
SetupPage::log_error("Unknown class - $sClass");
SetupLog::Error("Unknown class - $sClass");
throw(new Exception("Unknown class - $sClass"));
}
@@ -245,7 +245,7 @@ class XMLDataLoader
else
{
$sMsg = "Ext key not reconcilied - $sClass/$iSrcId - $sAttCode: '".$sQuery."' - found $iMatches matche(s)";
SetupPage::log_error($sMsg);
SetupLog::Error($sMsg);
$this->m_aErrors[] = $sMsg;
$iExtKey = 0;
}
@@ -291,7 +291,7 @@ class XMLDataLoader
{
// $res contains the error description
$sMsg = "Value not allowed - $sClass/$iSrcId - $sAttCode: '".$oSubNode."' ; $res";
SetupPage::log_error($sMsg);
SetupLog::Error($sMsg);
$this->m_aErrors[] = $sMsg;
}
$oTargetObj->Set($sAttCode, $value);
@@ -378,7 +378,7 @@ class XMLDataLoader
}
catch(Exception $e)
{
SetupPage::log_error("An object could not be recorded - $sClass/$iSrcId - ".$e->getMessage());
SetupLog::Error("An object could not be recorded - $sClass/$iSrcId - ".$e->getMessage());
$this->m_aErrors[] = "An object could not be recorded - $sClass/$iSrcId - ".$e->getMessage();
}
$aParentClasses = MetaModel::EnumParentClasses($sClass);
@@ -417,7 +417,7 @@ class XMLDataLoader
if ($iExtKey == 0)
{
$sMsg = "unresolved extkey in $sClass::".$oTargetObj->GetKey()."(".$oTargetObj->GetName().")::$sAttCode=$sTargetClass::$iTempKey";
SetupPage::log_warning($sMsg);
SetupLog::Warning($sMsg);
$this->m_aWarnings[] = $sMsg;
//echo "<pre>aKeys[".$sTargetClass."]:\n";
//print_r($this->m_aKeys[$sTargetClass]);