mirror of
https://github.com/Combodo/iTop.git
synced 2026-02-13 07:24:13 +01:00
Fix PR remarks
This commit is contained in:
@@ -232,8 +232,12 @@ class DBRestore extends DBBackup
|
|||||||
$oIterator = new RecursiveIteratorIterator($oDirectoryIterator);
|
$oIterator = new RecursiveIteratorIterator($oDirectoryIterator);
|
||||||
foreach ($oIterator as $oFileInfo)
|
foreach ($oIterator as $oFileInfo)
|
||||||
{
|
{
|
||||||
if (in_array($oFileInfo->getFilename(), $aStandardFiles)) continue;
|
if (in_array($oFileInfo->getFilename(), $aStandardFiles)) {
|
||||||
if (strncmp($oFileInfo->getPathname(), $sDataDir.'/production-modules', strlen($sDataDir.'/production-modules')) == 0) continue;
|
continue;
|
||||||
|
}
|
||||||
|
if (strncmp($oFileInfo->getPathname(), $sDataDir.'/production-modules', strlen($sDataDir.'/production-modules')) == 0) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
$aExtraFiles[$oFileInfo->getPathname()] = APPROOT.substr($oFileInfo->getPathname(), strlen($sDataDir));
|
$aExtraFiles[$oFileInfo->getPathname()] = APPROOT.substr($oFileInfo->getPathname(), strlen($sDataDir));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -253,10 +253,12 @@ class DBBackup
|
|||||||
$aExtraFiles = MetaModel::GetModuleSetting('itop-backup', 'extra_files', []);
|
$aExtraFiles = MetaModel::GetModuleSetting('itop-backup', 'extra_files', []);
|
||||||
foreach($aExtraFiles as $sExtraFileOrDir)
|
foreach($aExtraFiles as $sExtraFileOrDir)
|
||||||
{
|
{
|
||||||
if(!file_exists(APPROOT.'/'.$sExtraFileOrDir)) continue; // Ignore non-existing files
|
if(!file_exists(APPROOT.'/'.$sExtraFileOrDir)) {
|
||||||
|
continue; // Ignore non-existing files
|
||||||
|
}
|
||||||
|
|
||||||
$sExtraFullPath = realpath(APPROOT.'/'.$sExtraFileOrDir);
|
$sExtraFullPath = utils::RealPath(APPROOT.'/'.$sExtraFileOrDir, APPROOT);
|
||||||
if (strncmp(APPROOT, $sExtraFullPath, strlen(APPROOT)) !== 0)
|
if ($sExtraFullPath === false)
|
||||||
{
|
{
|
||||||
throw new Exception("Backup: Aborting, resource '$sExtraFileOrDir'. Considered as UNSAFE because not inside the iTop directory.");
|
throw new Exception("Backup: Aborting, resource '$sExtraFileOrDir'. Considered as UNSAFE because not inside the iTop directory.");
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user