f05c30b662
Generic: Repo Health / Site Health (push) Has been skipped
Generic: Repo Health / Access control (push) Successful in 1s
Generic: Repo Health / Site Health (pull_request) Has been skipped
Universal: PR Check / Branch Policy (pull_request) Successful in 1s
Generic: Repo Health / Access control (pull_request) Successful in 1s
Joomla: Extension CI / Release Readiness Check (pull_request) Failing after 4s
Universal: Secret Scanning / Gitleaks Secret Scan (pull_request) Successful in 5s
Joomla: Extension CI / Lint & Validate (pull_request) Failing after 7s
Universal: PR Check / Validate PR (pull_request) Failing after 9s
Branch Cleanup / Delete merged branch (pull_request) Has been skipped
Universal: Build & Release / Promote to RC (pull_request) Has been skipped
Universal: Build & Release / Build & Release Pipeline (pull_request) Successful in 9s
Generic: Repo Health / Scripts governance (push) Has been cancelled
Generic: Repo Health / Repository health (push) Has been cancelled
Generic: Repo Health / Report Issues (push) Has been cancelled
Joomla: Extension CI / Tests (PHP 8.2) (pull_request) Has been cancelled
Joomla: Extension CI / Tests (PHP 8.3) (pull_request) Has been cancelled
Joomla: Extension CI / PHPStan Analysis (pull_request) Has been cancelled
Joomla: Extension CI / Build RC Pre-Release (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 / Scripts governance (pull_request) Has been cancelled
Generic: Repo Health / Repository health (pull_request) Has been cancelled
Generic: Repo Health / Report Issues (pull_request) Has been cancelled
The install script now uninstalls plg_system_mokojoomhero if present, cleaning up the old package extension remnant. Uses Joomla Installer for proper DB and file cleanup. Non-critical — silently skips if the plugin is already gone. Authored-by: Moko Consulting Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
59 lines
1.5 KiB
PHP
59 lines
1.5 KiB
PHP
<?php
|
|
|
|
/**
|
|
* @package Joomla.Site
|
|
* @subpackage mod_mokojoomhero
|
|
*
|
|
* @copyright Copyright (C) 2026 Moko Consulting. All rights reserved.
|
|
* @license GPL-3.0-or-later
|
|
* SPDX-License-Identifier: GPL-3.0-or-later
|
|
*/
|
|
|
|
defined('_JEXEC') or die;
|
|
|
|
use Joomla\CMS\Factory;
|
|
use Joomla\CMS\Filesystem\Folder;
|
|
use Joomla\CMS\Installer\InstallerAdapter;
|
|
|
|
class Mod_MokojoomheroInstallerScript
|
|
{
|
|
public function postflight(string $type, InstallerAdapter $adapter): void
|
|
{
|
|
// Create default image folder on fresh install
|
|
$heroesPath = JPATH_ROOT . '/images/heroes';
|
|
|
|
if (!is_dir($heroesPath)) {
|
|
Folder::create($heroesPath);
|
|
}
|
|
|
|
// Remove deprecated system plugin (was part of the old package extension)
|
|
$this->removeDeprecatedPlugin();
|
|
}
|
|
|
|
/**
|
|
* Uninstall plg_system_mokojoomhero if it exists — no longer needed.
|
|
*/
|
|
private function removeDeprecatedPlugin(): void
|
|
{
|
|
try {
|
|
$db = Factory::getDbo();
|
|
|
|
$query = $db->getQuery(true)
|
|
->select($db->quoteName('extension_id'))
|
|
->from($db->quoteName('#__extensions'))
|
|
->where($db->quoteName('type') . ' = ' . $db->quote('plugin'))
|
|
->where($db->quoteName('folder') . ' = ' . $db->quote('system'))
|
|
->where($db->quoteName('element') . ' = ' . $db->quote('mokojoomhero'));
|
|
$db->setQuery($query);
|
|
$extensionId = (int) $db->loadResult();
|
|
|
|
if ($extensionId) {
|
|
$installer = new \Joomla\CMS\Installer\Installer();
|
|
$installer->uninstall('plugin', $extensionId);
|
|
}
|
|
} catch (\Exception $e) {
|
|
// Non-critical — plugin may already be gone
|
|
}
|
|
}
|
|
}
|