? ? Pending

User tests: Successful: Unsuccessful:

avatar Hackwar
Hackwar
25 May 2020

This is a redo of #23432.

The content versioning in Joomla is a rather obscure feature. Parts of it run/are available for every extension that uses the base classes, others you have to specifically add to your code. There isn't really a way to not use that system. It is also tied into the UCM system and is unnecessarily complex. This PR tries to improve on that in a few ways. This does not claim to be the perfect solution (there is a lot of stuff to do in the future), but it is hopefully a step around the backwards compatibility issues that we would have if we want to work on this in 4.1 or later.

What does this PR do?

  • Decoupling of the versioning system from the UCM.
  • Simplifying code
  • Moving all versioning code to interfaces and traits
  • Instead of using magic fields/attributes, the support of versioning is clearly signaled by interfaces
  • Moved all the necessary code to a proper subfolder...

What did I do?

I changed the name of the history table from #__ucm_history to #__history, dropped the ucm_type_id column and changed the ucm_item_id column to a varchar and changed how it is used. That column now contains keys of the type <component>.<type>.<id>, which is also what is used everywhere to identify the content item to edit. By this, you don't need to read the content types table first to get the right item type ID. But more importantly for me, you can now look into the table and read what type of data a row is. I consider that a better solution for debugging and better than a composite key out of 2 columns.

Status

This PR is ready for testing. However, while migrating this code to the current 4.0-dev, several bugs in the 4.0-dev codebase have surfaced, which need to be fixed beforehand. I will report back here regarding those bugs.

How to test

  1. Apply the PR
  2. Apply the database changes of this PR
  3. Go to a core component that supports versioning, com_content for example, and create a content item. Save the item and edit it again, changing something. Saving again should create a new version. Editing again and saving without any changes shouldn't create a new version.
  4. In the edit view, click on the versions toolbar button and see that 2 versions have been created (Notice that the edit without a change does not show up here)
  5. Compare 2 versions and restore an older one. All of this should work.
avatar Hackwar Hackwar - open - 25 May 2020
avatar Hackwar Hackwar - change - 25 May 2020
Status New Pending
avatar joomla-cms-bot joomla-cms-bot - change - 25 May 2020
Category SQL Administration com_admin Postgresql com_banners com_categories com_contact com_content com_contenthistory com_newsfeeds com_tags com_users
avatar wilsonge wilsonge - change - 28 May 2020
Labels Added: ?
avatar Hackwar
Hackwar - comment - 29 May 2020

All fixed. Can we merge this now? Given the current time pressure. ;-)

avatar wilsonge wilsonge - change - 29 May 2020
Status Pending Fixed in Code Base
Closed_Date 0000-00-00 00:00:00 2020-05-29 23:40:20
Closed_By wilsonge
Labels Added: ?
avatar wilsonge wilsonge - close - 29 May 2020
avatar wilsonge wilsonge - merge - 29 May 2020
avatar wilsonge
wilsonge - comment - 29 May 2020

Thanks!

Add a Comment

Login with GitHub to post a comment