Feature Language Change b/c break PR-6.0-dev Pending

User tests: Successful: Unsuccessful:

avatar rdeutz
rdeutz
22 May 2025

Our versioning works on databse table level, this leads to situations that we save an article with custom fields but the CF are not included in the history. This is unexpected from a user perspective. This PR starts to change this behaviour so that releated information are also saved.

Summary of Changes

I have added an interface VersionableModelInterface, if a model implements this interface then in AdminModel the save of the histroy data is done in the save method (calls saveHistory) of the Model. This is the first step and we have now the data with releated information in the history table.

If you want to restore a version then in loadHistory (VersionableModelTrait) set the data from the history table as session data and loadForm use this data when you edit an item.

It works for CF so far. At the moment not for Tags (tags is a pain, we might change more on tags for 6 so I haven't looked into the details why not).

This is a b/c break and I don't know how many are affected but I think that it can't be too much hassle and what we get when we finish this is worth the work for extensions developers.

  • Look into tags
  • Extend to other core items where we are using versions (Banner, Banner Client, newfeeds, Categories Tags).
  • Remove behaviour plugin
  • Fix tests

Testing Instructions

It is now done for all core extensions and item whitch supports versions

  • Create some custom fields
  • Create an article and save some versions of it
  • Restore versions back and force

Actual result BEFORE applying this Pull Request

Custom fields have always the last saved value

Expected result AFTER applying this Pull Request

Custom fields have the value from the saved version, Tags get restored

Link to documentations

Documentation will be provided at a later stage.

Please select:

  • Documentation link for docs.joomla.org:

  • No documentation changes for docs.joomla.org needed

  • Pull Request link for manual.joomla.org:

  • No documentation changes for manual.joomla.org needed

avatar rdeutz rdeutz - open - 22 May 2025
avatar rdeutz rdeutz - change - 22 May 2025
Status New Pending
avatar joomla-cms-bot joomla-cms-bot - change - 22 May 2025
Category Administration com_contact com_content com_contenthistory Libraries Front End Plugins
avatar rdeutz rdeutz - change - 22 May 2025
Labels Added: PR-6.0-dev
avatar rdeutz rdeutz - change - 22 May 2025
Labels Added: b/c break
avatar rdeutz rdeutz - change - 22 May 2025
The description was changed
avatar rdeutz rdeutz - edited - 22 May 2025
avatar rdeutz rdeutz - change - 22 May 2025
The description was changed
avatar rdeutz rdeutz - edited - 22 May 2025
avatar peterpeter peterpeter - test_item - 31 May 2025 - Tested successfully
avatar peterpeter
peterpeter - comment - 31 May 2025

I have tested this item βœ… successfully on eb8533b

Successful tested with a text-, integer-, list- and checkboxfield(s).

B.t.w.
Comparing versions is throwing an error:
https://prnt.sc/bvWwN0TaKwSq
with or without this patch


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/45515.

avatar peterpeter peterpeter - test_item - 31 May 2025 - Tested successfully
avatar peterpeter
peterpeter - comment - 31 May 2025

I have tested this item βœ… successfully on eb8533b

Successful tested with a text-, integer-, list- and checkboxfield(s).

B.t.w.
Comparing versions is throwing an error:
https://prnt.sc/bvWwN0TaKwSq
with or without this patch


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/45515.

avatar richard67 richard67 - change - 3 Jun 2025
Title
[6.0] RFC extend versioning, save releated information in history table and restore historcal data
[6.0] RFC extend versioning, save releated information in history table and restore historical data
avatar richard67 richard67 - edited - 3 Jun 2025
avatar rdeutz rdeutz - change - 12 Jun 2025
Labels Added: Feature
avatar rdeutz rdeutz - change - 3 Aug 2025
The description was changed
avatar rdeutz rdeutz - edited - 3 Aug 2025
avatar rdeutz rdeutz - change - 3 Aug 2025
The description was changed
avatar rdeutz rdeutz - edited - 3 Aug 2025
avatar rdeutz rdeutz - change - 3 Aug 2025
The description was changed
avatar rdeutz rdeutz - edited - 3 Aug 2025
avatar joomla-cms-bot joomla-cms-bot - change - 3 Aug 2025
Category Administration com_contact com_content com_contenthistory Libraries Front End Plugins Administration com_banners com_categories com_contact com_content com_contenthistory com_newsfeeds com_tags com_users Libraries Front End Plugins
35e01da 3 Aug 2025 avatar RobertDeutz cs
avatar rdeutz
rdeutz - comment - 4 Aug 2025

I now know why the tests are failing, when creating a banner over the api only the table class is used and not the model. So the problem is "only" an API problem.

avatar softforge
softforge - comment - 8 Aug 2025

I also got the An error has occurred. 0 htmlspecialchars(): Argument #1 ($string) must be of type string, array given error when comparing with or without, but the PR certainly restores the custom fields and tags restored, really nice feature

avatar exlemor
exlemor - comment - 9 Aug 2025

@rdeutz - there are some issues with this PR ;(

Sometimes it restores with a blank article, sometimes not, (no error message), Tags not restored :/

(sorry)

avatar richard67
richard67 - comment - 11 Aug 2025

I now know why the tests are failing, when creating a banner over the api only the table class is used and not the model. So the problem is "only" an API problem.

@rdeutz Then the failing API test should be commented out with a to do comment so that system tests are passing. Merging this PR as it is would mean to break system tests in the 6.0-dev branch.

avatar muhme
muhme - comment - 12 Aug 2025

I now know why the tests are failing, when creating a banner over the api only the table class is used and not the model. So the problem is "only" an API problem.

Maybe @heelc29 or @alikon could help with the API so that the system test works again?

avatar rdeutz rdeutz - change - 14 Aug 2025
The description was changed
avatar rdeutz rdeutz - edited - 14 Aug 2025
avatar joomla-cms-bot joomla-cms-bot - change - 14 Aug 2025
Category Administration com_contact com_content com_contenthistory Libraries Front End Plugins com_banners com_categories com_newsfeeds com_tags com_users Administration com_banners com_categories com_contact com_content com_contenthistory com_newsfeeds com_tags com_users Language & Strings Libraries Front End Plugins
avatar rdeutz rdeutz - change - 14 Aug 2025
Labels Added: Language Change
avatar rdeutz rdeutz - change - 14 Aug 2025
Title
[6.0] RFC extend versioning, save releated information in history table and restore historical data
[6.0] Extend versioning, save releated information in history table and restore historical data
avatar rdeutz rdeutz - edited - 14 Aug 2025
avatar rdeutz
rdeutz - comment - 14 Aug 2025

Test and the compare view is fixed, so this here is ready to test again.

@exlemor could you give some more information what you did. As you can see it is working for other people, so it would be good to know more details.

avatar brianteeman brianteeman - test_item - 14 Aug 2025 - Tested unsuccessfully
avatar brianteeman
brianteeman - comment - 14 Aug 2025

I have tested this item πŸ”΄ unsuccessfully on 541f78e


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/45515.

avatar brianteeman
brianteeman - comment - 14 Aug 2025

I installed the blog sample data
I edited the content of the typography article
I entered some data in the author field of the typography article
Then I clicked ion the versions button and selected the two versions and clicked on compare

An error has occurred.
htmlspecialchars(): Argument #1 ($string) must be of type string, array given

Call Stack

Function Location
1 () JROOT\administrator\components\com_contenthistory\tmpl\compare\compare.php:105
2 htmlspecialchars() JROOT\administrator\components\com_contenthistory\tmpl\compare\compare.php:105
3 include() JROOT\libraries\src\MVC\View\HtmlView.php:416
4 Joomla\CMS\MVC\View\HtmlView->loadTemplate() JROOT\libraries\src\MVC\View\HtmlView.php:204
5 Joomla\CMS\MVC\View\HtmlView->display() JROOT\administrator\components\com_contenthistory\src\View\Compare\HtmlView.php:64
6 Joomla\Component\Contenthistory\Administrator\View\Compare\HtmlView->display() JROOT\libraries\src\MVC\Controller\BaseController.php:697
7 Joomla\CMS\MVC\Controller\BaseController->display() JROOT\libraries\src\MVC\Controller\BaseController.php:730
8 Joomla\CMS\MVC\Controller\BaseController->execute() JROOT\libraries\src\Dispatcher\ComponentDispatcher.php:143
9 Joomla\CMS\Dispatcher\ComponentDispatcher->dispatch() JROOT\libraries\src\Component\ComponentHelper.php:361
10 Joomla\CMS\Component\ComponentHelper::renderComponent() JROOT\libraries\src\Application\AdministratorApplication.php:150
11 Joomla\CMS\Application\AdministratorApplication->dispatch() JROOT\libraries\src\Application\AdministratorApplication.php:205
12 Joomla\CMS\Application\AdministratorApplication->doExecute() JROOT\libraries\src\Application\CMSApplication.php:315
13 Joomla\CMS\Application\CMSApplication->execute() JROOT\administrator\includes\app.php:58
14 require_once() JROOT\administrator\index.php:32
avatar exlemor
exlemor - comment - 14 Aug 2025

Test and the compare view is fixed, so this here is ready to test again.

@exlemor could you give some more information what you did. As you can see it is working for other people, so it would be good to know more details.

Hi Robert, I'll try to remember but to be honest, after the medication I have been on due to hospital visit on Monday, not entirely sure my memory will recollect 100%, but basically I tested your PR as you instructed and with your PR activated, I would try to restore an article and I would get a blank page (i.e. code view = blank), and at other times not but no error or console messages but now that a bunch of work has been done on it. I will retest it for you sometime today, I'm not 100% yet and with the heat wave not helping, but I'll do my best.

avatar rdeutz
rdeutz - comment - 14 Aug 2025

Thanks for testing @brianteeman I think I have missed a case. I made a change and pushed it. I tried to check locally but -funny enough- the sampledata plugins are not working here. Please retest if I have made the correct change.

avatar LadySolveig
LadySolveig - comment - 14 Aug 2025

I like this so much. I will test it later as soon as I find the time and would be very happy if we could get it in for the Release.

The only thing that strikes me right away is that we definitely need an addition to the documentation for developers. Previously, everything that was saved directly via $table->store for example was also versioned, but that is no longer the case and, in my experience, is sometimes used to bend data. We should at least issue a note about this.

avatar brianteeman
brianteeman - comment - 14 Aug 2025

Applied the latest changes and did the exact same check

Now the page is full with this warning

Warning: Array to string conversion in D:\repos\j6\administrator\components\com_contenthistory\tmpl\compare\compare.php on line 102

avatar rdeutz
rdeutz - comment - 14 Aug 2025

@brianteeman thanks I will try to get sampledata installed and try on my own.

@LadySolveig The only thing you need to do, if you have used versioning in your component, is in the model add "implements VersionableModelInterface". That's all. But I agree we need documentation and I will write it, when it works without errors.

avatar rdeutz rdeutz - change - 14 Aug 2025
The description was changed
avatar rdeutz rdeutz - edited - 14 Aug 2025
avatar exlemor exlemor - test_item - 15 Aug 2025 - Tested unsuccessfully
avatar exlemor
exlemor - comment - 15 Aug 2025

I have tested this item πŸ”΄ unsuccessfully on 5d68b82

I have test this unsuccessfully. ;( Sorry @rdeutz

I downloaded the Update Package from the Download button built on Thu Aug 14 18:28:10 UTC 2025

When comparing 2 versions of the article, I get the same error Brian got:

An error has occurred.
0 htmlspecialchars(): Argument #1 ($string) must be of type string, array given

Going further, and this MAY be beyond this PR, I apologize as I rarely restore older versions of Articles,

  1. when I preview an article that has an image in it, the image preview is broken?

  2. when having added/removed tags from a version, I do see a newTags ["5","4"] and Tags ["5","4"] section in the popup preview window but those are numbers not the Tags themselves? (perhaps expected but not very user friendly)


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/45515.
avatar rdeutz
rdeutz - comment - 15 Aug 2025

At the moment it is more important to test if the functionallity works. So can you restore an older version of an article, banner etc.

The problem with the compare/preview view is that you have a structure to show that is not fixed, it is array of array ... of array and to have the diff between it you need to convert this into a flat table. I have made a fix to show the data without error but it is not pretty.

@exlemor do you know the line where the error was?

avatar LadySolveig LadySolveig - test_item - 15 Aug 2025 - Tested successfully
avatar LadySolveig
LadySolveig - comment - 15 Aug 2025

I have tested this item βœ… successfully on 5d68b82

Article, tags and custom fields tested with different versions and restore - works for me.


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/45515.

avatar exlemor exlemor - test_item - 15 Aug 2025 - Tested successfully
avatar exlemor
exlemor - comment - 15 Aug 2025

I have tested this item βœ… successfully on 5d68b82

I was able to successfully. Thanks to @rdeutz, @LadySolveig, @softforge, @Bodge-IT !


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/45515.

avatar brianteeman brianteeman - test_item - 15 Aug 2025 - Tested unsuccessfully
avatar brianteeman
brianteeman - comment - 15 Aug 2025

I have tested this item πŸ”΄ unsuccessfully on 5d68b82


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/45515.

avatar brianteeman
brianteeman - comment - 15 Aug 2025

When I compare two versions of an article that does not have any image the comparison shows

image

Note all the "undefined" references

I would expect it to be like this

image

The same is true for most other options

image
avatar brianteeman
brianteeman - comment - 15 Aug 2025

When you have some tags it gets even weirder

There is this section right at the top

image

Then another reference to tags

image

And finally a third reference right at the bottom

image
avatar heelc29 heelc29 - test_item - 15 Aug 2025 - Tested unsuccessfully
avatar heelc29
heelc29 - comment - 15 Aug 2025

I have tested this item πŸ”΄ unsuccessfully on 5d68b82

Version Note not working
image


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/45515.
avatar brianteeman
brianteeman - comment - 15 Aug 2025

@exlemor @LadySolveig did you not get these errors

avatar brianteeman
brianteeman - comment - 15 Aug 2025

This needs more work if the display of information is to be useful

Another example is when scheme is not defined

image

You only get that value of extendJed when you have not enabled any schema plugins

image

If it is to be displayed in the comparison then the string needs to be translated into human speak

avatar heelc29
heelc29 - comment - 15 Aug 2025

Restore of 1st version is not working correctly

  • buttons disappear (link new article)
image - when I try to save again image
avatar brianteeman
brianteeman - comment - 15 Aug 2025

@LadySolveig thank you for your time explaining the need to push this through (because of its b/c breaking changes) and that the visual display will be fixed before final release or it will have to be reverted

avatar rdeutz
rdeutz - comment - 16 Aug 2025

Confirmed the problem with the version note and fixed it.

Didn't get the button disappear problem reproduced, but will try later.

avatar exlemor exlemor - test_item - 16 Aug 2025 - Tested successfully
avatar exlemor
exlemor - comment - 16 Aug 2025

I have tested this item βœ… successfully on c027b4d

I have re-tested this successfully. Thanks @rdeutz! Keep up the great work!


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/45515.

avatar brianteeman
brianteeman - comment - 16 Aug 2025

When you restore to the initial version the buttons disappear AND you cannot save the article

See video

chrome_0NbUOiTwTM.mp4
avatar brianteeman brianteeman - test_item - 16 Aug 2025 - Tested unsuccessfully
avatar brianteeman
brianteeman - comment - 16 Aug 2025

I have tested this item πŸ”΄ unsuccessfully on c027b4d


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/45515.

avatar softforge softforge - change - 17 Aug 2025
Status Pending Fixed in Code Base
Closed_Date 0000-00-00 00:00:00 2025-08-17 10:35:17
Closed_By softforge
avatar softforge softforge - close - 17 Aug 2025
avatar softforge softforge - merge - 17 Aug 2025
avatar softforge
softforge - comment - 17 Aug 2025

Thank you to @rdeutz for his work on this and to @LadySolveig and @richard67 for the work they did fixing this to the point we could merge. Thank you to all the testers and also for the work done by @brianteeman to make sure deficiencies were noted and documented so we have a clear measure of what must be done to get this ready before RC

avatar heelc29 heelc29 - test_item - 17 Aug 2025 - Tested unsuccessfully
avatar heelc29
heelc29 - comment - 17 Aug 2025

I have tested this item πŸ”΄ unsuccessfully on c027b4d


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/45515.

avatar heelc29
heelc29 - comment - 17 Aug 2025

Still issues

Create new article and save two times (2 versions are stored) - before only 1 version
image

Star to mark current version is no longer working
image

Restore options (e.g. show/hide title) from older history not working
image

avatar richard67
richard67 - comment - 17 Aug 2025

@heelc29 Could you open a new issue with your findings? Maybe @brianteeman could then add his findings, too.

avatar rdeutz
rdeutz - comment - 17 Aug 2025

Thank you all for testing and pointing out the issues. I know there are still issues and I will do my best to fix them asap.

avatar ceford
ceford - comment - 3 Sep 2025

At the bottom of the Preview of Version form there is a com_fields label that looks like an untranslated string, along with two others above and one below. Is that a bug? And the current version is not marked! The Help screen says it is.

Add a Comment

Login with GitHub to post a comment