mirror of
https://github.com/Combodo/iTop.git
synced 2026-02-13 07:24:13 +01:00
Merge remote-tracking branch 'origin/support/3.1' into support/3.2
This commit is contained in:
@@ -2099,8 +2099,16 @@ class RestUtils
|
|||||||
elseif (is_string($key))
|
elseif (is_string($key))
|
||||||
{
|
{
|
||||||
// OQL
|
// OQL
|
||||||
$oSearch = DBObjectSearch::FromOQL($key);
|
try {
|
||||||
}
|
$oSearch = DBObjectSearch::FromOQL($key);
|
||||||
|
} catch (Exception $e) {
|
||||||
|
throw new CoreOqlException('Query failed to execute', [
|
||||||
|
'query' => $key,
|
||||||
|
'exception_class' => get_class($e),
|
||||||
|
'exception_message' => $e->getMessage(),
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
throw new Exception("Wrong format for key");
|
throw new Exception("Wrong format for key");
|
||||||
|
|||||||
@@ -982,10 +982,13 @@ class ModelFactory
|
|||||||
$this->aDictKeys[$sLanguageCode][$sCode] = $oXmlEntry;
|
$this->aDictKeys[$sLanguageCode][$sCode] = $oXmlEntry;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
} catch (Exception|Error $e) // Error can occurs on eval() calls
|
||||||
catch (Exception $e) {
|
{
|
||||||
throw new Exception('Failed to load dictionary file "'.$sPHPFile.'", reason: '.$e->getMessage());
|
throw new DictException('Failed to load dictionary file "' . $sPHPFile . '"', [
|
||||||
}
|
'exception_class' => get_class($e),
|
||||||
|
'exception_msg' => $e->getMessage(),
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
catch (Exception $e) {
|
catch (Exception $e) {
|
||||||
|
|||||||
@@ -990,9 +990,18 @@ class SetupUtils
|
|||||||
return $f;
|
return $f;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param float $fBytes size in raw bytes, for example 162594750464.0
|
||||||
|
* @return string formatted string, for example "161.62 GB"
|
||||||
|
*
|
||||||
|
* @link https://en.wiktionary.org/wiki/byte byte and not Byte
|
||||||
|
* @link https://en.wikipedia.org/wiki/Kilobyte kB and not KB (IEC 80000-13)
|
||||||
|
* @link https://en.wiktionary.org/wiki/petabyte petabyte PB
|
||||||
|
* @link https://en.wiktionary.org/wiki/exabyte exabyte EB
|
||||||
|
*/
|
||||||
public static function HumanReadableSize($fBytes)
|
public static function HumanReadableSize($fBytes)
|
||||||
{
|
{
|
||||||
$aSizes = array('bytes', 'KB', 'MB', 'GB', 'TB', 'PB', 'HB');
|
$aSizes = array('bytes', 'kB', 'MB', 'GB', 'TB', 'PB', 'EB');
|
||||||
$index = 0;
|
$index = 0;
|
||||||
while (($fBytes > 1000) && ($index < count($aSizes))) {
|
while (($fBytes > 1000) && ($index < count($aSizes))) {
|
||||||
$index++;
|
$index++;
|
||||||
|
|||||||
Reference in New Issue
Block a user