From ba8a2c1b1577f9a2dd37d0fb8e832bd90139b6f6 Mon Sep 17 00:00:00 2001 From: Molkobain Date: Wed, 22 Jan 2020 13:32:31 +0100 Subject: [PATCH] =?UTF-8?q?N=C2=B02710=20-=20Fix=20setup=20crash=20due=20t?= =?UTF-8?q?o=20PHP=20notices=20(regression=20introduced=20in=2059678955)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- application/themehandler.class.inc.php | 10 +++++----- setup/compiler.class.inc.php | 10 +++++++--- 2 files changed, 12 insertions(+), 8 deletions(-) diff --git a/application/themehandler.class.inc.php b/application/themehandler.class.inc.php index 404ac1204..cde81ea02 100644 --- a/application/themehandler.class.inc.php +++ b/application/themehandler.class.inc.php @@ -47,8 +47,8 @@ class ThemeHandler * * @param string $sThemeId * @param array|null $aThemeParameters Parameters (variables, imports, stylesheets) for the theme, if not passed, will be retrieved from compiled DM - * @param array|null $aImportsPaths Paths where imports can be found - * @param string|null $sWorkingPath Path of the folder used during compilation + * @param array|null $aImportsPaths Paths where imports can be found. Must end with '/' + * @param string|null $sWorkingPath Path of the folder used during compilation. Must end with a '/' * * @throws \CoreException */ @@ -95,19 +95,19 @@ class ThemeHandler { $sTmpThemeScssContent .= '@import "'.$sImport.'";'."\n"; - $iImportLastModified = filemtime($sWorkingPath.$sImport); + $iImportLastModified = @filemtime($sWorkingPath.$sImport); $iStyleLastModified = $iStyleLastModified < $iImportLastModified ? $iImportLastModified : $iStyleLastModified; } foreach ($aThemeParameters['stylesheets'] as $sStylesheet) { $sTmpThemeScssContent .= '@import "'.$sStylesheet.'";'."\n"; - $iStylesheetLastModified = filemtime($sWorkingPath.$sStylesheet); + $iStylesheetLastModified = @filemtime($sWorkingPath.$sStylesheet); $iStyleLastModified = $iStyleLastModified < $iStylesheetLastModified ? $iStylesheetLastModified : $iStyleLastModified; } // Checking if our compiled css is outdated - if (!file_exists($sThemeCssPath) || (is_writable($sThemeFolderPath) && (filemtime($sThemeCssPath) < $iStyleLastModified))) + if (!file_exists($sThemeCssPath) || (is_writable($sThemeFolderPath) && (@filemtime($sThemeCssPath) < $iStyleLastModified))) { $oScss = new Compiler(); $oScss->setFormatter('ScssPhp\\ScssPhp\\Formatter\\Expanded'); diff --git a/setup/compiler.class.inc.php b/setup/compiler.class.inc.php index 42535d8aa..443513aa9 100644 --- a/setup/compiler.class.inc.php +++ b/setup/compiler.class.inc.php @@ -2676,16 +2676,20 @@ EOF; */ protected function CompileThemes($oBrandingNode, $sTempTargetDir, $sFinalTargetDir) { + // Make sure temp. target dir. ends with a '/' + $sTempTargetDir .= '/'; + // Set imports paths // Note: During compilation, we don't have access to "env-xxx", so we have to set several imports paths: - // - The CSS directory for the + // - The CSS directory for the native imports (eg. "../css/css-variables.scss") + // - The SCSS from modules $aImportsPaths = array( APPROOT.'css/', - $sTempTargetDir, + $sTempTargetDir.'/', ); // Build compiled themes folder - $sThemesDir = $sTempTargetDir.'/branding/themes/'; + $sThemesDir = $sTempTargetDir.'branding/themes/'; if(!is_dir($sThemesDir)) { SetupUtils::builddir($sThemesDir);