Skip to content

Commit 2ff1dfc

Browse files
authored
Merge pull request #10 from richard67/4.1-dev-dgrammatiko-4.1-update-mod-2
[CMS PR 36585] Move fixTemplateMode to preflight and fix it in 4.0.0-2018-03-05.sql for updates from 3.10
2 parents ca3738f + bc357f9 commit 2ff1dfc

File tree

3 files changed

+13
-9
lines changed

3 files changed

+13
-9
lines changed

administrator/components/com_admin/script.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,9 @@ public function preflight($action, $installer)
5858
{
5959
$this->fromVersion = $manifestValues['version'];
6060

61+
// Ensure templates are moved to the correct mode
62+
$this->fixTemplateMode();
63+
6164
return true;
6265
}
6366
}
@@ -99,9 +102,6 @@ public function update($installer)
99102
$this->deleteUnexistingFiles();
100103
$this->updateManifestCaches();
101104
$this->updateDatabase();
102-
103-
// Ensure templates are moved to the correct mode
104-
$this->fixTemplateMode();
105105
$this->updateAssets($installer);
106106
$this->clearStatsCache();
107107
$this->convertTablesToUtf8mb4(true);

administrator/components/com_admin/sql/updates/mysql/4.0.0-2018-03-05.sql

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,11 @@ INSERT INTO `#__extensions` (`name`, `type`, `element`, `folder`, `client_id`, `
1919
('atum', 'template', 'atum', '', 1, 1, 1, 0, '{}', '{}', '', '', 0, '0000-00-00 00:00:00', 0, 0),
2020
('cassiopeia', 'template', 'cassiopeia', '', 0, 1, 1, 0, '{}', '{}', '', '', 0, '0000-00-00 00:00:00', 0, 0);
2121

22-
INSERT INTO `#__template_styles` (`template`, `client_id`, `home`, `title`, `params`) VALUES
23-
('atum', 1, (CASE WHEN (SELECT b.`count` FROM (SELECT count(a.`id`) AS `count` FROM `#__template_styles` a WHERE a.`home` = '1' AND a.`client_id` = 1 AND a.`template` IN ('isis', 'hathor')) AS b) = 0 THEN '0' ELSE '1' END), 'atum - Default', '{}'),
24-
('cassiopeia', 0, (CASE WHEN (SELECT d.`count` FROM (SELECT count(c.`id`) AS `count` FROM `#__template_styles` c WHERE c.`home` = '1' AND c.`client_id` = 0 AND c.`template` IN ('protostar', 'beez3')) AS d) = 0 THEN '0' ELSE '1' END), 'cassiopeia - Default', '{}');
22+
-- The following statement had to be modified for 4.1 by adding the `inheritable` and `parent` columns.
23+
-- See https://github.com/joomla/joomla-cms/pull/36585 .
24+
INSERT INTO `#__template_styles` (`template`, `client_id`, `home`, `title`, `inheritable`, `parent`, `params`) VALUES
25+
('atum', 1, (CASE WHEN (SELECT b.`count` FROM (SELECT count(a.`id`) AS `count` FROM `#__template_styles` a WHERE a.`home` = '1' AND a.`client_id` = 1 AND a.`template` IN ('isis', 'hathor')) AS b) = 0 THEN '0' ELSE '1' END), 'atum - Default', 1, '', '{}'),
26+
('cassiopeia', 0, (CASE WHEN (SELECT d.`count` FROM (SELECT count(c.`id`) AS `count` FROM `#__template_styles` c WHERE c.`home` = '1' AND c.`client_id` = 0 AND c.`template` IN ('protostar', 'beez3')) AS d) = 0 THEN '0' ELSE '1' END), 'cassiopeia - Default', 1, '', '{}');
2527

2628
--
2729
-- Move mod_version to the right position for the atum template

administrator/components/com_admin/sql/updates/postgresql/4.0.0-2018-03-05.sql

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,11 @@ INSERT INTO "#__extensions" ("name", "type", "element", "folder", "client_id", "
1919
('atum', 'template', 'atum', '', 1, 1, 1, 0, '{}', '{}', '', '', 0, '1970-01-01 00:00:00', 0, 0),
2020
('cassiopeia', 'template', 'cassiopeia', '', 0, 1, 1, 0, '{}', '{}', '', '', 0, '1970-01-01 00:00:00', 0, 0);
2121

22-
INSERT INTO "#__template_styles" ("template", "client_id", "home", "title", "params") VALUES
23-
('atum', 1, (CASE WHEN (SELECT b."count" FROM (SELECT count(a."id") AS "count" FROM "#__template_styles" a WHERE a."home" = '1' AND a."client_id" = 1 AND a."template" IN ('isis', 'hathor')) AS b) = 0 THEN '0' ELSE '1' END), 'atum - Default', '{}'),
24-
('cassiopeia', 0, (CASE WHEN (SELECT d."count" FROM (SELECT count(c."id") AS "count" FROM "#__template_styles" c WHERE c."home" = '1' AND c."client_id" = 0 AND c."template" IN ('protostar', 'beez3')) AS d) = 0 THEN '0' ELSE '1' END), 'cassiopeia - Default', '{}');
22+
-- The following statement had to be modified for 4.1 by adding the "inheritable" and "parent" columns.
23+
-- See https://github.com/joomla/joomla-cms/pull/36585 .
24+
INSERT INTO "#__template_styles" ("template", "client_id", "home", "title", "inheritable", "parent", "params") VALUES
25+
('atum', 1, (CASE WHEN (SELECT b."count" FROM (SELECT count(a."id") AS "count" FROM "#__template_styles" a WHERE a."home" = '1' AND a."client_id" = 1 AND a."template" IN ('isis', 'hathor')) AS b) = 0 THEN '0' ELSE '1' END), 'atum - Default', 1, '', '{}'),
26+
('cassiopeia', 0, (CASE WHEN (SELECT d."count" FROM (SELECT count(c."id") AS "count" FROM "#__template_styles" c WHERE c."home" = '1' AND c."client_id" = 0 AND c."template" IN ('protostar', 'beez3')) AS d) = 0 THEN '0' ELSE '1' END), 'cassiopeia - Default', 1, '', '{}');
2527

2628
--
2729
-- Move mod_version to the right position for the atum template

0 commit comments

Comments
 (0)