No Code Attached Yet bug
avatar heelc29
heelc29
26 Aug 2023

Steps to reproduce the issue

update from 5.0.0-alpha to 5.0.0-beta1-dev

Expected result

jtemplate icon should be still there
image

Actual result

jtemplate icon is missing
image

Additional comments

in parameter of plugin (in database) it is now jjtemplate (double j)
image

#40626: migrateTinymceConfiguration is triggered because version_compare('5.0.0-alpha/beta', '5.0.0', 'ge') is false

/**
* Replace array values with menu item names ("old name" -> "new name"):
* "blockformats" -> "blocks"
* "fontformats" -> "fontfamily"
* "fontsizes" -> "fontsize"
* "formats" -> "styles"
* "template" -> "jtemplate"
*/
$params['configuration']['toolbars'][$setIdx]['menu'] = str_replace(
['blockformats', 'fontformats', 'fontsizes', 'formats', 'template'],
['blocks', 'fontfamily', 'fontsize', 'styles', 'jtemplate'],
$toolbarConfig['menu']
);

@dgrammatiko @richard67

avatar heelc29 heelc29 - open - 26 Aug 2023
avatar joomla-cms-bot joomla-cms-bot - change - 26 Aug 2023
Labels Added: No Code Attached Yet
avatar joomla-cms-bot joomla-cms-bot - labeled - 26 Aug 2023
avatar HLeithner
HLeithner - comment - 26 Aug 2023

@Fedik ?

avatar dgrammatiko
dgrammatiko - comment - 26 Aug 2023

The double jj means that the upgrade procedure run twice, the first changed template to jtemplate and the second the jtemplate to jjtemplate. @richard67 any clues why?

@HLeithner wasn't Fedir's fault, coming from #40626

avatar heelc29
heelc29 - comment - 26 Aug 2023

It's a new installation of j5 - so it is already jtemplate.
Then I do an update from 5.0.0-alpha --> 5.0.0-beta1-dev (nightly)

In the postflight function of administrator\components\com_admin\script.php it do an version compare which is false for 5.0.0 alpha or beta versions version_compare($this->fromVersion, '5.0.0', 'ge') and migrateTinymceConfiguration is executed

After this it's jjtemplate

avatar richard67
richard67 - comment - 26 Aug 2023

#40626 : migrateTinymceConfiguration is triggered because version_compare('5.0.0-alpha/beta', '5.0.0', 'ge') is false

@heelc29 That's indended, we want to run it when updating from 5.0 alpha versions.

@dgrammatiko The problem is that after the replacement, the value still contains "template", so it will match and be replaces again and again. We need a check (in addition to the version compare) if the parameters contain one of the old values which is not there after a successful replacement. Or we have to use regexp_replace so we can use the beginning of sting anchor.

avatar dgrammatiko
dgrammatiko - comment - 26 Aug 2023

it do an version compare which is false

Ok, that explains why it happens. I have no clue if we should guard against it but should be doable

avatar richard67
richard67 - comment - 26 Aug 2023

@dgrammatiko Do you want to provide a fix, and I review it? Or vice versa?

avatar richard67 richard67 - change - 26 Aug 2023
Labels Added: bug
avatar richard67 richard67 - labeled - 26 Aug 2023
avatar dgrammatiko
dgrammatiko - comment - 26 Aug 2023

Do you want to provide a fix, and I review it? Or vice versa?

Go ahead and I'll do the testing

avatar richard67
richard67 - comment - 26 Aug 2023

Go ahead and I'll do the testing

@dgrammatiko It may take a while because I have to go shopping for food soon before they close.

avatar richard67
richard67 - comment - 26 Aug 2023

The easiest check would be if we already have a 'jtemplate'. If that is the case, the replacement has already been made or we are already on a J5 where it is right.

avatar dgrammatiko
dgrammatiko - comment - 26 Aug 2023

Yup, you can add something like

if (!str_contains($params['configuration']['toolbars'][$setIdx]['menu'], 'jtemplate) {
 // add to the array
}
// exec the str_replace
avatar dgrammatiko
dgrammatiko - comment - 26 Aug 2023

It may take a while because I have to go shopping for food soon before they close.

@richard67 no worries, I'll do the PR

avatar dgrammatiko
dgrammatiko - comment - 26 Aug 2023

@heelc29 could you test #41473

Upgrading again should not result to jjtemplate assuming that you cleanup the db data before

avatar heelc29 heelc29 - close - 26 Aug 2023
avatar heelc29 heelc29 - change - 26 Aug 2023
Status New Closed
Closed_Date 0000-00-00 00:00:00 2023-08-26 13:49:42
Closed_By heelc29
avatar heelc29
heelc29 - comment - 26 Aug 2023

There is a PR #41475

Add a Comment

Login with GitHub to post a comment