mirror of
https://github.com/Combodo/iTop.git
synced 2026-05-20 07:42:17 +02:00
Feature/merge 3 0 develop (#298)
* merging 3.0 into develop * N°5102 - Allow to send emails (eg. notifications) using GSuite SMTP and OAuth * migration to iTop 3.1 Co-authored-by: Eric Espie <eric.espie@combodo.com>
This commit is contained in:
@@ -9,7 +9,6 @@
|
||||
|
||||
namespace Combodo\iTop\CoreUpdate\Service;
|
||||
|
||||
use Combodo\iTop\FilesInformation\Service\FileIntegrityException;
|
||||
use Combodo\iTop\FilesInformation\Service\FilesIntegrity;
|
||||
use DBBackup;
|
||||
use Dict;
|
||||
@@ -539,9 +538,6 @@ final class CoreUpdater
|
||||
$sRootPath = self::UPDATE_DIR.'web/';
|
||||
FilesIntegrity::CheckInstallationIntegrity($sRootPath);
|
||||
|
||||
///Check new modules
|
||||
self::CheckNewModules($sRootPath);
|
||||
|
||||
SetupLog::Info('itop-core-update: Files integrity OK');
|
||||
} catch (Exception $e)
|
||||
{
|
||||
@@ -609,38 +605,4 @@ final class CoreUpdater
|
||||
throw $e;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if new modules (not already installed) are present, and throw an exception if that is the case as core update doesn't know how to install them automatically for know
|
||||
*
|
||||
* @param string $sRootPath
|
||||
*
|
||||
* @throws \ApplicationException
|
||||
* @since 2.7.7 3.0.1
|
||||
*/
|
||||
private static function CheckNewModules($sRootPath)
|
||||
{
|
||||
$aFilesInfo = FilesIntegrity::GetInstalledFiles($sRootPath.'manifest.xml');
|
||||
|
||||
if ($aFilesInfo === false) {
|
||||
throw new FileIntegrityException(Dict::Format('FilesInformation:Error:MissingFile', 'manifest.xml'));
|
||||
}
|
||||
|
||||
@clearstatcache();
|
||||
$sSourceDir = MetaModel::GetConfig()->Get('source_dir');
|
||||
foreach ($aFilesInfo as $aFileInfo) {
|
||||
if (strpos($aFileInfo['path'], $sSourceDir) === 0) {
|
||||
$aFilePath = explode('/', $aFileInfo['path']);
|
||||
$sFolderPath = $aFilePath[0].'/'.$aFilePath[1].'/'.$aFilePath[2];
|
||||
//if module don't already exist in itop and if module listed in manifest.xml is included in zip
|
||||
if (!is_dir(APPROOT.'/'.$sFolderPath) && !is_file(APPROOT.'/'.$sFolderPath)
|
||||
&& is_dir($sRootPath.'/'.$sFolderPath)) {
|
||||
$sLink = utils::GetAbsoluteUrlAppRoot().'setup/';
|
||||
$sLinkManualUpdate = 'https://www.itophub.io/wiki/page?id='.utils::GetItopVersionWikiSyntax().'%3Ainstall%3Aupgrading_itop#manually';
|
||||
throw new FileIntegrityException(Dict::Format('iTopUpdate:UI:CannotUpdateNewModules' , $sLink, $sLinkManualUpdate));
|
||||
}
|
||||
}
|
||||
// Packed with missing files...
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -11,6 +11,7 @@ require_once(APPROOT."setup/runtimeenv.class.inc.php");
|
||||
|
||||
use Config;
|
||||
use Exception;
|
||||
use ModelFactory;
|
||||
use RunTimeEnvironment;
|
||||
use SetupUtils;
|
||||
|
||||
@@ -126,4 +127,38 @@ class RunTimeEnvironmentCoreUpdater extends RunTimeEnvironment
|
||||
}
|
||||
throw new Exception('No configuration file available');
|
||||
}
|
||||
|
||||
protected function GetMFModulesToCompile($sSourceEnv, $sSourceDir)
|
||||
{
|
||||
$aRet = parent::GetMFModulesToCompile($sSourceEnv, $sSourceDir);
|
||||
|
||||
// Add new mandatory modules from datamodel 2.x only
|
||||
$sSourceDirFull = APPROOT.$sSourceDir;
|
||||
if (!is_dir($sSourceDirFull))
|
||||
{
|
||||
throw new Exception("The source directory '$sSourceDirFull' does not exist (or could not be read)");
|
||||
}
|
||||
$aDirsToCompile = [$sSourceDirFull];
|
||||
|
||||
$oFactory = new ModelFactory($aDirsToCompile);
|
||||
$aModules = $oFactory->FindModules();
|
||||
$aAvailableModules = [];
|
||||
/** @var \MFModule $oModule */
|
||||
foreach ($aModules as $oModule) {
|
||||
$aAvailableModules[$oModule->GetName()] = $oModule;
|
||||
}
|
||||
// TODO check the auto-selected modules here
|
||||
foreach($this->oExtensionsMap->GetAllExtensions() as $oExtension) {
|
||||
if ($oExtension->bMarkedAsChosen) {
|
||||
foreach ($oExtension->aModules as $sModuleName) {
|
||||
if (!isset($aRet[$sModuleName]) && isset($aAvailableModules[$sModuleName])) {
|
||||
$aRet[$sModuleName] = $aAvailableModules[$sModuleName];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $aRet;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user