PR-4.4-dev Pending

User tests: Successful: Unsuccessful:

avatar laoneo
laoneo
5 Jun 2023

Summary of Changes

Injects the database into the installer script when possible. Like that installer scripts can access the database without loading it through the factory class.

Testing Instructions

Install any extension.

Actual result BEFORE applying this Pull Request

All works.

Expected result AFTER applying this Pull Request

All works.

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

avatar joomla-cms-bot joomla-cms-bot - change - 5 Jun 2023
Category Libraries
avatar laoneo laoneo - open - 5 Jun 2023
avatar laoneo laoneo - change - 5 Jun 2023
Status New Pending
avatar laoneo laoneo - change - 5 Jun 2023
The description was changed
avatar laoneo laoneo - edited - 5 Jun 2023
avatar brianteeman
brianteeman - comment - 5 Jun 2023

surely this is a new feature so must be for J5 and require documentation

avatar toivo toivo - test_item - 6 Jun 2023 - Tested successfully
avatar toivo
toivo - comment - 6 Jun 2023

I have tested this item successfully on 6ae40ef

Tested successfully in Joomla 4.4.0-dev of 5 May using Wampserver 3.3.1 and PHP 8.2.6


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

avatar sandewt
sandewt - comment - 7 Jun 2023

Install any extension.

I installed an extension and it works. The extension is installed.

Can I do an extra check, for example if $this->getDabase() can actually be loaded? Or is not that necessary?


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

avatar laoneo
laoneo - comment - 7 Jun 2023

Your installer script needs to use the db aware interface. Then $this->getDatabase() should be filled. If you can test this, that would be perfect.

avatar sandewt
sandewt - comment - 7 Jun 2023

I have tried something like this in the installer script.php file of mod_readingbar (= test module)

use Joomla\Database\DatabaseAwareInterface;
use Joomla\Database\DatabaseAwareTrait;

class mod_readingbarInstallerScript extends InstallerScript implements DatabaseAwareInterface
{
	use DatabaseAwareTrait;
public function postflight($type, $parent)
{
        // $db = Factory::getDbo(); // works, no error message
        $db = $this->getDatabase(); // works not, see error message below
	echo Text::_('MOD_READINGBAR_INSTALLERSCRIPT_POSTFLIGHT');

Schermafbeelding 2023-06-07 131916

avatar laoneo laoneo - change - 8 Jun 2023
Labels Added: PR-4.4-dev
avatar laoneo
laoneo - comment - 8 Jun 2023

Good catch, had to proxy the legacy installer class as well. Can you try again?

avatar sandewt sandewt - test_item - 8 Jun 2023 - Tested successfully
avatar sandewt
sandewt - comment - 8 Jun 2023

I have tested this item successfully on d58bbc8

I have tried something like this in the installer script.php file of mod_readingbar (= test module)

script.php works now


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

avatar laoneo
laoneo - comment - 9 Jun 2023

@toivo can you test this again with your extension? Thanks

avatar MacJoom MacJoom - close - 23 Jun 2023
avatar MacJoom MacJoom - merge - 23 Jun 2023
avatar MacJoom MacJoom - change - 23 Jun 2023
Status Pending Fixed in Code Base
Closed_Date 0000-00-00 00:00:00 2023-06-23 12:03:21
Closed_By MacJoom

Add a Comment

Login with GitHub to post a comment