mirror of
https://github.com/Combodo/iTop.git
synced 2026-02-13 07:24:13 +01:00
Ignore non-existing files.
This commit is contained in:
@@ -251,6 +251,8 @@ class DBBackup
|
||||
$aExtraFiles = MetaModel::GetModuleSetting('itop-backup', 'extra_files', []);
|
||||
foreach($aExtraFiles as $sExtraFileOrDir)
|
||||
{
|
||||
if(!file_exists(APPROOT.'/'.$sExtraFileOrDir)) continue; // Ignore non-existing files
|
||||
|
||||
$sExtraFullPath = realpath(APPROOT.'/'.$sExtraFileOrDir);
|
||||
if (strncmp(APPROOT, $sExtraFullPath, strlen(APPROOT)) !== 0)
|
||||
{
|
||||
|
||||
@@ -69,6 +69,7 @@ class DBBackupDataTest extends ItopDataTestCase
|
||||
'no_extra_file' => ['aExtraFiles' => [], false],
|
||||
'one_extra_file' => ['aExtraFiles' => ['foo.txt' => true], false],
|
||||
'three_extra_file_and_dir' => ['aExtraFiles' => ['foo.txt' => true, 'gabu/zomeu.xml' => true, 'meuh.html' => true], false],
|
||||
'two_extra_file_but_only_one_exists' => ['aExtraFiles' => ['foo.txt' => true, 'meuh.html' => false], false],
|
||||
'one_unsafe_file' => ['aExtraFiles' => ['../foo.txt' => true], true],
|
||||
];
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user