From 26f893f4ffec78f70a458dc1ce1c5834e4243321 Mon Sep 17 00:00:00 2001 From: aB0t Date: Mon, 15 Jul 2024 17:13:51 +0200 Subject: [PATCH] Release of v5.0.15-alpha1 Fix install issue with missing method removeFolder. --- CHANGELOG.md | 16 ++-- GetbibleInstallerScript.php | 90 ++++++++++++++++--- README.md | 8 +- admin/README.txt | 8 +- .../updates/mysql/{3.1.2.sql => 3.1.1.sql} | 0 .../updates/mysql/{4.0.14.sql => 4.0.13.sql} | 0 admin/sql/updates/mysql/5.0.15-alpha.sql | 1 + getbible.xml | 4 +- update_server.xml | 30 +++++-- 9 files changed, 120 insertions(+), 37 deletions(-) rename admin/sql/updates/mysql/{3.1.2.sql => 3.1.1.sql} (100%) rename admin/sql/updates/mysql/{4.0.14.sql => 4.0.13.sql} (100%) create mode 100644 admin/sql/updates/mysql/5.0.15-alpha.sql diff --git a/CHANGELOG.md b/CHANGELOG.md index 5df6304..2bcb97e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,4 +1,8 @@ -# v5.0.14 +# v5.0.15-alpha1 + +- Fix install issue with missing method removeFolder + +# v5.0.15-alpha - Refactored the API classes - Add table schema checker @@ -63,12 +67,10 @@ - Moved to Joomla 4 and 5 -# v4.0.14 +# v4.0.13 -- Refactored the API classes -- Add table schema checker +- Add back to Bible button to Open AI page. -# v3.1.2 +# v3.1.1 -- Refactored the API classes -- Add table schema checker \ No newline at end of file +- Add back to Bible button to Open AI page. \ No newline at end of file diff --git a/GetbibleInstallerScript.php b/GetbibleInstallerScript.php index 6cee7e1..78a1e36 100644 --- a/GetbibleInstallerScript.php +++ b/GetbibleInstallerScript.php @@ -314,6 +314,7 @@ class Com_GetbibleInstallerScript implements InstallerScriptInterface $removeFolders[] = JPATH_LIBRARIES . '/vendor_getbible/TrueChristianChurch.Joomla.GetBible'; $removeFolders[] = JPATH_LIBRARIES . '/vendor_getbible/TrueChristianChurch.Joomla.Gitea'; $removeFolders[] = JPATH_LIBRARIES . '/vendor_getbible/TrueChristianChurch.Joomla.Openai'; + $removeFolders[] = JPATH_LIBRARIES . '/vendor_getbible/TrueChristianBible.Joomla/src/GetBible'; foreach ($removeFolders as $folder) { @@ -325,19 +326,6 @@ class Com_GetbibleInstallerScript implements InstallerScriptInterface if ($type === 'install') { - // all things to clear out - $removeFolders = []; - $removeFolders[] = JPATH_LIBRARIES . '/jcb_powers/VDM.Joomla.GetBible'; - $removeFolders[] = JPATH_LIBRARIES . '/vendor_getbible/TrueChristianChurch.Joomla'; - $removeFolders[] = JPATH_LIBRARIES . '/vendor_getbible/TrueChristianChurch.Joomla.GetBible'; - $removeFolders[] = JPATH_LIBRARIES . '/vendor_getbible/TrueChristianChurch.Joomla.Gitea'; - $removeFolders[] = JPATH_LIBRARIES . '/vendor_getbible/TrueChristianChurch.Joomla.Openai'; - - foreach ($removeFolders as $folder) - { - $this->removeFolder($folder); - } - // Check that the required configuration are set for PHP $this->phpConfigurationCheck($this->app); } @@ -802,7 +790,7 @@ class Com_GetbibleInstallerScript implements InstallerScriptInterface echo '
-

Upgrade to Version 5.0.14 Was Successful! Let us know if anything is not working as expected.

'; +

Upgrade to Version 5.0.15-alpha1 Was Successful! Let us know if anything is not working as expected.

'; // Add/Update component in the action logs extensions table. $this->setActionLogsExtensions(); @@ -1009,6 +997,80 @@ class Com_GetbibleInstallerScript implements InstallerScriptInterface return true; } + /** + * Remove folders with files (with ignore options) + * + * @param string $dir The path to the folder to remove. + * @param array|null $ignore The folders and files to ignore and not remove. + * + * @return bool True if all specified files/folders are removed, false otherwise. + * @since 3.2.2 + */ + protected function removeFolder(string $dir, ?array $ignore = null): bool + { + if (!Folder::exists($dir)) + { + return false; + } + + $it = new \RecursiveDirectoryIterator($dir, \FilesystemIterator::SKIP_DOTS); + $it = new \RecursiveIteratorIterator($it, \RecursiveIteratorIterator::CHILD_FIRST); + + // Remove trailing slash + $dir = rtrim($dir, '/'); + + foreach ($it as $file) + { + $filePath = $file->getPathname(); + $relativePath = str_replace($dir . '/', '', $filePath); + + if ($ignore !== null && in_array($relativePath, $ignore, true)) + { + continue; + } + + if ($file->isDir()) + { + Folder::delete($filePath); + } + else + { + File::delete($filePath); + } + } + + // Delete the root folder if there are no ignored files/folders left + if ($ignore === null || $this->isDirEmpty($dir, $ignore)) + { + return Folder::delete($dir); + } + + return true; + } + + /** + * Check if a directory is empty considering ignored files/folders. + * + * @param string $dir The path to the folder to check. + * @param array $ignore The folders and files to ignore. + * + * @return bool True if the directory is empty or contains only ignored items, false otherwise. + * @since 3.2.1 + */ + protected function isDirEmpty(string $dir, array $ignore): bool + { + $it = new \RecursiveDirectoryIterator($dir, \FilesystemIterator::SKIP_DOTS); + foreach ($it as $file) + { + $relativePath = str_replace($dir . '/', '', $file->getPathname()); + if (!in_array($relativePath, $ignore, true)) + { + return false; + } + } + return true; + } + /** * Remove the files and folders in the given array from * diff --git a/README.md b/README.md index 30b8c4b..bad2239 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# Get Bible (5.0.14) +# Get Bible (5.0.15-alpha1) ![Get Bible image](https://git.vdm.dev/getBible/joomla-component/raw/branch/5.0/admin/assets/images/vdm-component.jpg "GetBible") @@ -19,7 +19,7 @@ In essence, The Bible for Joomla is designed to transform how the Word of God is + *Name*: [Get Bible](https://getbible.net) + *First Build*: 3rd December, 2015 + *Last Build*: 15th July, 2024 -+ *Version*: 5.0.14 ++ *Version*: 5.0.15-alpha1 + *Copyright*: Copyright (C) 2015. All Rights Reserved + *License*: GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html @@ -31,8 +31,8 @@ due to [Automated Component Builder](https://www.joomlacomponentbuilder.com)) > (if creating a folder and file took **5 seconds** and writing one line of code took **10 seconds**, > never making one mistake or taking any coffee break.) -+ *Line count*: **230106** -+ *File count*: **1904** ++ *Line count*: **230189** ++ *File count*: **1905** + *Folder count*: **193** **424 Hours** or **53 Eight Hour Days** (the actual time the author spent) diff --git a/admin/README.txt b/admin/README.txt index 30b8c4b..bad2239 100644 --- a/admin/README.txt +++ b/admin/README.txt @@ -1,4 +1,4 @@ -# Get Bible (5.0.14) +# Get Bible (5.0.15-alpha1) ![Get Bible image](https://git.vdm.dev/getBible/joomla-component/raw/branch/5.0/admin/assets/images/vdm-component.jpg "GetBible") @@ -19,7 +19,7 @@ In essence, The Bible for Joomla is designed to transform how the Word of God is + *Name*: [Get Bible](https://getbible.net) + *First Build*: 3rd December, 2015 + *Last Build*: 15th July, 2024 -+ *Version*: 5.0.14 ++ *Version*: 5.0.15-alpha1 + *Copyright*: Copyright (C) 2015. All Rights Reserved + *License*: GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html @@ -31,8 +31,8 @@ due to [Automated Component Builder](https://www.joomlacomponentbuilder.com)) > (if creating a folder and file took **5 seconds** and writing one line of code took **10 seconds**, > never making one mistake or taking any coffee break.) -+ *Line count*: **230106** -+ *File count*: **1904** ++ *Line count*: **230189** ++ *File count*: **1905** + *Folder count*: **193** **424 Hours** or **53 Eight Hour Days** (the actual time the author spent) diff --git a/admin/sql/updates/mysql/3.1.2.sql b/admin/sql/updates/mysql/3.1.1.sql similarity index 100% rename from admin/sql/updates/mysql/3.1.2.sql rename to admin/sql/updates/mysql/3.1.1.sql diff --git a/admin/sql/updates/mysql/4.0.14.sql b/admin/sql/updates/mysql/4.0.13.sql similarity index 100% rename from admin/sql/updates/mysql/4.0.14.sql rename to admin/sql/updates/mysql/4.0.13.sql diff --git a/admin/sql/updates/mysql/5.0.15-alpha.sql b/admin/sql/updates/mysql/5.0.15-alpha.sql new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/admin/sql/updates/mysql/5.0.15-alpha.sql @@ -0,0 +1 @@ + diff --git a/getbible.xml b/getbible.xml index 74f24f9..3de17b0 100644 --- a/getbible.xml +++ b/getbible.xml @@ -7,9 +7,9 @@ https://getbible.net Copyright (C) 2015. All Rights Reserved GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html - 5.0.14 + 5.0.15-alpha1 Get Bible (v.5.0.14) +

Get Bible (v.5.0.15-alpha1)

Welcome to the next level of scripture engagement - The Bible for Joomla! Our purpose is to bring the Word of God to every person, in their native language, entirely free. This isn't just a typical extension; it's a groundbreaking tool developed to span language divides and deliver a rich, customizable Bible study experience to users worldwide. diff --git a/update_server.xml b/update_server.xml index f4abaca..2004416 100644 --- a/update_server.xml +++ b/update_server.xml @@ -5,10 +5,10 @@ pkg_getbible package site - 3.1.2 + 3.1.1 https://getbible.net - https://git.vdm.dev/api/v1/repos/getBible/joomla-pkg/archive/v3.1.2.zip + https://git.vdm.dev/api/v1/repos/getBible/joomla-pkg/archive/v3.1.1.zip stable @@ -23,10 +23,10 @@ pkg_getbible package site - 4.0.14 + 4.0.13 https://getbible.net - https://git.vdm.dev/api/v1/repos/getBible/joomla-pkg/archive/v4.0.14.zip + https://git.vdm.dev/api/v1/repos/getBible/joomla-pkg/archive/v4.0.13.zip stable @@ -293,10 +293,10 @@ pkg_getbible package site - 5.0.14 + 5.0.15-alpha https://getbible.net - https://git.vdm.dev/api/v1/repos/getBible/joomla-pkg/archive/v5.0.14.zip + https://git.vdm.dev/api/v1/repos/getBible/joomla-pkg/archive/v5.0.15-alpha1.zip stable @@ -305,4 +305,22 @@ https://getbible.net + + Get Bible + The Bible for Joomla + pkg_getbible + package + site + 5.0.15-alpha1 + https://getbible.net + + https://git.vdm.dev/api/v1/repos/getBible/joomla-pkg/archive/v5.0.15-alpha1.zip + + + alpha + + Llewellyn van der Merwe + https://getbible.net + + \ No newline at end of file