mirror of
https://github.com/Combodo/iTop.git
synced 2026-02-13 07:24:13 +01:00
Merge remote-tracking branch 'origin/feature/3.2-post-beta' into develop
This commit is contained in:
@@ -29,6 +29,100 @@ use Combodo\iTop\Core\DbConnectionWrapper;
|
|||||||
require_once('MyHelpers.class.inc.php');
|
require_once('MyHelpers.class.inc.php');
|
||||||
require_once(APPROOT.'core/kpi.class.inc.php');
|
require_once(APPROOT.'core/kpi.class.inc.php');
|
||||||
|
|
||||||
|
class MySQLException extends CoreException
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* MySQLException constructor.
|
||||||
|
*
|
||||||
|
* @param string $sIssue
|
||||||
|
* @param array $aContext
|
||||||
|
* @param \Exception $oException
|
||||||
|
* @param \mysqli $oMysqli to use when working with a custom mysqli instance
|
||||||
|
*/
|
||||||
|
public function __construct($sIssue, $aContext, $oException = null, $oMysqli = null)
|
||||||
|
{
|
||||||
|
|
||||||
|
if ($oException != null)
|
||||||
|
{
|
||||||
|
$aContext['mysql_errno'] = $oException->getCode();
|
||||||
|
$this->code = $oException->getCode();
|
||||||
|
$aContext['mysql_error'] = $oException->getMessage();
|
||||||
|
}
|
||||||
|
else if ($oMysqli != null)
|
||||||
|
{
|
||||||
|
$aContext['mysql_errno'] = $oMysqli->errno;
|
||||||
|
$this->code = $oMysqli->errno;
|
||||||
|
$aContext['mysql_error'] = $oMysqli->error;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$aContext['mysql_errno'] = CMDBSource::GetErrNo();
|
||||||
|
$this->code = CMDBSource::GetErrNo();
|
||||||
|
$aContext['mysql_error'] = CMDBSource::GetError();
|
||||||
|
}
|
||||||
|
parent::__construct($sIssue, $aContext);
|
||||||
|
//if is connection error, don't log the default message with password in
|
||||||
|
if (mysqli_connect_errno()) {
|
||||||
|
error_log($this->message);
|
||||||
|
error_reporting(0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Class MySQLQueryHasNoResultException
|
||||||
|
*
|
||||||
|
* @since 2.5.0
|
||||||
|
*/
|
||||||
|
class MySQLQueryHasNoResultException extends MySQLException
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Class MySQLHasGoneAwayException
|
||||||
|
*
|
||||||
|
* @since 2.5.0
|
||||||
|
* @see itop bug 1195
|
||||||
|
* @see https://dev.mysql.com/doc/refman/5.7/en/gone-away.html
|
||||||
|
*/
|
||||||
|
class MySQLHasGoneAwayException extends MySQLException
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* can not be a constant before PHP 5.6 (http://php.net/manual/fr/language.oop5.constants.php)
|
||||||
|
*
|
||||||
|
* @return int[]
|
||||||
|
*/
|
||||||
|
public static function getErrorCodes()
|
||||||
|
{
|
||||||
|
return array(
|
||||||
|
2006,
|
||||||
|
2013,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function __construct($sIssue, $aContext)
|
||||||
|
{
|
||||||
|
parent::__construct($sIssue, $aContext, null);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @since 2.7.0 N°679
|
||||||
|
*/
|
||||||
|
class MySQLNoTransactionException extends MySQLException
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @since 2.7.8 3.0.3 3.1.0 N°5538
|
||||||
|
*/
|
||||||
|
class MySQLTransactionNotClosedException extends MySQLException
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* CMDBSource
|
* CMDBSource
|
||||||
@@ -1169,8 +1263,8 @@ class CMDBSource
|
|||||||
*/
|
*/
|
||||||
public static function IsSameFieldTypes($sItopGeneratedFieldType, $sDbFieldType)
|
public static function IsSameFieldTypes($sItopGeneratedFieldType, $sDbFieldType)
|
||||||
{
|
{
|
||||||
list($sItopFieldDataType, $sItopFieldTypeOptions, $sItopFieldOtherOptions) = static::GetFieldDataTypeAndOptions($sItopGeneratedFieldType);
|
[$sItopFieldDataType, $sItopFieldTypeOptions, $sItopFieldOtherOptions] = static::GetFieldDataTypeAndOptions($sItopGeneratedFieldType);
|
||||||
list($sDbFieldDataType, $sDbFieldTypeOptions, $sDbFieldOtherOptions) = static::GetFieldDataTypeAndOptions($sDbFieldType);
|
[$sDbFieldDataType, $sDbFieldTypeOptions, $sDbFieldOtherOptions] = static::GetFieldDataTypeAndOptions($sDbFieldType);
|
||||||
|
|
||||||
if (strcasecmp($sItopFieldDataType, $sDbFieldDataType) !== 0)
|
if (strcasecmp($sItopFieldDataType, $sDbFieldDataType) !== 0)
|
||||||
{
|
{
|
||||||
@@ -1603,7 +1697,19 @@ class CMDBSource
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
public static function GetClusterNb()
|
||||||
|
{
|
||||||
|
$result = 0;
|
||||||
|
$sSql = "SHOW STATUS LIKE 'wsrep_cluster_size';";
|
||||||
|
$aRows = self::QueryToArray($sSql);
|
||||||
|
if (count($aRows) > 0)
|
||||||
|
{
|
||||||
|
$result = $aRows[0]['Value'];
|
||||||
|
}
|
||||||
|
return intval($result);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
* @see https://dev.mysql.com/doc/refman/5.7/en/charset-database.html
|
* @see https://dev.mysql.com/doc/refman/5.7/en/charset-database.html
|
||||||
* @return string query to upgrade database charset and collation if needed, null if not
|
* @return string query to upgrade database charset and collation if needed, null if not
|
||||||
* @throws \MySQLException
|
* @throws \MySQLException
|
||||||
|
|||||||
@@ -53,6 +53,7 @@
|
|||||||
"scripts": {
|
"scripts": {
|
||||||
"styles": "cp -r src/resources/styles/ build/styles",
|
"styles": "cp -r src/resources/styles/ build/styles",
|
||||||
"build": "webpack --mode production && npm run styles",
|
"build": "webpack --mode production && npm run styles",
|
||||||
|
"dev": "webpack --mode development --watch && npm run styles",
|
||||||
"postbuild": "tsc --declaration --declarationDir build --stripInternal --emitDeclarationOnly"
|
"postbuild": "tsc --declaration --declarationDir build --stripInternal --emitDeclarationOnly"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -34,17 +34,21 @@ export default class Maximize extends Plugin {
|
|||||||
|
|
||||||
this.listenTo( oButton, 'execute', () => {
|
this.listenTo( oButton, 'execute', () => {
|
||||||
if(oEditor.ui.element !== null){
|
if(oEditor.ui.element !== null){
|
||||||
|
let CKEditorPoweredButton = document.getElementsByClassName('ck-powered-by-balloon');
|
||||||
if(oButton.isOn){
|
if(oButton.isOn){
|
||||||
oInitialParentElement.append(oEditor.ui.element);
|
oInitialParentElement.append(oEditor.ui.element);
|
||||||
oEditor.ui.element.classList.remove('cke-maximized');
|
oEditor.ui.element.classList.remove('cke-maximized');
|
||||||
document.body.classList.remove('cke-maximized');
|
document.body.classList.remove('cke-maximized');
|
||||||
oButton.icon = sMaximizeIconSVG;
|
oButton.icon = sMaximizeIconSVG;
|
||||||
|
CKEditorPoweredButton.item(0)?.setAttribute('style', 'display: block');
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
oInitialParentElement = oEditor.ui.element.parentElement ?? oInitialParentElement;
|
oInitialParentElement = oEditor.ui.element.parentElement ?? oInitialParentElement;
|
||||||
oEditor.ui.element.remove();
|
oEditor.ui.element.remove();
|
||||||
document.body.append(oEditor.ui.element);
|
document.body.append(oEditor.ui.element);
|
||||||
document.body.classList.add('cke-maximized'); // Add class to body to prevent scrollbars
|
document.body.classList.add('cke-maximized'); // Add class to body to prevent scrollbars
|
||||||
|
// Same behaviour between Chrome and Firefox (Firefox has a bug with the balloon remaning visible in the middle of the screen when the editor is maximized)
|
||||||
|
CKEditorPoweredButton.item(0)?.setAttribute('style', 'display: none');
|
||||||
oEditor.ui.element.classList.add('cke-maximized');
|
oEditor.ui.element.classList.add('cke-maximized');
|
||||||
oButton.icon = sMinimizeIconSVG;
|
oButton.icon = sMinimizeIconSVG;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1297,6 +1297,12 @@ EOF
|
|||||||
$aResult['checks'][] = new CheckResult(CheckResult::INFO, "MySQL server's max_connections is set to $iMaxConnections.");
|
$aResult['checks'][] = new CheckResult(CheckResult::INFO, "MySQL server's max_connections is set to $iMaxConnections.");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$iClusters = $oDBSource->GetClusterNb();
|
||||||
|
if ($iClusters > 0) {
|
||||||
|
SetupLog::Warning('Warning - Galera can lead to malfunctions and data corruption. Combodo does not support this type of infrastructure.');
|
||||||
|
$aResult['checks'][] = new CheckResult(CheckResult::WARNING, 'Galera can lead to malfunctions and data corruption. Combodo does not support this type of infrastructure.');
|
||||||
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
$aResult['databases'] = $oDBSource->ListDB();
|
$aResult['databases'] = $oDBSource->ListDB();
|
||||||
}
|
}
|
||||||
@@ -1412,6 +1418,8 @@ EOF
|
|||||||
|
|
||||||
public static function AsyncCheckDB($oPage, $aParameters)
|
public static function AsyncCheckDB($oPage, $aParameters)
|
||||||
{
|
{
|
||||||
|
SetupPage::log('Info - CheckDB');
|
||||||
|
|
||||||
$sDBServer = $aParameters['db_server'];
|
$sDBServer = $aParameters['db_server'];
|
||||||
$sDBUser = $aParameters['db_user'];
|
$sDBUser = $aParameters['db_user'];
|
||||||
$sDBPwd = $aParameters['db_pwd'];
|
$sDBPwd = $aParameters['db_pwd'];
|
||||||
|
|||||||
Reference in New Issue
Block a user