Skip to content

[dev/joomla#70] Remove legacy Joomla 3 compatible code - #38297

Draft
webmaster-cses-org-uk wants to merge 2 commits into
civicrm:masterfrom
webmaster-cses-org-uk:joomla-version-tidy
Draft

webmaster-cses-org-uk wants to merge 2 commits into
civicrm:masterfrom
webmaster-cses-org-uk:joomla-version-tidy

Conversation

@webmaster-cses-org-uk

Copy link
Copy Markdown
Contributor

Overview

Work towards dev/joomla#70.

This PR removes all legacy code for Joomla! 3 and earlier versions.

Do not merge before CiviCRM 6.23 (Feb 2027) as this removes J3 support.

Before

Multiple branches of code for J3 and earlier, wrapped in version_compare() with JVERSION etc.

After

All legacy code removed.

Technical Details

No (intended) functional changes - removing legacy and in theory unreachable code only.

Comments

Briefly tested with Joomla! 5.4.11 and CiviCRM 6.20.1. I doubt have been able to exercise every line. Unit test coverage may not be very good for the affected code areas.

@civibot

civibot Bot commented Nov 25, 2026

Copy link
Copy Markdown

🤖 Thank you for contributing to CiviCRM! ❤️ We will need to test and review this PR. 👷

Introduction for new contributors...
  • If this is your first PR, an admin will greenlight automated testing with the command ok to test or add to whitelist.
  • A series of tests will automatically run. You can see the results at the bottom of this page (if there are any problems, it will include a link to see what went wrong).
  • A demo site will be built where anyone can try out a version of CiviCRM that includes your changes.
  • If this process needs to be repeated, an admin will issue the command test this please to rerun tests and build a new demo site.
  • Before this PR can be merged, it needs to be reviewed. Please keep in mind that reviewers are volunteers, and their response time can vary from a few hours to a few weeks depending on their availability and their knowledge of this particular part of CiviCRM.
  • A great way to speed up this process is to "trade reviews" with someone - find an open PR that you feel able to review, and leave a comment like "I'm reviewing this now, could you please review mine?" (include a link to yours). You don't have to wait for a response to get started (and you don't have to stop at one!) the more you review, the faster this process goes for everyone 😄
  • To ensure that you are credited properly in the final release notes, please add yourself to contributor-key.yml
  • For more information about contributing, see CONTRIBUTING.md.
PR commands & links...
  • /rebase <?branch-name> will rebase your branch and change the base of the PR (if <branch-name> is specified).
  • /squash will combine all commits (keeping only the first commit messsage).
  • /port <branch-name> will create a copy of this PR against a different branch.
  • /lint will automatically fix linting errors, amending commits as needed.
  • retest this please will rerun the tests and rebuild the demo site.
  • 📖 Review standards
  • 🗒️ Review template (brief or verbose)

➡️ Online demo of this PR 🔗

@civibot civibot Bot added the master label Nov 25, 2026
@webmaster-cses-org-uk

Copy link
Copy Markdown
Contributor Author

@seamuslee001 @vingle FYI

@colemanw

Copy link
Copy Markdown
Member

@civireview

@civireview civireview left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

CiviReview: 🟢 Ready · 5/5 ★★★★★

Removes all Joomla 3 and earlier compatibility branches (version_compare/JVERSION, JFactory, jimport) from core Joomla code, authx and setup, leaving only the Joomla 4+ code paths. The PR says it must not merge before 6.23.

No findings above the confidence gate.

✅ CI · ✅ Base tests · ✅ Surface · ✅ Taint · ✅ Browser

Verification (5 checks, 1 not verified)

Merge confidence (5/5): No verified issues; passed CI / Jenkins, Base-Test Regression, Live Surface Diff.

PR: civicrm/civicrm-core#38297 · Profile: core-extension · Kind: security-sensitive · Commits: 4fc75cc → 8c5342c

Check Status Detail
CI / Jenkins ✅ PASS 1 CI checks: 1 passed, 0 failed, 0 pending.
Base-Test Regression ✅ PASS PR merged into 4fc75cc: 27 test(s) passed on A and B
Live Surface Diff ✅ PASS Live APIv4/APIv3/routes/Afform surface diff captured with 0 risk flags.
Static / Taint Delta ✅ PASS Executed [cktaint] with 0 finding(s).
Browser A/B (Standalone) ✅ PASS Probed 1 route(s), 1 screenshot pair(s); 0 new console/page/network/a11y/render regressions.

Not verified:

  • No added/modified PHPUnit tests in PR; Proof-of-Fix A/B test skipped.

Standalone browser A/B

  • Probed routes (1): civicrm/payment/ipn
  • New console errors: 0 · Page errors: 0 · Network failures: 0 · A11y violations: 0 · Render regressions: 0
  • Screenshots: 1 before/after pair(s) captured
More: Walkthrough · blast radius · related (1)

Walkthrough

  • CONFIRMED: The PR changes five files: Permission/Joomla, Hook/Joomla, System/Joomla, authx/Joomla and InstallJoomlaSettingsFile. Every version_compare(JVERSION, ...) branch now uses only the J4+ API (\Joomla\CMS\Factory, UserHelper, Table\User, Uri, Filesystem\File). At head, greps of CRM/, ext/ and setup/ find no JFactory, JUserHelper, jimport, JTable, JURI or JFile. The only remaining JVERSION uses are in CRM_Utils_System_Joomla::url() and getJVersion().
  • CONFIRMED: The public method CRM_Utils_System_Joomla::factoryClassName() is removed. Its callers were all inside CRM/Utils/System/Joomla.php and are now inlined. An index-wide search outside that file (civicrm_grep factoryClassName\() found 0 callers in any indexed extension. A release-note mention would still help unindexed third-party code that calls it.
  • CONFIRMED (auth paths): authenticate() and authx checkPassword() now always call \Joomla\CMS\User\UserHelper::verifyPassword. The dropped md5/salt check only ran on Joomla below 2.5.18 or 3.0–3.2.1. loginSession, logoutSession and getCurrentUserId keep the same J4 logic they had before. The removed authx constructor only called jimport on J<4.
  • CONFIRMED (harmless leftovers, not defects): in url() (lines 308-317), the $forceBackend branch still computes $joomlaVersion, which is now unused. The /administrator/ rewrite is now unconditional, which matches the old behaviour on J>=1.6. loadJoomlaFramework() (lines 991-997) still has the J3-era import.legacy.php/cms.php fallbacks, which are unreachable on J4+. In getJVersion(), changing require to require_once is strictly safer against redeclaring the class.
  • PROVEN (limited): In the A/B run, 27 tests passed on both stacks with no regressions, including CRM_Core_Permission_JoomlaTest::testTranslate. The standalone browser probe showed no new errors. The image is standalone, so neither check runs Joomla code.
  • NOT VERIFIED: The standalone stacks cannot run any Joomla code: login/authenticate, createUser, user sync, the CLI/cron bootstrap, the hook plugin trigger and the installer File::write. The author reports only a brief test on Joomla 5.4.11. The PR body says this must not merge before 6.23 (Feb 2027). That gate depends on milestone/process and cannot be checked in the code.

Ecosystem blast radius

Repo Path Symbol Impact
civicrm-core CRM/Utils/System/Joomla.php CRM_Utils_System_Joomla::factoryClassName The public method is removed. No callers were found in indexed repos, but unindexed third-party code that calls it would fatal.
civicrm-core ext/authx/Civi/Authx/Joomla.php Civi\Authx\Joomla Password and session handling are now J4+ only. Behaviour on J4+ is unchanged.
civicrm-core CRM/Utils/Hook/Joomla.php CRM_Utils_Hook_Joomla::invokeViaUF Hooks are now always triggered via PluginHelper and Factory::getApplication(). This was already the J4+ path.
civicrm-core setup/plugins/installFiles/InstallJoomlaSettingsFile.civi-setup.php installFiles The installer now uses only Uri::root() and \Joomla\Filesystem\File::write.

Related open PRs and issues

Item Relation Confidence Why
dev/joomla#61 — Joomla 6 Compatibility 🔗 related 60% It covers Joomla 6 compatibility work in the same Joomla system and authx code that this PR simplifies to J4+ APIs.

Automated AI-assisted review, alpha: it may miss issues or report false positives, so verify findings before acting and open an issue with feedback. Reviewed by civireview · sonnet-opus · 1,049,607 tokens · $0.68

@eileenmcnaughton

Copy link
Copy Markdown
Contributor

I feel like civi-review missed a trick here with it's glowing review... Do not merge before CiviCRM 6.23 (Feb 2027) as this removes J3 support.

@webmaster-cses-org-uk

Copy link
Copy Markdown
Contributor Author

@colemanw @eileenmcnaughton The AI review did however pick up on the following, which I have now also resolved:

  • Remove unused variables in CRM_Utils_System_Joomla::url()
  • Remove deprecated include paths from CRM_Utils_System_Joomla::loadJoomlaFramework()

There was also a J1.5-era path (administrator/index2.php) in url() which it didn't spot but I have removed.

@vingle

vingle commented Nov 26, 2026

Copy link
Copy Markdown
Contributor

I feel like civi-review missed a trick here with it's glowing review.

@jfilter - it looks like CiviReview is doing two distinct things: reviewing the output for errors and omissions, and giving a confidence rating about how valid it is to merge. The former seems evidently useful, the latter quite a bit riskier, given all we now know about algorithmic bias (humans consistently trust machine-output more than human, even when they know the machine output may be flawed).

It seems there's a few contexts where a review of the code might miss either key information in the description like here, or visual bugs that are only apparent when the output is rendered by a browser, or specific CMS (or in the case of another 5 star review of a breaking PR, specific viewport). Presumably descriptions that say this PR does ABC, where the output does BCD perfectly might also be hard to spot.

Do you think the rating side of the review could be made less prominent/confident? or set to a much higher threshold so the default good review is lower? Or to be a little more scientific - hold off publishing ratings, keeping a confidence score private/separate until the tool's accuracy itself has been verified over a a few weeks/months of PRs and feed that back into the rating system. That way there could be some kind of threshold where 5 star might mean a level where 99 in 100 reviews need no further work, and 4 star 90 in 100 etc.

@vingle

vingle commented Nov 26, 2026

Copy link
Copy Markdown
Contributor

But @webmaster-cses-org-uk - this (and the other PRs) are really great to see!

@colemanw

Copy link
Copy Markdown
Member

@eileenmcnaughton I feel like civi-review missed a trick here with it's glowing review... Do not merge before CiviCRM 6.23 (Feb 2027) as this removes J3 support.

I also missed that. Where is our Joomla timeline documented?

@colemanw
colemanw marked this pull request as draft November 26, 2026 13:40
@jfilter

jfilter commented Nov 26, 2026

Copy link
Copy Markdown
Contributor

@vingle @eileenmcnaughton

CiviReview is very far from being perfect, and this PR shows some of its limitations. But I still think it's better than the way I and others have done AI reviews before. Before, people just said "review this PR" to a model and hoped it would dig something up. This is more reproducible.

The score, for example, is calculated by this simple algorithm: https://github.com/civico-de/civireview/blob/main/docs/reading-a-review.md#merge-confidence (which of course relies on the model for the findings).

I feel like civi-review missed a trick here with it's glowing review... Do not merge before CiviCRM 6.23 (Feb 2027) as this removes J3 support.

It is written in the summary, but I agree it's easy to miss. I will add some new features, e.g. a check for those "requirements before merge", and I'll also look into more browser automation.

Do you think the rating side of the review could be made less prominent/confident

I'm really happy to improve the language around this. Maybe a simpler change would be to never say "5/5 Ready" but something more like "5/5 no issues apparent"? Would this help? I see it more like CI: just because something is green doesn't mean you should merge it right away.

For me, it would be easiest if we continue like this and test it on real PRs. I don't have any other infrastructure or platform where the results are displayed.

@colemanw

Copy link
Copy Markdown
Member

@jfilter I agree "No issues found" is better since it's not civireview's job to assess merge readiness (only that the PR is ready to be reviewed by a human).

@jfilter

jfilter commented Nov 26, 2026 •

Copy link
Copy Markdown
Contributor

@colemanw Done. The verdicts are now No issues found, Questions only and Issues found, and the number is just "Score", without stars and without "merge confidence". The Outside this review section states that verdict and score prepare a human review and do not replace it.

Also from this PR: conditions for merging that the description states (like "do not merge before 6.23") now lead the To address list, and a change to one CMS integration is recorded on that CMS instead of only on Standalone.

@vingle

vingle commented Nov 26, 2026

Copy link
Copy Markdown
Contributor

Where is our Joomla timeline documented?

@colemanw - in the linked issue above (proposed by @seamuslee001 last month) https://lab.civicrm.org/dev/joomla/-/work_items/70

@eileenmcnaughton

Copy link
Copy Markdown
Contributor

Thanks @jfilter - all these tweaks will improve it!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants