mirror of
https://github.com/Combodo/iTop.git
synced 2026-02-13 07:24:13 +01:00
Added a warning when upgrading the application while a CRON is being executed on the same DB
SVN:trunk[3239]
This commit is contained in:
@@ -34,7 +34,7 @@ class iTopMutex
|
|||||||
protected $bLocked; // Whether or not this instance of the Mutex is locked
|
protected $bLocked; // Whether or not this instance of the Mutex is locked
|
||||||
static protected $aAcquiredLocks = array(); // Number of instances of the Mutex, having the lock, in this page
|
static protected $aAcquiredLocks = array(); // Number of instances of the Mutex, having the lock, in this page
|
||||||
|
|
||||||
public function __construct($sName)
|
public function __construct($sName, $sDBHost = null, $sDBUser = null, $sDBPwd = null)
|
||||||
{
|
{
|
||||||
// Compute the name of a lock for mysql
|
// Compute the name of a lock for mysql
|
||||||
// Note: the name is server-wide!!!
|
// Note: the name is server-wide!!!
|
||||||
@@ -49,7 +49,10 @@ class iTopMutex
|
|||||||
// It is a MUST to create a dedicated session each time a lock is required, because
|
// It is a MUST to create a dedicated session each time a lock is required, because
|
||||||
// using GET_LOCK anytime on the same session will RELEASE the current and unique session lock (known issue)
|
// using GET_LOCK anytime on the same session will RELEASE the current and unique session lock (known issue)
|
||||||
$oConfig = utils::GetConfig();
|
$oConfig = utils::GetConfig();
|
||||||
$this->InitMySQLSession($oConfig->GetDBHost(), $oConfig->GetDBUser(), $oConfig->GetDBPwd());
|
$sDBHost = is_null($sDBHost) ? $oConfig->GetDBHost() : $sDBHost;
|
||||||
|
$sDBUser = is_null($sDBUser) ? $oConfig->GetDBUser() : $sDBUser;
|
||||||
|
$sDBPwd = is_null($sDBPwd) ? $oConfig->GetDBPwd() : $sDBPwd;
|
||||||
|
$this->InitMySQLSession($sDBHost, $sDBUser, $sDBPwd);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function __destruct()
|
public function __destruct()
|
||||||
|
|||||||
@@ -26,6 +26,7 @@ require_once(APPROOT.'setup/setuputils.class.inc.php');
|
|||||||
require_once(APPROOT.'setup/parameters.class.inc.php');
|
require_once(APPROOT.'setup/parameters.class.inc.php');
|
||||||
require_once(APPROOT.'setup/applicationinstaller.class.inc.php');
|
require_once(APPROOT.'setup/applicationinstaller.class.inc.php');
|
||||||
require_once(APPROOT.'setup/parameters.class.inc.php');
|
require_once(APPROOT.'setup/parameters.class.inc.php');
|
||||||
|
require_once(APPROOT.'core/mutex.class.inc.php');
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* First step of the iTop Installation Wizard: Welcome screen
|
* First step of the iTop Installation Wizard: Welcome screen
|
||||||
@@ -605,7 +606,22 @@ EOF
|
|||||||
$('input[name=upgrade_type]').bind('click change', function() { WizardUpdateButtons(); });
|
$('input[name=upgrade_type]').bind('click change', function() { WizardUpdateButtons(); });
|
||||||
EOF
|
EOF
|
||||||
);
|
);
|
||||||
}
|
|
||||||
|
$oMutex = new iTopMutex(
|
||||||
|
'cron.'.$this->oWizard->GetParameter('db_name', '').'_'.$this->oWizard->GetParameter('db_prefix', ''),
|
||||||
|
$this->oWizard->GetParameter('db_server', ''),
|
||||||
|
$this->oWizard->GetParameter('db_user', ''),
|
||||||
|
$this->oWizard->GetParameter('db_pwd', '')
|
||||||
|
);
|
||||||
|
if ($oMutex->TryLock())
|
||||||
|
{
|
||||||
|
$oMutex->Unlock();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$oPage->p("<img src=\"../images/error.png\"/> An iTop CRON process is being executed on the target database. It is highly recommended to stop any iTop CRON process prior to running the setup program.");
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function CanMoveForward()
|
public function CanMoveForward()
|
||||||
@@ -1791,7 +1807,7 @@ EOF
|
|||||||
$aInstallParams = $this->BuildConfig();
|
$aInstallParams = $this->BuildConfig();
|
||||||
|
|
||||||
$sMode = $aInstallParams['mode'];
|
$sMode = $aInstallParams['mode'];
|
||||||
|
|
||||||
$sPreinstallationPhase = '';
|
$sPreinstallationPhase = '';
|
||||||
|
|
||||||
$sDestination = ITOP_APPLICATION.(($sMode == 'install') ? ' version '.ITOP_VERSION.' is about to be installed ' : ' is about to be upgraded ');
|
$sDestination = ITOP_APPLICATION.(($sMode == 'install') ? ' version '.ITOP_VERSION.' is about to be installed ' : ' is about to be upgraded ');
|
||||||
|
|||||||
Reference in New Issue
Block a user