Merge remote-tracking branch 'origin/support/2.7' into support/3.0

# Conflicts:
#	setup/setuputils.class.inc.php
#	setup/wizardsteps.class.inc.php
This commit is contained in:
Pierre Goiffon
2022-09-14 12:16:35 +02:00
2 changed files with 26 additions and 12 deletions

View File

@@ -151,6 +151,14 @@ class SetupUtils
}
$aWritableDirsErrors = self::CheckWritableDirs($aWritableDirs);
$aResult = array_merge($aResult, $aWritableDirsErrors);
// Check temp dir (N°5235) : as this path isn't under APPROOT we are doing a custom check and not using \SetupUtils::CheckWritableDirs
$sTmpDir = static::GetTmpDir();
clearstatcache(true, $sTmpDir);
if (is_writable($sTmpDir)) {
$aResult[] = new CheckResult(CheckResult::INFO, "The temp directory is writable by the application.");
} else {
$aResult[] = new CheckResult(CheckResult::WARNING, "The temp directory <b>'".$sTmpDir."'</b> is not writable by the application. Change its permission or use another dir (sys_temp_dir option in php.ini).");
}
$aMandatoryExtensions = self::GetPHPMandatoryExtensions();
$aOptionalExtensions = self::GetPHPOptionalExtensions();
@@ -1869,21 +1877,30 @@ JS
public static function GetVersionManifest($sInstalledVersion)
{
if (preg_match('/^([0-9]+)\./', $sInstalledVersion, $aMatches))
{
if (preg_match('/^([0-9]+)\./', $sInstalledVersion, $aMatches)) {
return APPROOT.'datamodels/'.$aMatches[1].'.x/manifest-'.$sInstalledVersion.'.xml';
}
return false;
}
/**
* Check paths relative to APPROOT : is existing, is dir, is writable
*
* @param string[] $aWritableDirs list of dirs to check, relative to APPROOT (for example : `['log','conf','data']`)
*
* @return array<string, \CheckResult> full path as key, CheckResult error as value
*
* @uses \is_dir()
* @uses \is_writable()
* @uses \file_exists()
*/
public static function CheckWritableDirs($aWritableDirs)
{
$aNonWritableDirs = array();
foreach($aWritableDirs as $sDir)
{
foreach ($aWritableDirs as $sDir) {
$sFullPath = APPROOT.$sDir;
if (is_dir($sFullPath) && !is_writable($sFullPath))
{
if (is_dir($sFullPath) && !is_writable($sFullPath)) {
$aNonWritableDirs[APPROOT.$sDir] = new CheckResult(CheckResult::ERROR, "The directory <b>'".APPROOT.$sDir."'</b> exists but is not writable for the application.");
}
else if (file_exists($sFullPath) && !is_dir($sFullPath))