0

in joomla 4.0 beta2-dev, in the postflight method in script.php of my component i have put some code to create menus but at the end of installation of component the postflight isn't executed.

I have tried to put a die() but it has no effect :

public function postflight($type, $parent)
{
    $componentinstaller = new MycompnentModelInstall;
    $componentinstaller->createMenu();

    die();
}

Why it doens't goes into postflight ?

Thanks by advance

3
  • I’m not fully sure but almost that not only the postflight function but the whole script does not run and the most common reason of that is the name of the script class in your script.php file. We should see your full script file, otherwise we can just guess...
    – Zollie
    Jun 2, 2020 at 8:33
  • 1
    the component is made with a package, the script.php is this one and it is present into package : github.com/Kunena/Kunena-Forum/blob/K6.0/src/script.php . I haven't changed the postflight part on github branch Jun 2, 2020 at 11:21
  • And the preflight function is running from that file?
    – Zollie
    Jun 2, 2020 at 11:33

1 Answer 1

2

Since you kindly provided the link to the source files, I have downloaded your full Kunena package (6.0 dev.) (for Joomla 4.x.x dev.) just to give it a try and my short conclusion is the following: (well done for this extension, it looks good by the way!)

As I wrote in my first comment I assumed that the problem is caused by the class name of the script file which is at the moment:

class Pkg_KunenaInstaller extends InstallerScript

Then I ran a test within the preflight method of the script file but it did not run at all. Then I changed the script's class name to the following:

class Pkg_KunenaInstallerScript

And it runs without a problem. So the simple conclusion is: You do not have to/you cannot extend the InstallerScript class in your installer scripts as you did. Probably someone misunderstood or misspelled this at your developer team.

If you extend the base InstallerScript class correctly as the following then the inherited methods will work and the installer script will run too:

class Pkg_KunenaInstallerScript extends InstallerScript
1

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.