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
Next Next commit
[4.2] #38840 Module uninstallation error handling
## Summary of changes
Gracefully handle missing client="site" in module manifest.
See #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.
  • Loading branch information
BrainforgeUK committed Oct 2, 2022
commit 6ad79e4d5d278eb863e3f64366a34ebd89a8e933
12 changes: 10 additions & 2 deletions libraries/src/Installer/Adapter/ModuleAdapter.php
Original file line number Diff line number Diff line change
Expand Up @@ -359,15 +359,23 @@ public function loadLanguage($path = null)
$extension = $this->getElement();

if ($extension) {
$source = $path ?: ($this->parent->extension->client_id ? JPATH_ADMINISTRATOR : JPATH_SITE) . '/modules/' . $extension;
$clientPath = ($this->parent->extension->client_id ? JPATH_ADMINISTRATOR : JPATH_SITE);
$source = $path ?: $clientPath . '/modules/' . $extension;
$folder = (string) $this->getManifest()->files->attributes()->folder;

if ($folder && file_exists($path . '/' . $folder)) {
$source = $path . '/' . $folder;
}

$client = (string) $this->getManifest()->attributes()->client;
$this->doLoadLanguage($extension, $source, \constant('JPATH_' . strtoupper($client)));
if (strlen($client))
{
$this->doLoadLanguage($extension, $source, \constant('JPATH_' . strtoupper($client)));
}
else
{
$this->doLoadLanguage($extension, $source, $clientPath);
}
}
}
}
Expand Down