User tests: Successful: Unsuccessful:
If you have a script.php
in your extension which extends the Installerscript
but also implements the InstallerScriptInterface
you get an Internal Server Error because the preflight
in the Installerscript
does not match the function declaration in the InstallerScriptInterface
.
This is a little hard :)
script.php
to be used in an extension to be installedscript.php
needs to contain this code<?php
use Joomla\CMS\Installer\InstallerAdapter;
use Joomla\CMS\Installer\InstallerScript;
use Joomla\CMS\Installer\InstallerScriptInterface;
defined('_JEXEC') or die;
return new class () implements ServiceProviderInterface {
public function register(Container $container)
{
$container->set(
InstallerScriptInterface::class,
new class () extends InstallerScript implements InstallerScriptInterface {
public function install(InstallerAdapter $adapter): bool
{
return true;
}
public function update(InstallerAdapter $adapter): bool
{
return true;
}
public function uninstall(InstallerAdapter $adapter): bool
{
return true;
}
public function preflight(string $type, InstallerAdapter $adapter): bool
{
return true;
}
public function postflight(string $type, InstallerAdapter $adapter): bool
{
return true;
}
}
);
}
};
script.php
to your extensionInternal Server Error
You get an Internal Server Error
The extension is installed
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
Status | New | ⇒ | Pending |
Category | ⇒ | Libraries |
Thank you for the feedback. I will solve my issue in another way.
Status | Pending | ⇒ | Closed |
Closed_Date | 0000-00-00 00:00:00 | ⇒ | 2024-02-28 21:37:18 |
Closed_By | ⇒ | roland-d | |
Labels |
Added:
PR-5.1-dev
|
Is this not a bc break, as it would require that all extending classes , which do overwrite that function , need to be updated? That's why InstallerScript cannot implement the interface.