mirror of
https://github.com/Combodo/iTop.git
synced 2026-05-17 06:18:44 +02:00
enable logs + ci debugging
This commit is contained in:
@@ -93,7 +93,7 @@ class CronTest extends ItopDataTestCase
|
||||
$this->AddLoginModeAndSaveConfiguration('form');
|
||||
$this->CreateUserWithProfiles([self::$aURP_Profiles['REST Services User']]);
|
||||
|
||||
$sLogFileName = "crontest_".uniqid();
|
||||
$sLogFileName = "crontest_".uniqid().'.log';
|
||||
$aPostFields = [
|
||||
'version' => '1.3',
|
||||
'auth_user' => static::$sLogin,
|
||||
@@ -115,7 +115,7 @@ class CronTest extends ItopDataTestCase
|
||||
$this->AddLoginModeAndSaveConfiguration('basic');
|
||||
$this->CreateUserWithProfiles([self::$aURP_Profiles['REST Services User']]);
|
||||
|
||||
$sLogFileName = "crontest_".uniqid();
|
||||
$sLogFileName = "crontest_".uniqid().'.log';
|
||||
$aPostFields = [
|
||||
'version' => '1.3',
|
||||
'verbose' => 1,
|
||||
@@ -140,7 +140,7 @@ class CronTest extends ItopDataTestCase
|
||||
$this->AddLoginModeAndSaveConfiguration('url');
|
||||
$this->CreateUserWithProfiles([self::$aURP_Profiles['REST Services User']]);
|
||||
|
||||
$sLogFileName = "crontest_".uniqid();
|
||||
$sLogFileName = "crontest_".uniqid().'.log';
|
||||
$aPostFields = [
|
||||
'version' => '1.3',
|
||||
'verbose' => 1,
|
||||
@@ -177,7 +177,7 @@ class CronTest extends ItopDataTestCase
|
||||
{
|
||||
$this->CreateUserWithProfiles([self::$aURP_Profiles['Administrator']]);
|
||||
|
||||
$oLoginMode = new $sLoginModeClass;
|
||||
$oLoginMode = new $sLoginModeClass();
|
||||
$sUserLogin = $oLoginMode->GetUserLogin([static::$sLogin, static::$sPassword]);
|
||||
$this->assertEquals(static::$sLogin, $sUserLogin);
|
||||
}
|
||||
|
||||
@@ -36,6 +36,8 @@ if (file_exists(READONLY_MODE_FILE)) {
|
||||
require_once(APPROOT.'/application/application.inc.php');
|
||||
require_once(APPROOT.'/core/background.inc.php');
|
||||
|
||||
IssueLog::Enable(APPROOT.'log/error.log');
|
||||
|
||||
$sConfigFile = APPCONF.ITOP_DEFAULT_ENV.'/'.ITOP_CONFIG_FILE;
|
||||
if (!file_exists($sConfigFile)) {
|
||||
echo "iTop is not yet installed. Exiting...\n";
|
||||
|
||||
@@ -31,6 +31,7 @@ function IsCronStartingLine(string $sLine): bool
|
||||
return preg_match('/^Starting: /', $sLine);
|
||||
}
|
||||
|
||||
IssueLog::Enable(APPROOT.'log/error.log');
|
||||
try {
|
||||
$oCtx = new ContextTag(ContextTag::TAG_CRON);
|
||||
LoginWebPage::ResetSession();
|
||||
@@ -65,6 +66,7 @@ try {
|
||||
}
|
||||
|
||||
$sPHPExec = trim(\MetaModel::GetConfig()->Get('php_path'));
|
||||
$aCronValues[] = "--auth_info=".escapeshellarg('XXXX');
|
||||
$sCliForLogs = GetCliCommand($sPHPExec, $sLogFile, $aCronValues).PHP_EOL;
|
||||
IssueLog::Info("launch cron asynchronously/remotely", null, ['cli' => $sCliForLogs]);
|
||||
|
||||
@@ -91,7 +93,11 @@ try {
|
||||
$oP->SetOutputDataOnly(true);
|
||||
$oP->Output();
|
||||
} catch (Exception $e) {
|
||||
\IssueLog::Error("Cannot run cron", null, ['msg' => $e->getMessage(), 'stack' => $e->getTraceAsString()]);
|
||||
\IssueLog::Error('Cannot run cron', null, ['msg' => $e->getMessage(), 'stack' => $e->getTraceAsString()]);
|
||||
\IssueLog::Error('Cannot run cron $_SERVER', null, $_SERVER);
|
||||
\IssueLog::Error('Cannot run cron $_REQUEST', null, $_REQUEST);
|
||||
\IssueLog::Error('Cannot run cron $_SESSION', null, $_SESSION);
|
||||
|
||||
http_response_code(500);
|
||||
$oP = new JsonPage();
|
||||
$oP->add_header('Access-Control-Allow-Origin: *');
|
||||
|
||||
Reference in New Issue
Block a user