Skip to content

Conversation

Hackwar
Copy link
Member

@Hackwar Hackwar commented Jul 14, 2024

Summary of Changes

This is an effort to remove deprecated code from the system. The Updater class depends on the Adapter class, which in turn has been deprecated for a long time already. This PR removes the code of the Adapter class from the Updater class and replaces it with some sane methods to add adapters when required.

This PR does some cleanup and it adds the following methods:

  • loadAdapters(): This iterates over the set folder and adds all files it finds as available updater adapters. To keep it light, the array only contains the name as key and either the class name as value or an object. The object is instantiated just in time when needed.
  • getAdapters(): This method keeps the behavior of the $custom parameter, but otherwise still just returns the list of available adapters
  • getAdapter(): This new method replaces loadAdapter() and either returns an object which was previously made or instantiates it from the class stored in the $adapters array.
  • setAdapter(): This new method allows to hand in a name for the adapter and either a class name or an instantiated object for the respective adapter type. This would allow you to add custom adapter types and also to overwrite existing adapter types.

I reused some method names from the Adapter class. This PR is a b/c break and thus targeted towards 6.0. This is the corresponding PR to #43792 for the Updater classes.

Testing Instructions

Install an old version of an extension and then run an update for it, both via the normal extension updater and by installing a newer package over the old one. This should work the same both before and after applying the change.

Link to documentations

Please select:

  • Documentation link for docs.joomla.org:

  • No documentation changes for docs.joomla.org needed

  • Pull Request link for manual.joomla.org: CMS Adapter removed Manual#301

  • No documentation changes for manual.joomla.org needed

@Bodge-IT
Copy link
Contributor

@Hackwar, sorry Hannes more conflicts need fixing. If we can sort this and #43792, we can merge #43794.

@Bodge-IT
Copy link
Contributor

@Hackwar Is this still relevant?

@Hackwar
Copy link
Member Author

Hackwar commented Feb 19, 2025

Yes, this is still a necessary PR.

@Bodge-IT
Copy link
Contributor

Bodge-IT commented Jun 6, 2025

...Awaiting capability to run updater

@Hackwar
Copy link
Member Author

Hackwar commented Jun 10, 2025

@muhme @Bodge-IT the PR is ready. Could you two test this? Since you already tested the other PR...

@muhme
Copy link
Contributor

muhme commented Jun 12, 2025

I have tested this item ✅ successfully on 0fbb612

Tested before PR with JBT, current 6.0-dev branch, PHP 8.4.7, enabled 'Log Almost Everything' and 'Log Deprecated API'

  • Installed module zitat-service.de version 2.0.1 from URL https://github.com/muhme/quote_joomla/releases/download/2.0.1/mod_zitat_service_de_2.0.1.zip, configured and checked it is working
  • Update 2.0.3 is shown as available (this needs targetplatform version 6 for the module), updated, checked version is updated in administrator backend and file system XML and checked is still working
  • Uninstalled the module and installed again 2.0.1 with file upload, configured and checked is working
  • Installed over by 'Upload Package File' with 2.0.3 ZIP, checked version is updated in administrator backend and file system XML and checked is still working

Installed 60 joomla-cms-43793, PHP 8.4.7, enabled 'Log Almost Everything' and 'Log Deprecated API'

  • Installed module zitat-service.de version 2.0.1 from URL https://github.com/muhme/quote_joomla/releases, configured and checked it is working
  • ✅ Update 2.0.3 is shown as available, updated, checked version is updated in administrator backend and file system XML and checked is still working
  • Uninstalled the module and installed again 2.0.1 with file upload, configured and checked is working
  • ✅ Installed over by 'Upload Package File' with 2.0.3 ZIP, checked version is updated in administrator backend and file system XML and checked is still working
  • Uninstalled the module and installed again 2.0.1, configured and checked is working
  • ✅ Installed over by 'Install from URL' with https://github.com/muhme/quote_joomla/releases/download/2.0.3/mod_zitat_service_de_2.0.3.zip, checked version is updated in administrator backend and file system XML and checked is still working
  • Uninstalled the module and installed again 2.0.1, configured and checked is working
  • ✅ Installed over by 'Install from Folder', checked version is updated in administrator backend and file system XML and checked is still working
  • Uninstalled the module and installed 2.0.1 with CLI, configured and checked is working
docker exec jbt-60 php cli/joomla.php extension:install --path /var/www/html/tmp/mod_zitat_service_de_2.0.1.zip
  • Installed over with CLI, checked version is updated in administrator backend and file system XML and checked is still working
docker exec jbt-60 php cli/joomla.php extension:install --path /var/www/html/tmp/mod_zitat_service_de_2.0.3.zip
  • ✅ no errors in administrator/logs/everything.php
  • the ~170'000 messages in administrator/logs/deprectaed.php search case independent for updat results in following, please check by your own:
$ grep -i updat joomla-60/administrator/logs/deprecated.php 
2025-06-12T09:08:46+00:00	WARNING 10.0.0.1	deprecated	Use method "getUrl" for value pre-processing is deprecated, and will not work in Joomla 6. Use "onGetUrl" instead. Event Joomla\CMS\Event\Installer\BeforeUpdateSiteDownloadEvent - [ROOT]/libraries/src/Event/AbstractEvent.php - Line 168
2025-06-12T09:08:46+00:00	WARNING 10.0.0.1	deprecated	Use method "getHeaders" for value pre-processing is deprecated, and will not work in Joomla 6. Use "onGetHeaders" instead. Event Joomla\CMS\Event\Installer\BeforeUpdateSiteDownloadEvent - [ROOT]/libraries/src/Event/AbstractEvent.php - Line 168
2025-06-12T09:09:28+00:00	WARNING 10.0.0.1	deprecated	Use method "getUrl" for value pre-processing is deprecated, and will not work in Joomla 6. Use "onGetUrl" instead. Event Joomla\CMS\Event\Installer\BeforeUpdateSiteDownloadEvent - [ROOT]/libraries/src/Event/AbstractEvent.php - Line 168
2025-06-12T09:09:28+00:00	WARNING 10.0.0.1	deprecated	Use method "getHeaders" for value pre-processing is deprecated, and will not work in Joomla 6. Use "onGetHeaders" instead. Event Joomla\CMS\Event\Installer\BeforeUpdateSiteDownloadEvent - [ROOT]/libraries/src/Event/AbstractEvent.php - Line 168
2025-06-12T09:09:28+00:00	WARNING 10.0.0.1	deprecated	Use method "getUrl" for value pre-processing is deprecated, and will not work in Joomla 6. Use "onGetUrl" instead. Event Joomla\CMS\Event\Installer\BeforeUpdateSiteDownloadEvent - [ROOT]/libraries/src/Event/AbstractEvent.php - Line 168
2025-06-12T09:09:28+00:00	WARNING 10.0.0.1	deprecated	Use method "getHeaders" for value pre-processing is deprecated, and will not work in Joomla 6. Use "onGetHeaders" instead. Event Joomla\CMS\Event\Installer\BeforeUpdateSiteDownloadEvent - [ROOT]/libraries/src/Event/AbstractEvent.php - Line 168
2025-06-12T09:09:28+00:00	WARNING 10.0.0.1	deprecated	Use method "getUrl" for value pre-processing is deprecated, and will not work in Joomla 6. Use "onGetUrl" instead. Event Joomla\CMS\Event\Installer\BeforeUpdateSiteDownloadEvent - [ROOT]/libraries/src/Event/AbstractEvent.php - Line 168
2025-06-12T09:09:28+00:00	WARNING 10.0.0.1	deprecated	Use method "getHeaders" for value pre-processing is deprecated, and will not work in Joomla 6. Use "onGetHeaders" instead. Event Joomla\CMS\Event\Installer\BeforeUpdateSiteDownloadEvent - [ROOT]/libraries/src/Event/AbstractEvent.php - Line 168
2025-06-12T09:19:15+00:00	WARNING 10.0.0.1	deprecated	Use method "getUrl" for value pre-processing is deprecated, and will not work in Joomla 6. Use "onGetUrl" instead. Event Joomla\CMS\Event\Installer\BeforeUpdateSiteDownloadEvent - [ROOT]/libraries/src/Event/AbstractEvent.php - Line 168
2025-06-12T09:19:15+00:00	WARNING 10.0.0.1	deprecated	Use method "getHeaders" for value pre-processing is deprecated, and will not work in Joomla 6. Use "onGetHeaders" instead. Event Joomla\CMS\Event\Installer\BeforeUpdateSiteDownloadEvent - [ROOT]/libraries/src/Event/AbstractEvent.php - Line 168

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

@Hackwar
Copy link
Member Author

Hackwar commented Jun 12, 2025

Thank you for testing. As far as I can see, none of the warnings you got are related to this PR, right?

@muhme
Copy link
Contributor

muhme commented Jun 12, 2025

Thank you for testing. As far as I can see, none of the warnings you got are related to this PR, right?

It seems so, as the deprecations are from different files, as touched with this PR. I was uncertain how to check. I checked now again with the three file names they are touched by the PR and result is zero ✅ 👍 😄

@Hackwar
Copy link
Member Author

Hackwar commented Jun 13, 2025

Unfortunately I had to do one more cleanup by removing a duplicate call to getAdapter().

@muhme
Copy link
Contributor

muhme commented Jun 13, 2025

Unfortunately I had to do one more cleanup by removing a duplicate call to getAdapter().

Null problemo, let me know when you're done, then I'll test again – my module is now Joomla 6 ready, this was my main effort; maybe put it on DRAFT by then?

@Hackwar
Copy link
Member Author

Hackwar commented Jun 13, 2025

It is ready. You can test this now.

@muhme
Copy link
Contributor

muhme commented Jun 13, 2025

I have tested this item ✅ successfully on b0685d4

Retestet with JBT and grafted 6.0.0-alpha2-dev+pr.43793 from current prebuild packages

  • Enabled 'Log Almost Everything' and 'Log Deprecated API'
  • Followed the same procedure as in the first test with install/configure/checks/install over/checks/uninstall:
    • ✅ Update 2.0.3 is shown as available, updated
    • ✅ Installed over by 'Upload Package File' with 2.0.3 ZIP
    • ✅ Installed over by 'Install from URL'
    • ✅ Installed over by 'Install from Folder'
    • ✅ Installed over with CLI, using file package
    • ✅ Installed over with CLI, using URL
    • ✅ no errors in administrator/logs/everything.php
    • ✅ no deprecation entries for the ExtensionAdapter.php, Updater.php and UpdateAdapter.php in the ~136.000 lines
      This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/43793.

@exlemor
Copy link

exlemor commented Jun 16, 2025

I have tested this item ✅ successfully on b0685d4

I have successfully tested this.

Used JoomDonation v5.10.9 to update to JoomDonation v5.11.0, also upgraded 2 different Language Packs to latest version.
(I also tried installing a few J6 compatible apps as a test, like Regular Labs Cache Cleaner 9.60 and others)

(the Joomla Updater did NOT find the updated version of JoomDonation online, but I was able to install v5.11 on top of v5.10.9 via uploading the file)

I did NOT test over CLI or locally. I only tested via online my hosting testing environments.


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

@muhme
Copy link
Contributor

muhme commented Jun 17, 2025

@ exlemor Thank you for testing 👍

the Joomla Updater did NOT find the updated version of JoomDonation online

If you check the update XML https://joomdonation.com/updates/jdonation.xml, there is no 6.0 target platform, so no update is offered correctly.

@rdeutz
Copy link
Contributor

rdeutz commented Jun 17, 2025

Thanks for testing, RTC


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

@joomla-cms-bot joomla-cms-bot added the RTC This Pull Request is Ready To Commit label Jun 17, 2025
@Bodge-IT Bodge-IT merged commit 2820bc1 into joomla:6.0-dev Jun 17, 2025
4 checks passed
@joomla-cms-bot joomla-cms-bot removed the RTC This Pull Request is Ready To Commit label Jun 17, 2025
@Bodge-IT
Copy link
Contributor

Thanks everyone, @Hackwar, @muhme & @exlemor . Great work.

@Hackwar
Copy link
Member Author

Hackwar commented Jun 17, 2025

I can't begin to express how happy I am that this is finally done. Thank you to all who tested, reviewed and now merged. I've been trying to fix the adapter classes during the development of 1.6 and tried again in 2.5 and 3.5. For 4.0 unfortunately I didn't get around to fixing this, but now for 6.0 we can finally get rid of this.

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.

8 participants