fix: flush PSR-4 autoload cache after install for Joomla 6 compat
Universal: Auto Version Bump / Version Bump (push) Successful in 10s
Universal: Pre-Release / Build Pre-Release (${{ inputs.stability || github.ref_name }}) (push) Successful in 15s
Platform: moko-platform CI / Gate 1: Code Quality (push) Failing after 48s
Platform: moko-platform CI / Gate 2: Unit Tests (8.1) (push) Has been cancelled
Platform: moko-platform CI / Gate 2: Unit Tests (8.2) (push) Has been cancelled
Platform: moko-platform CI / Gate 2: Unit Tests (8.3) (push) Has been cancelled
Platform: moko-platform CI / Gate 3: Self-Health Check (push) Has been cancelled
Platform: moko-platform CI / Gate 4: Governance (push) Has been cancelled
Platform: moko-platform CI / Gate 5: Template Integrity (push) Has been cancelled
Platform: moko-platform CI / CI Summary (push) Has been cancelled

Joomla 6 replaced the namespace column with a file-based autoload
cache. Package installs can regenerate it before all sub-extensions
are extracted, causing class-not-found errors (e.g. DB-IP plugin).
Deleting the cache in postflight forces a clean rebuild.
This commit is contained in:
2026-06-25 09:48:42 -05:00
parent 76601cec37
commit d1b18340ea
+20
View File
@@ -122,6 +122,9 @@ class Pkg_MokosuiteclientInstallerScript
// Restore download key saved in preflight
$this->restoreDownloadKey();
// Flush PSR-4 autoload cache so Joomla 6+ picks up new/updated namespaces
$this->flushAutoloadCache();
// Trigger heartbeat registration
$this->sendHeartbeat();
@@ -1077,6 +1080,23 @@ class Pkg_MokosuiteclientInstallerScript
}
}
/**
* Delete the cached PSR-4 autoload map so Joomla rebuilds it from manifests.
*
* Joomla 6 replaced the #__extensions.namespace column with a file-based
* cache. Package installs sometimes regenerate it before all sub-extensions
* are extracted, leaving stale entries that cause class-not-found errors.
*/
private function flushAutoloadCache(): void
{
$cachePath = JPATH_ADMINISTRATOR . '/cache/autoload_psr4.php';
if (is_file($cachePath))
{
@unlink($cachePath);
}
}
/**
* Send heartbeat to the MokoSuiteClient monitoring receiver.
*