mirror of
https://github.com/Combodo/iTop.git
synced 2026-05-20 07:42:17 +02:00
Merge remote-tracking branch 'origin/support/2.7' into support/3.0
# Conflicts: # datamodels/2.x/itop-core-update/dictionaries/cs.dict.itop-core-update.php # datamodels/2.x/itop-core-update/dictionaries/da.dict.itop-core-update.php # datamodels/2.x/itop-core-update/dictionaries/de.dict.itop-core-update.php # datamodels/2.x/itop-core-update/dictionaries/en.dict.itop-core-update.php # datamodels/2.x/itop-core-update/dictionaries/es_cr.dict.itop-core-update.php # datamodels/2.x/itop-core-update/dictionaries/fr.dict.itop-core-update.php # datamodels/2.x/itop-core-update/dictionaries/hu.dict.itop-core-update.php # datamodels/2.x/itop-core-update/dictionaries/it.dict.itop-core-update.php # datamodels/2.x/itop-core-update/dictionaries/ja.dict.itop-core-update.php # datamodels/2.x/itop-core-update/dictionaries/nl.dict.itop-core-update.php # datamodels/2.x/itop-core-update/dictionaries/ru.dict.itop-core-update.php # datamodels/2.x/itop-core-update/dictionaries/sk.dict.itop-core-update.php # datamodels/2.x/itop-core-update/dictionaries/tr.dict.itop-core-update.php # datamodels/2.x/itop-core-update/dictionaries/zh_cn.dict.itop-core-update.php # datamodels/2.x/itop-core-update/pt_br.dict.itop-core-update.php # datamodels/2.x/itop-core-update/view/SelectUpdateFile.html.twig # datamodels/2.x/itop-datacenter-mgmt/dictionaries/pl.dict.itop-datacenter-mgmt.php # datamodels/2.x/itop-endusers-devices/dictionaries/pl.dict.itop-endusers-devices.php # datamodels/2.x/itop-files-information/src/Service/FilesIntegrity.php
This commit is contained in:
@@ -56,7 +56,7 @@ class FilesInformation
|
||||
|
||||
try
|
||||
{
|
||||
FilesIntegrity::CheckInstallationIntegrity();
|
||||
FilesIntegrity::CheckInstallationIntegrity(APPROOT, false);
|
||||
}
|
||||
catch (FileIntegrityException $e)
|
||||
{
|
||||
|
||||
@@ -13,8 +13,6 @@ use DOMDocument;
|
||||
use DOMElement;
|
||||
use DOMNode;
|
||||
use DOMXPath;
|
||||
use MetaModel;
|
||||
use utils;
|
||||
|
||||
class FilesIntegrity
|
||||
{
|
||||
@@ -81,12 +79,12 @@ class FilesIntegrity
|
||||
* Check that files present in iTop folder corresponds to the manifest
|
||||
*
|
||||
* @param string $sRootPath
|
||||
* @param bool $bCheckNewModule
|
||||
* @param bool $bExitAtFirstError
|
||||
*
|
||||
* @throws \Combodo\iTop\FilesInformation\Service\FileIntegrityException
|
||||
* @since 3.0.1 Add $bCheckNewModule parameter
|
||||
* @since 2.7.7 3.0.1 Add $bExitAtFirstError parameter
|
||||
*/
|
||||
public static function CheckInstallationIntegrity($sRootPath = APPROOT, $bCheckNewModule = false)
|
||||
public static function CheckInstallationIntegrity($sRootPath = APPROOT, $bExitAtFirstError = true)
|
||||
{
|
||||
$aFilesInfo = FilesIntegrity::GetInstalledFiles($sRootPath.'manifest.xml');
|
||||
|
||||
@@ -95,8 +93,10 @@ class FilesIntegrity
|
||||
throw new FileIntegrityException(Dict::Format('FilesInformation:Error:MissingFile', 'manifest.xml'));
|
||||
}
|
||||
|
||||
$bHasErrors = false;
|
||||
$sErrorFiles ="";
|
||||
|
||||
@clearstatcache();
|
||||
$sSourceDir = MetaModel::GetConfig()->Get('source_dir');
|
||||
foreach ($aFilesInfo as $aFileInfo)
|
||||
{
|
||||
$sFile = $sRootPath.$aFileInfo['path'];
|
||||
@@ -108,20 +108,19 @@ class FilesIntegrity
|
||||
$sChecksum = md5($sContent);
|
||||
if (($iSize != $aFileInfo['size']) || ($sChecksum != $aFileInfo['md5']))
|
||||
{
|
||||
throw new FileIntegrityException(Dict::Format('FilesInformation:Error:CorruptedFile', $sFile));
|
||||
}
|
||||
}
|
||||
if($bCheckNewModule && strpos($aFileInfo['path'],$sSourceDir) === 0){
|
||||
$aFilePath = explode('/',$aFileInfo['path']);
|
||||
$sFolderPath = $aFilePath[0].'/'.$aFilePath[1].'/'.$aFilePath[2];
|
||||
if ( !(is_dir(APPROOT.'/'.$sFolderPath)) && !(is_file(APPROOT.'/'.$sFolderPath)) ){
|
||||
$sLink = utils::GetAbsoluteUrlAppRoot().'setup/';
|
||||
$sLinkManualUpdate = 'https://www.itophub.io/wiki/page?id='.utils::GetItopVersionWikiSyntax().'%3Ainstall%3Aupgrading_itop#manually';
|
||||
throw new FileIntegrityException(Dict::Format('FilesInformation:Error:CannotUpdateNewModules', $sLink, $sLinkManualUpdate));
|
||||
if($bExitAtFirstError) {
|
||||
throw new FileIntegrityException(Dict::Format('FilesInformation:Error:CorruptedFile', $sFile));
|
||||
} else {
|
||||
$bHasErrors = true;
|
||||
$sErrorFiles .='<li> '.$aFileInfo['path'].'</li>';
|
||||
}
|
||||
}
|
||||
}
|
||||
// Packed with missing files...
|
||||
}
|
||||
if($bHasErrors){
|
||||
throw new FileIntegrityException(Dict::Format('FilesInformation:Error:ListCorruptedFile','<ul> '.$sErrorFiles.'</ul>'));
|
||||
}
|
||||
}
|
||||
|
||||
public static function IsInstallationConform($sRootPath, &$sErrorMsg)
|
||||
|
||||
Reference in New Issue
Block a user