fix: guard component service calls with class_exists check
Universal: Auto Version Bump / Version Bump (push) Has been cancelled
Platform: moko-platform CI / Gate 1: Code Quality (push) Has been cancelled
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
Platform: moko-platform CI / Gate 1: Code Quality (pull_request) Has been cancelled
Platform: moko-platform CI / Gate 2: Unit Tests (8.1) (pull_request) Has been cancelled
Platform: moko-platform CI / Gate 2: Unit Tests (8.2) (pull_request) Has been cancelled
Platform: moko-platform CI / Gate 2: Unit Tests (8.3) (pull_request) Has been cancelled
Platform: moko-platform CI / Gate 3: Self-Health Check (pull_request) Has been cancelled
Platform: moko-platform CI / Gate 4: Governance (pull_request) Has been cancelled
Platform: moko-platform CI / Gate 5: Template Integrity (pull_request) Has been cancelled
Platform: moko-platform CI / CI Summary (pull_request) Has been cancelled
Universal: Pre-Release / Build Pre-Release (${{ inputs.stability || github.ref_name }}) (push) Has been cancelled
Generic: Repo Health / Access control (push) Has been cancelled
Generic: Repo Health / Scripts governance (push) Has been cancelled
Generic: Repo Health / Repository health (push) Has been cancelled
Generic: Repo Health / Site Health (push) Has been cancelled
Generic: Repo Health / Report Issues (push) Has been cancelled
Universal: Secret Scanning / Gitleaks Secret Scan (pull_request) Has been cancelled
Universal: PR Check / Branch Policy (pull_request) Has been cancelled
Universal: PR Check / Validate PR (pull_request) Has been cancelled
Universal: PR Check / Build RC Package (pull_request) Has been cancelled
Universal: PR Check / Report Issues (pull_request) Has been cancelled
Generic: Repo Health / Access control (pull_request) Has been cancelled
Generic: Repo Health / Scripts governance (pull_request) Has been cancelled
Generic: Repo Health / Repository health (pull_request) Has been cancelled
Generic: Repo Health / Site Health (pull_request) Has been cancelled
Generic: Repo Health / Report Issues (pull_request) Has been cancelled

System plugin event handlers fire during install before com_mokosuite
is fully loaded. Guard AutomationEngine and NotificationService calls
with class_exists() to prevent fatal errors during package install.
This commit is contained in:
Jonathan Miller
2026-06-09 11:49:31 -05:00
parent 3b30007ea2
commit fa918e9bf6
@@ -2167,7 +2167,7 @@ class MokoSuite extends CMSPlugin implements BootableExtensionInterface
{
if (!$isnew || !$success) return;
\Moko\Component\MokoSuite\Administrator\Service\AutomationEngine::fire('user_register', [
class_exists(\Moko\Component\MokoSuite\Administrator\Service\AutomationEngine::class, true) && \Moko\Component\MokoSuite\Administrator\Service\AutomationEngine::fire('user_register', [
'user_id' => (int) ($user['id'] ?? 0),
'username' => $user['username'] ?? '',
'email' => $user['email'] ?? '',
@@ -2182,7 +2182,7 @@ class MokoSuite extends CMSPlugin implements BootableExtensionInterface
{
if ($context !== 'com_content.article') return;
\Moko\Component\MokoSuite\Administrator\Service\AutomationEngine::fire('content_save', [
class_exists(\Moko\Component\MokoSuite\Administrator\Service\AutomationEngine::class, true) && \Moko\Component\MokoSuite\Administrator\Service\AutomationEngine::fire('content_save', [
'article_id' => (int) ($article->id ?? 0),
'title' => $article->title ?? '',
'is_new' => $isNew ? '1' : '0',
@@ -2196,7 +2196,7 @@ class MokoSuite extends CMSPlugin implements BootableExtensionInterface
*/
public function onExtensionAfterInstall($installer, $eid): void
{
\Moko\Component\MokoSuite\Administrator\Service\AutomationEngine::fire('extension_install', [
class_exists(\Moko\Component\MokoSuite\Administrator\Service\AutomationEngine::class, true) && \Moko\Component\MokoSuite\Administrator\Service\AutomationEngine::fire('extension_install', [
'extension_id' => (int) $eid,
]);
}
@@ -2216,7 +2216,7 @@ class MokoSuite extends CMSPlugin implements BootableExtensionInterface
$name = $user->username ?? $user->name ?? 'unknown';
// Fire automation for any login
\Moko\Component\MokoSuite\Administrator\Service\AutomationEngine::fire('user_login', [
class_exists(\Moko\Component\MokoSuite\Administrator\Service\AutomationEngine::class, true) && \Moko\Component\MokoSuite\Administrator\Service\AutomationEngine::fire('user_login', [
'user_id' => (int) ($user->id ?? 0),
'username' => $name,
'ip' => $ip,
@@ -2226,7 +2226,7 @@ class MokoSuite extends CMSPlugin implements BootableExtensionInterface
// Security notification for backend logins only
if (!$this->app->isClient('administrator')) return;
\Moko\Component\MokoSuite\Administrator\Service\NotificationService::securityAlert(
class_exists(\Moko\Component\MokoSuite\Administrator\Service\NotificationService::class, true) && \Moko\Component\MokoSuite\Administrator\Service\NotificationService::securityAlert(
'admin_login',
"Admin login: {$name}",
"User: {$name}\nIP: {$ip}\nTime: " . gmdate('Y-m-d H:i:s') . " UTC"
@@ -2251,7 +2251,7 @@ class MokoSuite extends CMSPlugin implements BootableExtensionInterface
if ($count >= 3 && $count % 3 === 0)
{
\Moko\Component\MokoSuite\Administrator\Service\NotificationService::securityAlert(
class_exists(\Moko\Component\MokoSuite\Administrator\Service\NotificationService::class, true) && \Moko\Component\MokoSuite\Administrator\Service\NotificationService::securityAlert(
'login_failure',
"Failed login attempts: {$count} from {$ip}",
"Username: {$username}\nIP: {$ip}\nAttempts: {$count}\nTime: " . gmdate('Y-m-d H:i:s') . " UTC"