Feature Updates Requested PR-5.3-dev Pending

User tests: Successful: Unsuccessful:

avatar Denitz
Denitz
23 Mar 2023

Summary of Changes

We need to fix these problems:

  1. Articles imported into #__content table are not displayed in backend because current ArticlesModel has a weird INNER JOIN on #__workflow_associations table which can not contain the data for the articles imported manually.
  2. With enabled workflow feature, the article association in #__workflow_associations table is not automatically re-created on article save.
  3. I am sure that most of Joomla users are not using workflows, hence we need to use #__workflow_XXX tables only on demand. Similar like for associations.
  4. It will de-couple articles from #__workflow tables because we don't need this relationship if workflows are not used. Imho, the normal idea was to add workflow_stage_id column into #__content table and don't create #__workflow_associations which contains the mixed data from multiple extensions and makes a spaghetti in the database. Anyway, it's not the topic for this PR.

Testing Instructions

Import articles into #__content table directly.

These articles are not displayed in backend with/without workflow enabled.

Enable workflow and try to edit such article directly via ID in URL, save article - still no displayed.

Actual result BEFORE applying this Pull Request

No articles are displayed in backend.
No items are re-created in #__workflow_associations after article save with enabled workflow feature.

Expected result AFTER applying this Pull Request

All fine.

57ff045 23 Mar 2023 avatar Denitz fix
avatar joomla-cms-bot joomla-cms-bot - change - 23 Mar 2023
Category Administration com_content Libraries
avatar Denitz Denitz - open - 23 Mar 2023
avatar Denitz Denitz - change - 23 Mar 2023
Status New Pending
avatar brianteeman
brianteeman - comment - 23 Mar 2023

The problem is with the import script being used not with the core code. This pr is obviously wrong

avatar Denitz
Denitz - comment - 23 Mar 2023

@brianteeman I would totally disagree, what for do we need this extra dependency on #__workflow_associations table even if we don't use workflows?

avatar brianteeman
brianteeman - comment - 23 Mar 2023

You have a j3 site with a thousand articles. You upgrade to j4 and decide to use workflows. With this PR you can not do that unless you open and save all thousand articles

avatar Denitz
Denitz - comment - 23 Mar 2023

No.

This PR doesn't affect this case. It doesn't block creation of #__workflow_associations records for articles if workflow is disabled. It works event better and auto-creates missing records to minimize possible data loss.

avatar brianteeman
brianteeman - comment - 23 Mar 2023

How does it auto-create the missing record without the article being opened and saved again?

Honestly just fix the script you are using to import the articles

avatar Denitz
Denitz - comment - 23 Mar 2023

Two purposes:

  1. Don't load workflows data if workflows are not enabled.
  2. Auto-create missing workflow association on save of existing article.
    It helps to fix the possible issues with inconsistent database data. Otherwise, if article record is missed in #__workflow_associations, the user won't even see this article in backend.

Maybe we also need to always have records in #__content_rating table for all articles and INNER JOIN on it?

avatar brianteeman
brianteeman - comment - 23 Mar 2023

Exactly as I said. You cannot use workflow unless you open and save again all thousand articles

avatar Denitz
Denitz - comment - 23 Mar 2023

At least a user will be to do it.

a48d456 22 Sep 2023 avatar Denitz fix
avatar joomla-cms-bot joomla-cms-bot - change - 22 Sep 2023
Category Administration com_content Libraries Unit Tests Repository Administration com_admin SQL
avatar Denitz Denitz - change - 22 Sep 2023
Labels Added: bug PR-4.3-dev
avatar Denitz Denitz - change - 23 Sep 2023
Title
Allow articles with missing workflow data
[5.0] Allow articles with missing workflow data
avatar HLeithner HLeithner - change - 5 Oct 2023
Title
[5.0] Allow articles with missing workflow data
[5.1] Allow articles with missing workflow data
avatar HLeithner HLeithner - edited - 5 Oct 2023
avatar joomla-cms-bot joomla-cms-bot - change - 5 Oct 2023
Category Administration Unit Tests Repository com_admin SQL Administration com_content Libraries
avatar wilsonge
wilsonge - comment - 18 Oct 2023

I think the conditional join in the articles model is fine - that's how things already work for other extensions like voting and associations.

The part in default.php is also totally fine

I think the problem is in the workflow trait. This could be triggered in the frontend and be run on unlimited sites. I really don't think this is the right place to have it if you want to create associations. It's no different to the fact we don't magically create assets either. I'd remove it from here and it's fine. If we don't remove it I'm against this being merged in the current form. I'd be happy enough if it was some sort of backend status check.

avatar bembelimen
bembelimen - comment - 18 Oct 2023

Nice improvements.

Still I agree with @wilsonge here, we should not try to fix workflow associations when opening the article (read: the changes in the trait should not be done) but have a way to recover from a e.g. "broken" import without associations. All the other fixes are good, but could you (@Denitz ) enhance this PR to use the database repair to fix associations? (This could later be enhanced to also fix menus, categories, asset structures).

avatar HLeithner
HLeithner - comment - 24 Apr 2024

This pull request has been automatically rebased to 5.2-dev.

avatar HLeithner HLeithner - change - 24 Apr 2024
Title
[5.1] Allow articles with missing workflow data
[5.2] Allow articles with missing workflow data
avatar HLeithner HLeithner - edited - 24 Apr 2024
avatar HLeithner
HLeithner - comment - 2 Sep 2024

This pull request has been automatically rebased to 5.3-dev.

avatar HLeithner HLeithner - change - 2 Sep 2024
Title
[5.2] Allow articles with missing workflow data
[5.3] Allow articles with missing workflow data
avatar HLeithner HLeithner - edited - 2 Sep 2024
avatar richard67 richard67 - change - 15 Sep 2024
Labels Added: Feature Updates Requested PR-5.3-dev
Removed: bug PR-4.3-dev
avatar richard67
richard67 - comment - 15 Sep 2024

System tests are failing with PHP warning:
Undefined property: stdClass::$stage_title in /tests/www/cmysql/administrator/components/com_content/tmpl/articles/default.php on line 169. That could be caused by the changes of this PR in the articles model.

avatar brianteeman
brianteeman - comment - 15 Sep 2024

@richard67 as stated by others the failing system tests are the least of the issue with this PR

avatar richard67
richard67 - comment - 15 Sep 2024

@richard67 as stated by others the failing system tests are the least of the issue with this PR

@brianteeman Sure. I just wanted to document them here.

avatar Denitz
Denitz - comment - 15 Sep 2024

Undefined property: stdClass::$stage_title in /tests/www/cmysql/administrator/components/com_content/tmpl/articles/default.php on line 169

Fixed.

Add a Comment

Login with GitHub to post a comment