User tests: Successful: Unsuccessful:
Injects the database into the installer script when possible. Like that installer scripts can access the database without loading it through the factory class.
Install any extension.
All works.
All works.
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
Category | ⇒ | Libraries |
Status | New | ⇒ | Pending |
I have tested this item
Tested successfully in Joomla 4.4.0-dev of 5 May using Wampserver 3.3.1 and PHP 8.2.6
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?
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.
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');
Labels |
Added:
PR-4.4-dev
|
Good catch, had to proxy the legacy installer class as well. Can you try again?
I have tested this item
I have tried something like this in the installer script.php file of mod_readingbar (= test module)
script.php works now
Status | Pending | ⇒ | Fixed in Code Base |
Closed_Date | 0000-00-00 00:00:00 | ⇒ | 2023-06-23 12:03:21 |
Closed_By | ⇒ | MacJoom |
surely this is a new feature so must be for J5 and require documentation