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

[4.4] #38840 Module uninstallation error handling #38891

Open
wants to merge 8 commits into
base: 4.4-dev
Choose a base branch
from

Conversation

BrainforgeUK
Copy link
Contributor

@BrainforgeUK BrainforgeUK commented Oct 2, 2022

Pull Request for Issue #38840 .

Summary of Changes

Gracefully handle error on module uninstallation due to error in module XML manifest file.

$clientPath = ($this->parent->extension->client_id ? JPATH_ADMINISTRATOR : JPATH_SITE);
$source = $path ?: $clientPath . '/modules/' . $extension;
      ... existing ...
$client = (string) $this->getManifest()->attributes()->client;
if (strlen($client))
{
    $this->doLoadLanguage($extension, $source, \constant('JPATH_' . strtoupper($client)));
}
else {
    $this->doLoadLanguage($extension, $source, $clientPath);
}

Testing Instructions

Install a module with this in the manifest:

Instead of:

Then try to uninstall it.

Actual result BEFORE applying this Pull Request

Uninstallation fails.

Get error Undefined constant "JPATH_"

1 () JROOT\libraries\src\Installer\Adapter\ModuleAdapter.php:370
2 constant() JROOT\libraries\src\Installer\Adapter\ModuleAdapter.php:370
3 Joomla\CMS\Installer\Adapter\ModuleAdapter->loadLanguage() JROOT\libraries\src\Installer\Adapter\ModuleAdapter.php:525
4 Joomla\CMS\Installer\Adapter\ModuleAdapter->setupUninstall() JROOT\libraries\src\Installer\InstallerAdapter.php:1150
5 Joomla\CMS\Installer\InstallerAdapter->uninstall() JROOT\libraries\src\Installer\Installer.php:875
6 Joomla\CMS\Installer\Installer->uninstall() JROOT\administrator\components\com_installer\src\Model\ManageModel.php:262

This is due to missing client="site" in module manifest.

Expected result AFTER applying this Pull Request

Uninstallation succeeds.

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

## Summary of changes
Gracefully handle missing client="site" in module manifest.
See joomla#38840

## Testing Instructions
Install a module with this in the manifest:
<extension type="module" method="upgrade" version="2.5"> 
Instead of:
<extension type="module" client="site" method="upgrade" version="2.5"> 

Then try to uninstall it.
@richard67
Copy link
Member

@BrainforgeUK Please fix the code style errors reported by drone here: https://ci.joomla.org/joomla/joomla-cms/58326/1/8 . We meanwhile use spaces (4 for each level) for indentation and not tabs like in past.

@richard67
Copy link
Member

@BrainforgeUK It seems the description is missing some details which are not shown because they contain code or markup. Please quote them so that they are shown, otherwise no reader understands the description of this PR.

@BrainforgeUK
Copy link
Contributor Author

Tabs removed and pull request description improved.

@richard67
Copy link
Member

@BrainforgeUK The pull request description still does not show your code because you haven't quoted it into `` quotes.

@richard67
Copy link
Member

P.S. You also haven't made a selection among the check boxes if there are documentation changes required or not.

@Hackwar Hackwar added the Small A PR which only has a small change label Feb 26, 2023
@Hackwar Hackwar added the bug label Apr 6, 2023
@BrainforgeUK
Copy link
Contributor Author

What's happending with this pull request?

@alikon
Copy link
Contributor

alikon commented May 27, 2023

as usual, it needs 2 successful tests, and/or a RL decision

@alikon
Copy link
Contributor

alikon commented May 27, 2023

also
can you please have a look at https://ci.joomla.org/joomla/joomla-cms/66125/1/8

@obuisard obuisard changed the title [4.2] #38840 Module uninstallation error handling [4.3] #38840 Module uninstallation error handling Jul 15, 2023
@BrainforgeUK
Copy link
Contributor Author

Does this require any action on my part?

@HLeithner HLeithner changed the base branch from 4.3-dev to 4.4-dev September 30, 2023 22:44
@HLeithner
Copy link
Member

This pull request has been automatically rebased to 4.4-dev.

@heelc29
Copy link
Contributor

heelc29 commented Oct 24, 2023

Is this PR similar to #36692?

@HLeithner HLeithner changed the title [4.3] #38840 Module uninstallation error handling [4.4] #38840 Module uninstallation error handling Apr 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug PR-4.4-dev Small A PR which only has a small change
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

9 participants