N°3436 fix Setup

Was blocked because using iTop 3.0.0 with datamodels/2.x dir : \SetupUtils::GetCompatibleDataModelDir wasn't ok with that :o)
This method is no more present, and we're calling \SetupUtils::GetLatestDataModelDir only
In other words, we're picking the latest datamodel/*.x dir (greatest number)
This commit is contained in:
Pierre Goiffon
2020-11-16 17:51:52 +01:00
parent c2e31de263
commit 07cc8bf508
2 changed files with 5 additions and 33 deletions

View File

@@ -1915,19 +1915,6 @@ JS
return false;
}
public static function GetCompatibleDataModelDir($sInstalledVersion)
{
if (preg_match('/^([0-9]+)\./', $sInstalledVersion, $aMatches)) {
$sMajorVersion = $aMatches[1];
$sDir = APPROOT.'datamodels/'.$sMajorVersion.'.x/';
if (is_dir($sDir)) {
return $sDir;
}
}
return false;
}
public static function GetDataModelVersion($sDatamodelDir)
{
$sVersionFile = $sDatamodelDir.'version.xml';

View File

@@ -532,33 +532,18 @@ EOF
$oPage->add("<h2>Information about the upgrade from version $sInstalledVersion to ".ITOP_VERSION_FULL."</h2>");
if ($sInstalledVersion == ITOP_VERSION_FULL)
{
if ($sInstalledVersion == ITOP_VERSION_FULL) {
// Reinstalling the same version let's skip the license agreement...
$bDisplayLicense = false;
}
$this->oWizard->SetParameter('license', $bDisplayLicense); // Remember for later
if ($sInstalledDataModelVersion == '$ITOP_VERSION$.$WCREV$')
{
// Special case for upgrading some development versions (temporary)
$sCompatibleDMDir = SetupUtils::GetLatestDataModelDir();
$sInstalledDataModelVersion = SetupUtils::GetDataModelVersion($sCompatibleDMDir);
}
else
{
$sCompatibleDMDir = SetupUtils::GetCompatibleDataModelDir($sInstalledDataModelVersion);
}
if ($sCompatibleDMDir === false)
{
$sCompatibleDMDir = SetupUtils::GetLatestDataModelDir();
if ($sCompatibleDMDir === false) {
// No compatible version exists... cannot upgrade. Either it is too old, or too new (downgrade !)
$this->bCanMoveForward = false;
$oPage->p("The current version of ".ITOP_APPLICATION." (".ITOP_VERSION_FULL.") does not seem to be compatible with the installed version ($sInstalledVersion).");
$oPage->p("The upgrade cannot continue, sorry.");
}
else
{
$oPage->p("No datamodel directory found.");
} else {
$sUpgradeDMVersion = SetupUtils::GetDataModelVersion($sCompatibleDMDir);
$sPreviousSourceDir = isset($aInstalledInfo['source_dir']) ? $aInstalledInfo['source_dir'] : 'modules';
$aChanges = false;