From 4339ca00b3232cdf572d9aa93f3f84146f007305 Mon Sep 17 00:00:00 2001 From: Llewellyn van der Merwe Date: Tue, 1 Dec 2020 06:02:33 +0200 Subject: [PATCH] Added sql to the uninstall sql to remove changes made to the assets table on uninstall of a component. resolved gh-616 --- README.md | 4 +- admin/README.txt | 4 +- .../compiler/joomla_3/install.mysql.utf8.sql | 10 --- .../joomla_3/uninstall.mysql.utf8.sql | 2 +- admin/helpers/compiler/e_Interpretation.php | 77 ++++++++++++++++++- admin/sql/uninstall.mysql.utf8.sql | 11 +++ componentbuilder.xml | 2 +- 7 files changed, 92 insertions(+), 18 deletions(-) diff --git a/README.md b/README.md index c9eee0333..07c1f213f 100644 --- a/README.md +++ b/README.md @@ -144,11 +144,11 @@ TODO + *Author*: [Llewellyn van der Merwe](mailto:llewellyn@joomlacomponentbuilder.com) + *Name*: [Component Builder](https://github.com/vdm-io/Joomla-Component-Builder) + *First Build*: 30th April, 2015 -+ *Last Build*: 30th November, 2020 ++ *Last Build*: 1st December, 2020 + *Version*: 2.11.7 + *Copyright*: Copyright (C) 2015 - 2020 Vast Development Method. All rights reserved. + *License*: GNU General Public License version 2 or later; see LICENSE.txt -+ *Line count*: **284720** ++ *Line count*: **284731** + *Field count*: **1537** + *File count*: **1799** + *Folder count*: **304** diff --git a/admin/README.txt b/admin/README.txt index c9eee0333..07c1f213f 100644 --- a/admin/README.txt +++ b/admin/README.txt @@ -144,11 +144,11 @@ TODO + *Author*: [Llewellyn van der Merwe](mailto:llewellyn@joomlacomponentbuilder.com) + *Name*: [Component Builder](https://github.com/vdm-io/Joomla-Component-Builder) + *First Build*: 30th April, 2015 -+ *Last Build*: 30th November, 2020 ++ *Last Build*: 1st December, 2020 + *Version*: 2.11.7 + *Copyright*: Copyright (C) 2015 - 2020 Vast Development Method. All rights reserved. + *License*: GNU General Public License version 2 or later; see LICENSE.txt -+ *Line count*: **284720** ++ *Line count*: **284731** + *Field count*: **1537** + *File count*: **1799** + *Folder count*: **304** diff --git a/admin/compiler/joomla_3/install.mysql.utf8.sql b/admin/compiler/joomla_3/install.mysql.utf8.sql index 520b17a19..50bd3de50 100644 --- a/admin/compiler/joomla_3/install.mysql.utf8.sql +++ b/admin/compiler/joomla_3/install.mysql.utf8.sql @@ -1,11 +1 @@ ###INSTALL### - --- --- Always insure this column rules is large enough for all the access control values. --- -ALTER TABLE `#__assets` CHANGE `rules` `rules` MEDIUMTEXT NOT NULL COMMENT 'JSON encoded access control.'; - --- --- Always insure this column name is large enough for long component and view names. --- -ALTER TABLE `#__assets` CHANGE `name` `name` VARCHAR(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT 'The unique name for the asset.'; diff --git a/admin/compiler/joomla_3/uninstall.mysql.utf8.sql b/admin/compiler/joomla_3/uninstall.mysql.utf8.sql index 568025694..b8b61a080 100644 --- a/admin/compiler/joomla_3/uninstall.mysql.utf8.sql +++ b/admin/compiler/joomla_3/uninstall.mysql.utf8.sql @@ -1 +1 @@ -###UNINSTALL### \ No newline at end of file +###UNINSTALL### diff --git a/admin/helpers/compiler/e_Interpretation.php b/admin/helpers/compiler/e_Interpretation.php index 46d9d0e98..b40751e6d 100644 --- a/admin/helpers/compiler/e_Interpretation.php +++ b/admin/helpers/compiler/e_Interpretation.php @@ -10509,6 +10509,40 @@ class Interpretation extends Fields unset($this->customScriptBuilder['sql']); } + // check if this component needs larger rules + // also check if the developer will allow this + // TODO still adding to GUI the needed switches and code + if (1) + { + $db .= PHP_EOL; + $db .= PHP_EOL . '--'; + $db .= PHP_EOL + . '--' . $this->setLine( + __LINE__ + ) + . ' Always insure this column rules is large enough for all the access control values.'; + $db .= PHP_EOL . '--'; + $db .= PHP_EOL + . "ALTER TABLE `#__assets` CHANGE `rules` `rules` MEDIUMTEXT NOT NULL COMMENT 'JSON encoded access control.';"; + } + + // check if this component needs larger names + // also check if the developer will allow this + // TODO still adding to GUI the needed switches and code + if (1) + { + $db .= PHP_EOL; + $db .= PHP_EOL . '--'; + $db .= PHP_EOL + . '--' . $this->setLine( + __LINE__ + ) + . ' Always insure this column name is large enough for long component and view names.'; + $db .= PHP_EOL . '--'; + $db .= PHP_EOL + . "ALTER TABLE `#__assets` CHANGE `name` `name` VARCHAR(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT 'The unique name for the asset.';"; + } + return $db; } @@ -10541,6 +10575,44 @@ class Interpretation extends Fields unset($this->customScriptBuilder['sql_uninstall']); } + // check if this component used larger rules + // now revert them back on uninstall + // TODO still adding to GUI the needed switches and code + if (1) + { + // https://github.com/joomla/joomla-cms/blob/3.10.0-alpha3/installation/sql/mysql/joomla.sql#L22 + // Checked 1st December 2020 + $db .= PHP_EOL; + $db .= PHP_EOL . '--'; + $db .= PHP_EOL + . '--' . $this->setLine( + __LINE__ + ) + . ' Always insure this column rules is reversed to Joomla defaults on uninstall. (as on 1st Dec 2020)'; + $db .= PHP_EOL . '--'; + $db .= PHP_EOL + . "ALTER TABLE `#__assets` CHANGE `rules` `rules` varchar(5120) NOT NULL COMMENT 'JSON encoded access control.';"; + } + + // check if this component used larger rules + // now revert them back on uninstall + // TODO still adding to GUI the needed switches and code + if (1) + { + // https://github.com/joomla/joomla-cms/blob/3.10.0-alpha3/installation/sql/mysql/joomla.sql#L20 + // Checked 1st December 2020 + $db .= PHP_EOL; + $db .= PHP_EOL . '--'; + $db .= PHP_EOL + . '--' . $this->setLine( + __LINE__ + ) + . ' Always insure this column name is reversed to Joomla defaults on uninstall. (as on 1st Dec 2020).'; + $db .= PHP_EOL . '--'; + $db .= PHP_EOL + . "ALTER TABLE `#__assets` CHANGE `name` `name` VARCHAR(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT 'The unique name for the asset.';"; + } + return $db; } @@ -17660,7 +17732,9 @@ class Interpretation extends Fields . "protected function getThe" . $filter['function'] . "Selections()"; $function[] = $this->_t(1) . "{"; - $function[] = $this->_t(2) . "//" . $this->setLine(__LINE__) + $function[] = $this->_t(2) . "//" . $this->setLine( + __LINE__ + ) . " Get a db connection."; } else @@ -17763,7 +17837,6 @@ class Interpretation extends Fields . $filter['code'] . ")"; $function[] = $this->_t(3) . "{"; - // check if translated value is used if ($translation) { diff --git a/admin/sql/uninstall.mysql.utf8.sql b/admin/sql/uninstall.mysql.utf8.sql index a18ba7d43..3d73f9f76 100644 --- a/admin/sql/uninstall.mysql.utf8.sql +++ b/admin/sql/uninstall.mysql.utf8.sql @@ -47,3 +47,14 @@ DROP TABLE IF EXISTS `#__componentbuilder_joomla_plugin_updates`; DROP TABLE IF EXISTS `#__componentbuilder_joomla_plugin_files_folders_urls`; DROP TABLE IF EXISTS `#__componentbuilder_external_code`; + + +-- +-- Always insure this column rules is reversed to Joomla defaults on uninstall. (as on 1st Dec 2020) +-- +ALTER TABLE `#__assets` CHANGE `rules` `rules` varchar(5120) NOT NULL COMMENT 'JSON encoded access control.'; + +-- +-- Always insure this column name is reversed to Joomla defaults on uninstall. (as on 1st Dec 2020). +-- +ALTER TABLE `#__assets` CHANGE `name` `name` VARCHAR(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT 'The unique name for the asset.'; diff --git a/componentbuilder.xml b/componentbuilder.xml index 8d03370fd..3aa7296d2 100644 --- a/componentbuilder.xml +++ b/componentbuilder.xml @@ -1,7 +1,7 @@ COM_COMPONENTBUILDER - 30th November, 2020 + 1st December, 2020 Llewellyn van der Merwe llewellyn@joomlacomponentbuilder.com http://www.joomlacomponentbuilder.com