Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Uninstall error is thrown before uninstall preflight is executed #44511

Open
Roeilab opened this issue Nov 23, 2024 · 2 comments
Open

Uninstall error is thrown before uninstall preflight is executed #44511

Roeilab opened this issue Nov 23, 2024 · 2 comments

Comments

@Roeilab
Copy link

Roeilab commented Nov 23, 2024

Steps to reproduce the issue

  • Create an install script in line with Joomla documentation https://manual.joomla.org/docs/building-extensions/install-update/installation/install-process/
  • Add the script to the manifest of your template
  • Add two lines of code to the preflight function (line 1 and 4 below):
    use Joomla\CMS\Log\Log;
    public function preflight(string $type, InstallerAdapter $parent): bool
    {
    Log:add('preflight: ' . $type);
    return true;
    }
  • Install your template, and set it to default (you can do that in postflight function or manually)
  • Uninstall your template

Expected result

  1. The line 'preflight: uninstall' is written to the log file
  2. Joomla throws a warning: Template Uninstall: Can't remove default template

Actual result

  1. Joomla throws a warning: Template Uninstall: Can't remove default template
  2. The line 'preflight: uninstall' is NOT written to the log file

System information (as much as possible)

Additional comments

In the preflight function you should have the opportunity to set the cassiopeia template back to default, and then proceed with uninstall of your custom template. That way you avoid: Template Uninstall: Can't remove default template. That is how it worked on older versions of the install script. But now the uninstall aborts before preflight.

@alikon
Copy link
Contributor

alikon commented Dec 17, 2024

that's how it works since j4 didn't check on j3

imho we cannot delegate to the template developer to do this check

for me it's not a bug but expected behaviuor

@Roeilab
Copy link
Author

Roeilab commented Dec 17, 2024

I am sorry. It's a bug. I have reverted to legacy which works fine.

Suppose you want to remove a template at uninstall. Then you must first set a new default template during preflight before you can do the uninstall. But in the current version an error is thrown because you are trying to uninstall the default template. That error should not be thrown at preflight. In preflight you should be allowed to do all the actions necessary to prepare the uninstall. It works fine in legacy.


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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants