J3 and J4 compatibility

147 views
Skip to first unread message

Roger Creagh

unread,
Jun 2, 2021, 5:22:06 PM6/2/21
to joomla-dev-general
Hi all
I had understood from early reading of the limited info on migrating from J3 to J4 that it was possible to write a component that would work in J3 (v3.9+) and also in J4, albeit without using some of the J4 features.

However looking at the tutorial which Glen Arkell kindly linked (https://docs.joomla.org/J4_Component_example_-_Mywalks) it seems that this is very far from the case. There are lots of differences in file structure, naming and the way namespacing works that seem to imply that it would simply not be possible to have a single source code that would run on both J3 and J4.

Was the compatibility abandoned? Or was it just a pipe-dream of mine and it was never planned.

But then the Upgrade advisor tool in J3.10 seems to imply that it is possible to have a component that works in both, and when I look in the JED I see plenty of components that say they are both J3 and J4beta compatible - are they actually using separate files depending which version they are targeting.

I'm very confused. If it is possible to write a component that will work in both then is there a guide as to what needs to be done?

Hoping someone can shed some light into this dark and confusing place.

Roger

Hannes Papenberg

unread,
Jun 3, 2021, 1:56:00 AM6/3/21
to Joomla! General Development
No, J3 components will still work in J4, hopefully with minimal changes. What you read is the future structure for J4-only components.

--
You received this message because you are subscribed to the Google Groups "Joomla! General Development" group.
To unsubscribe from this group and stop receiving emails from it, send an email to joomla-dev-gene...@googlegroups.com.
To view this discussion on the web, visit https://groups.google.com/d/msgid/joomla-dev-general/ab9fa931cb28f9f3f1fb93ba4b38094483a80521.camel%40gmail.com.

Roger Creagh

unread,
Jun 6, 2021, 3:25:06 AM6/6/21
to joomla-de...@googlegroups.com
Thanks Hannes,

That's what I thought I had read, but so far I have failed to get any of my components to even install on a J4 localhost test - no error messages or clues why, just component failed to install and I can't find any helpful links as to what the differences in the install xml or script or sql requirement for a J4 install might be, so I am stuck before even debugging any odd dependencies or out of date legacy code I might have still in there.

Just reinforces my impression that J4 sucks and is a pointless bloat - unless the migration path for a developer is easy I don't envisage ever switching any of my sites. I'm pleased to see that development on J4 seems to have stalled and be taking much longer than expected, hopefully we'll soon get an announcement that it has all been a terrible mistake and J3.11 will proceed forthwith. [rant over]

Roger

Hannes Papenberg

unread,
Jun 6, 2021, 5:07:41 AM6/6/21
to Joomla! General Development
You did notice that we just released an RC, right? J4 will be coming and pretty soon as well. There will definitely not be a 3.11. considering the loads of code you can delete by using J4, I would call that everything but bloat. 

Without seeing your extension, it's hard to give any further advice, but there are J3 extensions, which work perfectly fine.

--
You received this message because you are subscribed to the Google Groups "Joomla! General Development" group.
To unsubscribe from this group and stop receiving emails from it, send an email to joomla-dev-gene...@googlegroups.com.

Glenn Arkell

unread,
Jun 6, 2021, 5:30:10 AM6/6/21
to Joomla! General Development
Hi Roger,
Now that you've got that rant out of your system, lol, I think J4 is looking good.  If you want to send me a "simple" component I happy to have a look to see if there is something obvious I can point out?  Cheers.
Glenn

Roger Creagh

unread,
Jun 7, 2021, 3:45:00 AM6/7/21
to joomla-de...@googlegroups.com
Glad you appreciated it was just a frustrated rant. Thanks for the offer, I will take it up when I get some time. As I said my first issue is the simple failure to install - so there must be some changed, but backward compatible, requirements for the xml and/or install script and/or install sql. 
They may be documented somewhere, but I have yet to find them.

Cheers
Roger

Cliff Ford

unread,
Jun 8, 2021, 3:57:06 AM6/8/21
to joomla-de...@googlegroups.com
Have you tried the Joomla 4 Tutorials Project:

https://docs.joomla.org/JDOC:Joomla_4_Tutorials_Project

Cliff
> --
> You received this message because you are subscribed to the Google
> Groups "Joomla! General Development" group.
> To unsubscribe from this group and stop receiving emails from it, send
> an email to joomla-dev-gene...@googlegroups.com
> <mailto:joomla-dev-gene...@googlegroups.com>.
> To view this discussion on the web, visit
> https://groups.google.com/d/msgid/joomla-dev-general/f65e188b8589f282f6c29343e068fc2a78dea56d.camel%40gmail.com
> <https://groups.google.com/d/msgid/joomla-dev-general/f65e188b8589f282f6c29343e068fc2a78dea56d.camel%40gmail.com?utm_medium=email&utm_source=footer>.

Roger Creagh

unread,
Jun 14, 2021, 10:12:33 AM6/14/21
to joomla-de...@googlegroups.com
Thanks Cliff, but nothing there about making a J3 extension work with J4, its all about starting from scratch developing for J4.

Since J3 will be around for years we really need a guides on a) how to make an existing J3 component work in J4 and b) how to make a J4 component that works in J3.

Roger

Glenn Arkell

unread,
Jun 15, 2021, 2:23:02 AM6/15/21
to Joomla! General Development
Hi Roger,  Try https://docs.joomla.org/Special:MyLanguage/Potential_backward_compatibility_issues_in_Joomla_4.  As a side note I've been slowly moving my code to be using namespace etc so that I was ready for J4 back on 3.9.0 and reviewing the API listing for 3.9 to see classes/methods I was using and making note of any deprecated ones.  Having said all this, as I'm retired, I had the time to work through this.  My offer of reviewing a component that doesn't install in J4 still stands (https://extensions.joomla.org/extension/election-voting-management/).  Cheers.
Glenn

Mathew Lenning

unread,
Jun 15, 2021, 9:02:22 AM6/15/21
to Joomla! General Development
I think if you were keeping track of what classes were deprecated over the last couple of years then your extensions should be fine. 
With the exception of BS 2.3 incompatibly in the back-end of J4. I got around that with a CSS Shiv. 

Basically I check which version of Joomla I'm on and then include the shiv if the major version is greater than 3 and we're in the back-end.  
There is probably a better way to do it, but it works and doesn't require a bunch of additional technical debt, so I'm good with it. 

Roger does the extension you're having trouble with use an installer script? When I first tested installing my component in J4 it failed without any real info. The culprit ended up being a deprecated JInstaller::get method reference in the installer script. 
Not sure if that is what's causing your headache, but it might be worth investigating. 

Roger Creagh

unread,
Jun 15, 2021, 2:10:36 PM6/15/21
to joomla-de...@googlegroups.com
On Tue, 2021-06-15 at 06:02 -0700, Mathew Lenning wrote:
Roger does the extension you're having trouble with use an installer script? When I first tested installing my component in J4 it failed without any real info. The culprit ended up being a deprecated JInstaller::get method reference in the installer script. 

AH, that is really helpful. I'm reasonably sure I'm up to date with deprecated methods and using namespaces in the body of the components, but I may very well have missed something in the installer script as that has got quite complex (in my terms, not compared to some!). I do just get install failed message with no info.

Incidentally I also don't seem to get any debugging output when I turn debug system on in j4 (running on localhost). The help file says debug info will be displayed at the bottom of every page in both front and backend (ie as with j3) but I get no output. Is it a feature that isn't working yet?
Reply all
Reply to author
Forward
0 new messages