From e7cf6d6cc9590836923f4c20b7694445fddaa7f4 Mon Sep 17 00:00:00 2001 From: Sonny Le Date: Fri, 27 Sep 2024 08:23:13 +0700 Subject: [PATCH] Fix issue Call to undefined method Joomla\Filesystem\File::getExt() in Joomla 4 --- framework/library/astroid/Helper/Media.php | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/framework/library/astroid/Helper/Media.php b/framework/library/astroid/Helper/Media.php index ebb90353..2ce5ca69 100644 --- a/framework/library/astroid/Helper/Media.php +++ b/framework/library/astroid/Helper/Media.php @@ -97,7 +97,7 @@ public static function getList($folder): array $tmp->path_relative = str_replace($mediaBase, '', $tmp->path); $tmp->size = filesize($tmp->path); - $ext = strtolower(File::getExt($file)); + $ext = strtolower(self::getExt($file)); switch ($ext) { // Image @@ -376,4 +376,13 @@ public static function rename(): array return ['message' => $type . " `$name` successfully rename.", 'item' => $item]; } + + public static function getExt($filename): string + { + if (ASTROID_JOOMLA_VERSION > 4) { + return File::getExt($filename); + } else { + return \Joomla\CMS\Filesystem\File::getExt($filename); + } + } }