From d32460cd73a07021e1f3647eff814d9089de2826 Mon Sep 17 00:00:00 2001 From: Sonny Le Date: Tue, 9 Jul 2024 08:08:02 +0700 Subject: [PATCH] Improve putContents function --- framework/library/astroid/Helper.php | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/framework/library/astroid/Helper.php b/framework/library/astroid/Helper.php index 526eb221..1741802a 100644 --- a/framework/library/astroid/Helper.php +++ b/framework/library/astroid/Helper.php @@ -12,6 +12,7 @@ use Joomla\CMS\Factory; use Joomla\CMS\Plugin\PluginHelper; use Joomla\Filesystem\Folder; +use Joomla\Filesystem\File; use Joomla\Registry\Registry; use Joomla\CMS\Version; use Joomla\CMS\Router\Route; @@ -262,12 +263,7 @@ public static function getFileHash($file) public static function putContents($file, $content, $append = false) { Framework::getReporter('Logs')->add('Saved Cached to ' . str_replace(JPATH_SITE . '/', '', $file) . ''); - self::createDir($file); - if ($append) { - file_put_contents($file, $content, FILE_APPEND); - } else { - file_put_contents($file, $content); - } + File::write($file, $content, false, $append); } public static function minifyCSS($css)