Merge branch 'support/3.2' into develop

# Conflicts:
#	dictionaries/ui/components/quick-create/zh_cn.dictionary.itop.quick-create.php
#	dictionaries/zh_cn.dictionary.itop.core.php
#	setup/runtimeenv.class.inc.php
This commit is contained in:
jf-cbd
2024-12-16 18:38:07 +01:00
67 changed files with 8559 additions and 5796 deletions

View File

@@ -741,22 +741,20 @@ class SetupUtils
throw new Exception("Attempting to delete directory: '$dir'");
}
$aFiles = scandir($dir); // Warning glob('.*') does not seem to return the broken symbolic links, thus leaving a non-empty directory
if ($aFiles !== false) {
foreach ($aFiles as $file) {
if (($file != '.') && ($file != '..')) {
if (is_dir($dir.'/'.$file)) {
self::tidydir($dir.'/'.$file);
self::rmdir_safe($dir.'/'.$file);
}
else {
if (!unlink($dir.'/'.$file))
{
SetupLog::Ok("Warning - FAILED to remove file '$dir/$file'");
}
else if (file_exists($dir.'/'.$file))
{
SetupLog::Ok("Warning - FAILED to remove file '$dir/.$file'");
if (is_dir($dir)) {
$aFiles = scandir($dir); // Warning glob('.*') does not seem to return the broken symbolic links, thus leaving a non-empty directory
if ($aFiles !== false) {
foreach ($aFiles as $file) {
if (($file != '.') && ($file != '..')) {
if (is_dir($dir.'/'.$file)) {
self::tidydir($dir.'/'.$file);
self::rmdir_safe($dir.'/'.$file);
} else {
if (!unlink($dir.'/'.$file)) {
SetupLog::Ok("Warning - FAILED to remove file '$dir/$file'");
} else if (file_exists($dir.'/'.$file)) {
SetupLog::Ok("Warning - FAILED to remove file '$dir/.$file'");
}
}
}
}
@@ -790,16 +788,19 @@ class SetupUtils
// avoid unnecessary warning
// Try 100 times...
$i = 100;
while ((@rmdir($dir) === false) && $i > 0)
{
// Magic trick for windows
// sometimes the folder is empty but rmdir fails
closedir(opendir($dir));
$i--;
}
if ($i == 0)
{
rmdir($dir);
if (is_dir($dir)) {
while ((@rmdir($dir) === false) && $i > 0) {
// Magic trick for windows
// sometimes the folder is empty but rmdir fails
$oDir = opendir($dir);
if ($oDir !== false) {
closedir($oDir);
}
$i--;
}
if ($i == 0) {
rmdir($dir);
}
}
}