From 68895551b2942509423f8bd26d7be0243725a4bf Mon Sep 17 00:00:00 2001 From: Eric Date: Wed, 9 Oct 2019 12:11:17 +0200 Subject: [PATCH] =?UTF-8?q?N=C2=B02517=20-=20Supportability=20-=20system?= =?UTF-8?q?=20report=20(Added=20cron=20user)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- core/backgroundtask.class.inc.php | 3 ++- core/cmdbsource.class.inc.php | 8 ++++++++ webservices/cron.php | 2 ++ 3 files changed, 12 insertions(+), 1 deletion(-) diff --git a/core/backgroundtask.class.inc.php b/core/backgroundtask.class.inc.php index f46412cd5..db93f1310 100644 --- a/core/backgroundtask.class.inc.php +++ b/core/backgroundtask.class.inc.php @@ -55,6 +55,7 @@ class BackgroundTask extends DBObject MetaModel::Init_AddAttribute(new AttributeBoolean("running", array("allowed_values"=>null, "sql"=>"running", "default_value"=>false, "is_null_allowed"=>false, "depends_on"=>array()))); MetaModel::Init_AddAttribute(new AttributeEnum("status", array("allowed_values"=>new ValueSetEnum('active,paused'), "sql"=>"status", "default_value"=>'active', "is_null_allowed"=>false, "depends_on"=>array()))); + MetaModel::Init_AddAttribute(new AttributeString("system_user", array("allowed_values"=>null, "sql"=>"system_user", "default_value"=>null, "is_null_allowed"=>true, "depends_on"=>array()))); } public function ComputeDurations($fLatestDuration) @@ -73,4 +74,4 @@ class BackgroundTask extends DBObject } $this->Set('latest_run_duration', sprintf('%.3f',$fLatestDuration)); } -} \ No newline at end of file +} diff --git a/core/cmdbsource.class.inc.php b/core/cmdbsource.class.inc.php index 4f2d99a44..72d070d61 100644 --- a/core/cmdbsource.class.inc.php +++ b/core/cmdbsource.class.inc.php @@ -424,6 +424,14 @@ class CMDBSource return $aVersions[0]; } + /** + * @return string + */ + public static function GetServerInfo() + { + return mysqli_get_server_info ( self::$m_oMysqli ); + } + /** * Get the DB vendor between MySQL and its main forks * @return string diff --git a/webservices/cron.php b/webservices/cron.php index d84aa63ab..88ab503ac 100644 --- a/webservices/cron.php +++ b/webservices/cron.php @@ -91,6 +91,8 @@ function RunTask($oProcess, BackgroundTask $oTask, $oStartDate, $iTimeLimit) { // Record (when starting) that this task was started, just in case it crashes during the execution $oTask->Set('latest_run_date', $oDateStarted->format('Y-m-d H:i:s')); + // Record the current user running the cron + $oTask->Set('system_user', getenv("username")); $oTask->DBUpdate(); $sMessage = $oProcess->Process($iTimeLimit); }