Skip to content

Conversation

conseilgouz
Copy link
Contributor

@conseilgouz conseilgouz commented Jul 1, 2025

Pull Request for Issue #45653 .

Summary of Changes

During extension installation, when calling Installer, Database not set in Joomla\CMS\Installer\Installer error is displayed

Testing Instructions

Install an extension that calls Installer function, like https://www.joomlack.fr/en/joomla-extensions/page-builder-ck

Actual result BEFORE applying this Pull Request

Installation fails with Database not set in Joomla\CMS\Installer\Installer error

Expected result AFTER applying this Pull Request

Installation is OK

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:

  • No documentation changes for manual.joomla.org needed

Database not set in Joomla\CMS\Installer\Installer error
@conseilgouz
Copy link
Contributor Author

Note : in J5.3, setDatabase was performed in Adapter construct function.
That's missing in the new Installer construct function.

@conseilgouz
Copy link
Contributor Author

PR #43792 replaces parent::__construct call by its local calls. $this->db is missing from the new code.

@conseilgouz
Copy link
Contributor Author

In #43792, libraries/src/Console/ExtensionInstallCommande.php has 2 calls to Installer (line 151 and line 184).

I think that setDatabase lines (152 and 185) are not required anymore as this will be done in Installer.php construct function (if this PR is accepted).

@bcordis
Copy link
Contributor

bcordis commented Aug 7, 2025

I have tested this item ✅ successfully on e57a3b4

Joomla 6.0.0-Alpha 3 PHP 8.3.14 Completed Successful

The install component fails without the patch.


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

@conseilgouz
Copy link
Contributor Author

Thank you @bcordis
One more to go and this could become RTC...

@Elfangor93
Copy link
Contributor

I have tested this item ✅ successfully on e57a3b4

Joomla 6.0.0-alpha4-dev, PHP 8.3.24, MySQL 8.4.0

Installation of extension successfully installed which fails without the patch.


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

@conseilgouz
Copy link
Contributor Author

Thank you @Elfangor93.
Let's wait for @rdeutz 's review.

@richard67
Copy link
Member

@conseilgouz Not a good idea to use the branch update button when a PR has successful human tests because this resets the test counter, and if that PR has 2 tests and not RTC yet, it might get lost. I will restore the test counter now. But keep it in mind for the next time.

@richard67 richard67 changed the title [6.0 alpha 2] Database not set in Joomla\CMS\Installer\Installer error [6.0 alpha 2] Database not set in Joomla\CMS\Installer\Installer error Aug 15, 2025
@richard67
Copy link
Member

RTC


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

@joomla-cms-bot joomla-cms-bot added the RTC This Pull Request is Ready To Commit label Aug 15, 2025
@conseilgouz
Copy link
Contributor Author

Thank you @richard67

No comment about : #45670 (comment) ?

Pascal

@richard67
Copy link
Member

Thank you @richard67

No comment about : #45670 (comment) ?

Pascal

@Hackwar Could you check that? Thanks in advance.

@Bodge-IT Bodge-IT requested a review from Hackwar August 16, 2025 11:23
@Hackwar
Copy link
Member

Hackwar commented Aug 16, 2025

I understand what you are trying to do here, but I don't think it is right. The goal is to inject the database object from the outside. Now however you are always fetching it from the container. This is actually a step backwards and you might as well just use Factory::getDbo() instead. If you are creating your own Installer instance, you also have to do the proper setup and inject the database object into it. I'm also not sure if this is a new issue, since the same was necessary in J5 already as well. I wouldn't merge this PR.

@richard67 richard67 added the RMDQ ReleaseManagerDecisionQueue label Aug 16, 2025
@conseilgouz
Copy link
Contributor Author

conseilgouz commented Aug 17, 2025

This PR is to fix issue #45653 : some extensions installation/update won't work in J6.0 without this PR (Joomgallery, pagebuilderCK, ... and one of my onw).

As stated in #45653 (comment) , it could be fixed by adding a note in installation documentation, but who reads it.

@Hackwar
Copy link
Member

Hackwar commented Aug 17, 2025

The code in the past which allowed this was https://github.com/joomla/joomla-cms/blob/5.3-dev/libraries/src/Adapter/Adapter.php#L92
As I wrote, this is actually expected behavior. We want injection and if we want to actually make this a reality, we have to break this at some point. The commit introducing this into the Installer was here: #37625

@Elfangor93
Copy link
Contributor

Whats the difference between injectibg the DB object by myself or take it automatically from the Container if its not yet set?

As far as I see, I could still inject my own instance..

@bembelimen bembelimen added the bug label Aug 20, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug PR-6.0-dev RMDQ ReleaseManagerDecisionQueue RTC This Pull Request is Ready To Commit
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants