From feb4ae9c2498b259c9fa1a7647512a24aa3f1551 Mon Sep 17 00:00:00 2001 From: Llewellyn van der Merwe Date: Wed, 3 Oct 2018 13:34:54 +0200 Subject: [PATCH] We removed the Transition to InnoDB for all JCB tables and moved it to https://gist.github.com/Llewellynvdm/85234c6bd1e7d0eb4ddd6c925770aa2c for those who want to manually make the transition. gh-348 We also added a pre-flight script to remove all unused columns from JCB. --- README.md | 6 +- admin/README.txt | 6 +- admin/sql/updates/mysql/2.9.5.sql | 131 ----------------------------- componentbuilder.xml | 2 +- componentbuilder_update_server.xml | 17 ---- script.php | 54 +++++++++++- 6 files changed, 57 insertions(+), 159 deletions(-) delete mode 100644 admin/sql/updates/mysql/2.9.5.sql diff --git a/README.md b/README.md index f492e76e4..ccbbddcba 100644 --- a/README.md +++ b/README.md @@ -125,13 +125,13 @@ Watch the [proposed development workflow](https://vdm.bz/proposed-development-wo + *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*: 1st October, 2018 ++ *Last Build*: 3rd October, 2018 + *Version*: 2.9.6 + *Copyright*: Copyright (C) 2015 - 2018 Vast Development Method. All rights reserved. + *License*: GNU General Public License version 2 or later; see LICENSE.txt -+ *Line count*: **195803** ++ *Line count*: **195701** + *Field count*: **1087** -+ *File count*: **1278** ++ *File count*: **1277** + *Folder count*: **201** > This **component** was build with a Joomla [Automated Component Builder](http://joomlacomponentbuilder.com). diff --git a/admin/README.txt b/admin/README.txt index f492e76e4..ccbbddcba 100644 --- a/admin/README.txt +++ b/admin/README.txt @@ -125,13 +125,13 @@ Watch the [proposed development workflow](https://vdm.bz/proposed-development-wo + *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*: 1st October, 2018 ++ *Last Build*: 3rd October, 2018 + *Version*: 2.9.6 + *Copyright*: Copyright (C) 2015 - 2018 Vast Development Method. All rights reserved. + *License*: GNU General Public License version 2 or later; see LICENSE.txt -+ *Line count*: **195803** ++ *Line count*: **195701** + *Field count*: **1087** -+ *File count*: **1278** ++ *File count*: **1277** + *Folder count*: **201** > This **component** was build with a Joomla [Automated Component Builder](http://joomlacomponentbuilder.com). diff --git a/admin/sql/updates/mysql/2.9.5.sql b/admin/sql/updates/mysql/2.9.5.sql deleted file mode 100644 index 6845a9824..000000000 --- a/admin/sql/updates/mysql/2.9.5.sql +++ /dev/null @@ -1,131 +0,0 @@ -ALTER TABLE `#__componentbuilder_joomla_component` ENGINE = InnoDB; - -ALTER TABLE `#__componentbuilder_joomla_component` CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci; - -ALTER TABLE `#__componentbuilder_admin_view` ENGINE = InnoDB; - -ALTER TABLE `#__componentbuilder_admin_view` CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci; - -ALTER TABLE `#__componentbuilder_custom_admin_view` ENGINE = InnoDB; - -ALTER TABLE `#__componentbuilder_custom_admin_view` CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci; - -ALTER TABLE `#__componentbuilder_site_view` ENGINE = InnoDB; - -ALTER TABLE `#__componentbuilder_site_view` CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci; - -ALTER TABLE `#__componentbuilder_template` ENGINE = InnoDB; - -ALTER TABLE `#__componentbuilder_template` CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci; - -ALTER TABLE `#__componentbuilder_layout` ENGINE = InnoDB; - -ALTER TABLE `#__componentbuilder_layout` CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci; - -ALTER TABLE `#__componentbuilder_dynamic_get` ENGINE = InnoDB; - -ALTER TABLE `#__componentbuilder_dynamic_get` CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci; - -ALTER TABLE `#__componentbuilder_custom_code` ENGINE = InnoDB; - -ALTER TABLE `#__componentbuilder_custom_code` CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci; - -ALTER TABLE `#__componentbuilder_library` ENGINE = InnoDB; - -ALTER TABLE `#__componentbuilder_library` CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci; - -ALTER TABLE `#__componentbuilder_snippet` ENGINE = InnoDB; - -ALTER TABLE `#__componentbuilder_snippet` CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci; - -ALTER TABLE `#__componentbuilder_validation_rule` ENGINE = InnoDB; - -ALTER TABLE `#__componentbuilder_validation_rule` CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci; - -ALTER TABLE `#__componentbuilder_field` ENGINE = InnoDB; - -ALTER TABLE `#__componentbuilder_field` CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci; - -ALTER TABLE `#__componentbuilder_fieldtype` ENGINE = InnoDB; - -ALTER TABLE `#__componentbuilder_fieldtype` CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci; - -ALTER TABLE `#__componentbuilder_language_translation` ENGINE = InnoDB; - -ALTER TABLE `#__componentbuilder_language_translation` CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci; - -ALTER TABLE `#__componentbuilder_language` ENGINE = InnoDB; - -ALTER TABLE `#__componentbuilder_language` CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci; - -ALTER TABLE `#__componentbuilder_server` ENGINE = InnoDB; - -ALTER TABLE `#__componentbuilder_server` CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci; - -ALTER TABLE `#__componentbuilder_help_document` ENGINE = InnoDB; - -ALTER TABLE `#__componentbuilder_help_document` CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci; - -ALTER TABLE `#__componentbuilder_admin_fields` ENGINE = InnoDB; - -ALTER TABLE `#__componentbuilder_admin_fields` CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci; - -ALTER TABLE `#__componentbuilder_admin_fields_conditions` ENGINE = InnoDB; - -ALTER TABLE `#__componentbuilder_admin_fields_conditions` CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci; - -ALTER TABLE `#__componentbuilder_admin_fields_relations` ENGINE = InnoDB; - -ALTER TABLE `#__componentbuilder_admin_fields_relations` CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci; - -ALTER TABLE `#__componentbuilder_admin_custom_tabs` ENGINE = InnoDB; - -ALTER TABLE `#__componentbuilder_admin_custom_tabs` CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci; - -ALTER TABLE `#__componentbuilder_component_admin_views` ENGINE = InnoDB; - -ALTER TABLE `#__componentbuilder_component_admin_views` CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci; - -ALTER TABLE `#__componentbuilder_component_site_views` ENGINE = InnoDB; - -ALTER TABLE `#__componentbuilder_component_site_views` CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci; - -ALTER TABLE `#__componentbuilder_component_custom_admin_views` ENGINE = InnoDB; - -ALTER TABLE `#__componentbuilder_component_custom_admin_views` CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci; - -ALTER TABLE `#__componentbuilder_component_updates` ENGINE = InnoDB; - -ALTER TABLE `#__componentbuilder_component_updates` CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci; - -ALTER TABLE `#__componentbuilder_component_mysql_tweaks` ENGINE = InnoDB; - -ALTER TABLE `#__componentbuilder_component_mysql_tweaks` CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci; - -ALTER TABLE `#__componentbuilder_component_custom_admin_menus` ENGINE = InnoDB; - -ALTER TABLE `#__componentbuilder_component_custom_admin_menus` CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci; - -ALTER TABLE `#__componentbuilder_component_config` ENGINE = InnoDB; - -ALTER TABLE `#__componentbuilder_component_config` CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci; - -ALTER TABLE `#__componentbuilder_component_dashboard` ENGINE = InnoDB; - -ALTER TABLE `#__componentbuilder_component_dashboard` CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci; - -ALTER TABLE `#__componentbuilder_component_files_folders` ENGINE = InnoDB; - -ALTER TABLE `#__componentbuilder_component_files_folders` CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci; - -ALTER TABLE `#__componentbuilder_snippet_type` ENGINE = InnoDB; - -ALTER TABLE `#__componentbuilder_snippet_type` CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci; - -ALTER TABLE `#__componentbuilder_library_config` ENGINE = InnoDB; - -ALTER TABLE `#__componentbuilder_library_config` CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci; - -ALTER TABLE `#__componentbuilder_library_files_folders_urls` ENGINE = InnoDB; - -ALTER TABLE `#__componentbuilder_library_files_folders_urls` CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci; diff --git a/componentbuilder.xml b/componentbuilder.xml index ad74786d5..a55914f6c 100644 --- a/componentbuilder.xml +++ b/componentbuilder.xml @@ -1,7 +1,7 @@ COM_COMPONENTBUILDER - 1st October, 2018 + 3rd October, 2018 Llewellyn van der Merwe llewellyn@joomlacomponentbuilder.com http://www.joomlacomponentbuilder.com diff --git a/componentbuilder_update_server.xml b/componentbuilder_update_server.xml index 8a2212188..11c035f0c 100644 --- a/componentbuilder_update_server.xml +++ b/componentbuilder_update_server.xml @@ -543,23 +543,6 @@ http://www.joomlacomponentbuilder.com - - Component Builder - Builds Complex Joomla Components - com_componentbuilder - component - 2.9.5 - http://www.joomlacomponentbuilder.com - - https://github.com/vdm-io/Joomla-Component-Builder/releases/download/v2.9.6/JCB_v2.9.6.zip - - - stable - - Llewellyn van der Merwe - http://www.joomlacomponentbuilder.com - - Component Builder Builds Complex Joomla Components diff --git a/script.php b/script.php index caf72fd19..8f03cf93e 100644 --- a/script.php +++ b/script.php @@ -3308,10 +3308,12 @@ class com_componentbuilderInstallerScript ) ); } + // start the active table array + $activeTable = array(); // get table columns to confirm that this is an old installation - $activeColumns = $db->getTableColumns('#__componentbuilder_admin_view'); + $activeTable['admin_view'] = $db->getTableColumns('#__componentbuilder_admin_view'); // target version less then 2.5.7 - if (isset($activeColumns['addfields']) && (count($this->JCBversion) == 3 && $this->JCBversion[0] <= 2 && $this->JCBversion[1] <= 5 && (($this->JCBversion[1] == 5 && $this->JCBversion[2] <= 6) || ($this->JCBversion[1] < 5)))) + if (isset($activeTable['admin_view']['addfields']) && (count($this->JCBversion) == 3 && $this->JCBversion[0] <= 2 && $this->JCBversion[1] <= 5 && (($this->JCBversion[1] == 5 && $this->JCBversion[2] <= 6) || ($this->JCBversion[1] < 5)))) { // do some conversions in the admin_view table $convertRepeatable($db, 'admin_view', array('id', 'ajax_input', 'custom_button', 'addtables', 'addlinked_views', 'addconditions', 'addfields', 'addtabs', 'addpermissions'), @@ -3345,9 +3347,9 @@ class com_componentbuilderInstallerScript // the set move values $this->setMoveValues = array(); // get table columns to confirm that this is an old installation - $activeColumns = $db->getTableColumns('#__componentbuilder_joomla_component'); + $activeTable['joomla_component'] = $db->getTableColumns('#__componentbuilder_joomla_component'); // target version less then 2.6.0 - if (isset($activeColumns['addadmin_views']) && (count($this->JCBversion) == 3 && $this->JCBversion[0] <= 2 && $this->JCBversion[1] <= 5 && (($this->JCBversion[1] == 5 && $this->JCBversion[2] <= 9) || ($this->JCBversion[1] < 6)))) + if (isset($activeTable['joomla_component']['addadmin_views']) && (count($this->JCBversion) == 3 && $this->JCBversion[0] <= 2 && $this->JCBversion[1] <= 5 && (($this->JCBversion[1] == 5 && $this->JCBversion[2] <= 9) || ($this->JCBversion[1] < 6)))) { // do some conversions in the admin_view table $convertRepeatable($db, 'joomla_component', array('id', 'addadmin_views', 'addconfig', 'addcontributors', 'addcustom_admin_views', 'addcustommenus', 'addfiles', 'addfolders', 'addsite_views', 'dashboard_tab', 'sql_tweak', 'version_update'), @@ -3421,6 +3423,50 @@ class com_componentbuilderInstallerScript } } } + // target version less then 2.9.7 + if (count($this->JCBversion) == 3 && $this->JCBversion[0] <= 2 && (($this->JCBversion[1] == 9 && $this->JCBversion[2] <= 6) || $this->JCBversion[1] < 9)) + { + // we basically just dump the unused columns from #__componentbuilder_joomla_component + $columnToDrop['joomla_component'] = array( + 'addconfig', + 'addadmin_views', + 'addcustom_admin_views', + 'addsite_views', + 'version_update', + 'sql_tweak', + 'addcustommenus', + 'dashboard_tab', + 'php_dashboard_methods', + 'addfiles', + 'addfolders'); + // and from from #__componentbuilder_admin_view + $columnToDrop['admin_view'] = array( + 'addfields', + 'addconditions'); + // only drop those that exist + foreach ($columnToDrop as $table => $columns) + { + // start drop array + $drop = array(); + foreach ($columns as $column) + { + if (isset($activeTable[$table][$column])) + { + // load the column + $drop[$column] = $column; + } + } + // now run query if needed + if (ComponentbuilderHelper::checkArray($drop)) + { + // build query + $query = 'ALTER TABLE `#__componentbuilder_' . $table . '` DROP `' . implode('`, DROP `', $drop) . '`'; + // set query + $db->setQuery($query); + $db->execute(); + } + } + } } } // do any install needed