mirror of
https://github.com/Combodo/iTop.git
synced 2026-03-01 23:24:12 +01:00
- DBObject::DBInsert(Tracked)NoReload() must be used when it is not required to use the object - MetaModel::GetObject() has a cache, the operation is 5 times faster - Changes tracking do not store the initial value, but only value changes Reworked the CSV import to have it rely on the bulk change API Bulk change to check the external keys (DB integrity) Replaced trigger_error (Core only!) by the use of Exceptions (still, some new Exception classes should be defined) Unit tests do display the call stack in a user friendly format SVN:code[52]
64 lines
1.4 KiB
PHP
64 lines
1.4 KiB
PHP
<?php
|
|
|
|
class CoreException extends Exception
|
|
{
|
|
public function __construct($sIssue, $aContextData = null, $sImpact = '')
|
|
{
|
|
$this->m_sIssue = $sIssue;
|
|
$this->m_sImpact = $sImpact;
|
|
$this->m_aContextData = $aContextData ? $aContextData : array();
|
|
|
|
$sMessage = $sIssue;
|
|
if (!empty($sImpact)) $sMessage .= "($sImpact)";
|
|
if (count($this->m_aContextData) > 0)
|
|
{
|
|
$sMessage .= ": ";
|
|
$aContextItems = array();
|
|
foreach($this->m_aContextData as $sKey => $value)
|
|
{
|
|
if (is_array($value))
|
|
{
|
|
$aPairs = array();
|
|
foreach($value as $key => $val)
|
|
{
|
|
if (is_array($val))
|
|
{
|
|
$aPairs[$key] = '('.implode(', ', $val).')';
|
|
}
|
|
else
|
|
{
|
|
$aPairs[$key] = $val;
|
|
}
|
|
}
|
|
$sValue = '{'.implode('; ', $aPairs).'}';
|
|
}
|
|
else
|
|
{
|
|
$sValue = $value;
|
|
}
|
|
$aContextItems[] = "$sKey = $sValue";
|
|
}
|
|
$sMessage .= implode(', ', $aContextItems);
|
|
}
|
|
parent::__construct($sMessage, 0);
|
|
}
|
|
|
|
public function getHtmlDesc($sHighlightHtmlBegin = '<b>', $sHighlightHtmlEnd = '</b>')
|
|
{
|
|
return $this->getMessage();
|
|
}
|
|
|
|
public function getTraceAsHtml()
|
|
{
|
|
$aBackTrace = $this->getTrace();
|
|
return MyHelpers::get_callstack_html(0, $this->getTrace());
|
|
// return "<pre>\n".$this->getTraceAsString()."</pre>\n";
|
|
}
|
|
}
|
|
|
|
class CoreWarning extends CoreException
|
|
{
|
|
}
|
|
|
|
?>
|