Skip to content

[6.1] use DatabaseFactory in DatabaseServiceProvider#45057

Open
heelc29 wants to merge 11 commits intojoomla:6.1-devfrom
heelc29:5.3/database/provider
Open

[6.1] use DatabaseFactory in DatabaseServiceProvider#45057
heelc29 wants to merge 11 commits intojoomla:6.1-devfrom
heelc29:5.3/database/provider

Conversation

@heelc29
Copy link
Contributor

@heelc29 heelc29 commented Mar 2, 2025

Summary of Changes

DatabaseDriver::getInstance is deprecated and should be replaced with DatabaseFactory->getDriver()
https://github.com/joomla-framework/database/blob/d13a7504471b4730a8107e3566c6fe6d476706fc/src/DatabaseDriver.php#L269-L288

Testing Instructions

install Joomla and visit frontend/backend and see if you can do anything (connection to database is present)

Actual result BEFORE applying this Pull Request

Warning in deprecated log: DatabaseDriver::getInstance is deprecated and will be removed in 3.0, use DatabaseFactory::getDriver() instead.

 ------ -------------------------------------------------- 
  Line   libraries/src/Service/Provider/Database.php       
 ------ -------------------------------------------------- 
  123    Call to deprecated method getInstance() of class  
         Joomla\Database\DatabaseDriver:                   
         3.0  Use DatabaseFactory::getDriver() instead     
         🪪  staticMethod.deprecated                       
 ------ -------------------------------------------------- 

Expected result AFTER applying this Pull Request

Warning gone

Link to documentations

Please select:

  • No documentation changes for docs.joomla.org needed
  • No documentation changes for manual.joomla.org needed

@heelc29
Copy link
Contributor Author

heelc29 commented Mar 2, 2025

Failing CI related to #45059

 Error: Unwanted PHP Deprecated: "  htmlspecialchars(): Passing null to parameter #1 ($string) of type string is deprecated in <b>/tests/www/cmysql/administrator/modules/mod_logged/tmpl/default.php</b> on line <b>36</b>"

Co-Authored-By: Oleg Voronkovich <oleg-voronkovich@yandex.ru>
@exlemor
Copy link

exlemor commented Mar 15, 2025

Hi @heelc29, I might be doing something incorrectly or the testing instructions are incomplete or I couldn't replicate the BEFORE condition as I could not find in the Deprecated.php log any mention of Call to deprecated method getInstance() of class
Joomla\Database\DatabaseDriver:
3.0 Use DatabaseFactory::getDriver() instead
🪪 staticMethod.deprecated

You night want to update your Testing Instructions to advise the turn: Log Deprecated API in Global Configuration if that is where a tester is supposed to find this information...

@heelc29
Copy link
Contributor Author

heelc29 commented Mar 15, 2025

Hi @heelc29, I might be doing something incorrectly or the testing instructions are incomplete or I couldn't replicate the BEFORE condition as I could not find in the Deprecated.php log any mention of Call to deprecated method getInstance() of class Joomla\Database\DatabaseDriver: 3.0 Use DatabaseFactory::getDriver() instead 🪪 staticMethod.deprecated

Hi @exlemor sorry that I was a bit unclear in the description ... this message comes from phpstan in drone ci, I saw it also with XDebug.

You night want to update your Testing Instructions to advise the turn: Log Deprecated API in Global Configuration if that is where a tester is supposed to find this information...

image

Strangely, it is not logged here - probably because it is in the service provider?

@heelc29
Copy link
Contributor Author

heelc29 commented Mar 15, 2025

Update more DatabaseDriver::getInstance

Also add system test for config cli command

@heelc29 heelc29 force-pushed the 5.3/database/provider branch from 5f8e76b to 893cb7b Compare March 15, 2025 14:05
@heelc29 heelc29 marked this pull request as draft March 15, 2025 15:34
@heelc29 heelc29 marked this pull request as ready for review July 30, 2025 17:38
@HLeithner HLeithner changed the base branch from 5.3-dev to 5.4-dev October 15, 2025 17:09
@HLeithner
Copy link
Member

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

@HLeithner HLeithner changed the base branch from 5.4-dev to 6.1-dev October 15, 2025 18:00
@HLeithner
Copy link
Member

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

@HLeithner HLeithner changed the title [5.3] use DatabaseFactory in DatabaseServiceProvider [6.1] use DatabaseFactory in DatabaseServiceProvider Nov 24, 2025
@HLeithner
Copy link
Member

@heelc29 the system test error seems to be related.

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

Comments