refactor: rename src/ to source/ per moko-platform standards
Generic: Repo Health / Site Health (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 / Report Issues (push) Has been cancelled
Generic: Repo Health / Site Health (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 / Report Issues (push) Has been cancelled
Rename root source directory from src/ to source/ and update all references in Makefile, manifest.xml, .gitignore, CI workflows, and wiki documentation. Internal Joomla namespace paths (src/Extension) are unchanged as they are plugin-internal structure. CI workflows updated to check source/ first with src/ fallback for backward compatibility across repos. Authored-by: Moko Consulting Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,134 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @package MokoJoomCross
|
||||
* @author Moko Consulting <hello@mokoconsulting.tech>
|
||||
* @copyright Copyright (C) 2026 Moko Consulting. All rights reserved.
|
||||
* @license GNU General Public License version 3 or later; see LICENSE
|
||||
* SPDX-License-Identifier: GPL-3.0-or-later
|
||||
*/
|
||||
|
||||
defined('_JEXEC') or die;
|
||||
|
||||
use Joomla\CMS\Factory;
|
||||
use Joomla\CMS\Installer\InstallerAdapter;
|
||||
use Joomla\CMS\Language\Text;
|
||||
|
||||
class Pkg_MokoJoomCrossInstallerScript
|
||||
{
|
||||
/**
|
||||
* Minimum PHP version required
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $minimumPhp = '8.1.0';
|
||||
|
||||
/**
|
||||
* Called before any install/update/uninstall action.
|
||||
*
|
||||
* @param string $type Action type (install, update, uninstall)
|
||||
* @param InstallerAdapter $parent Installer adapter
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function preflight(string $type, InstallerAdapter $parent): bool
|
||||
{
|
||||
if (version_compare(PHP_VERSION, $this->minimumPhp, '<')) {
|
||||
Factory::getApplication()->enqueueMessage(
|
||||
Text::sprintf('PKG_MOKOJOOMCROSS_PHP_VERSION_ERROR', $this->minimumPhp),
|
||||
'error'
|
||||
);
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Called after install/update.
|
||||
*
|
||||
* @param string $type Action type
|
||||
* @param InstallerAdapter $parent Installer adapter
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function postflight(string $type, InstallerAdapter $parent): void
|
||||
{
|
||||
$db = Factory::getDbo();
|
||||
|
||||
if ($type === 'install') {
|
||||
// Enable core plugins automatically on fresh install
|
||||
$corePlugins = [
|
||||
['system', 'mokojoomcross'],
|
||||
['content', 'mokojoomcross'],
|
||||
['webservices', 'mokojoomcross'],
|
||||
['task', 'mokojoomcross'],
|
||||
];
|
||||
|
||||
foreach ($corePlugins as [$folder, $element]) {
|
||||
$query = $db->getQuery(true)
|
||||
->update($db->quoteName('#__extensions'))
|
||||
->set($db->quoteName('enabled') . ' = 1')
|
||||
->where($db->quoteName('type') . ' = ' . $db->quote('plugin'))
|
||||
->where($db->quoteName('folder') . ' = ' . $db->quote($folder))
|
||||
->where($db->quoteName('element') . ' = ' . $db->quote($element));
|
||||
|
||||
$db->setQuery($query);
|
||||
$db->execute();
|
||||
}
|
||||
|
||||
// Enable all service plugins in the mokojoomcross group
|
||||
$query = $db->getQuery(true)
|
||||
->update($db->quoteName('#__extensions'))
|
||||
->set($db->quoteName('enabled') . ' = 1')
|
||||
->where($db->quoteName('type') . ' = ' . $db->quote('plugin'))
|
||||
->where($db->quoteName('folder') . ' = ' . $db->quote('mokojoomcross'));
|
||||
|
||||
$db->setQuery($query);
|
||||
$db->execute();
|
||||
|
||||
// Check for Perfect Publisher Pro and offer migration
|
||||
$this->detectPerfectPublisherPro($db);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Detect Perfect Publisher Pro installation and store migration flag.
|
||||
*
|
||||
* @param \Joomla\Database\DatabaseInterface $db Database driver
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
private function detectPerfectPublisherPro($db): void
|
||||
{
|
||||
$query = $db->getQuery(true)
|
||||
->select($db->quoteName(['element', 'params']))
|
||||
->from($db->quoteName('#__extensions'))
|
||||
->where($db->quoteName('element') . ' LIKE ' . $db->quote('%perfectpublisher%'))
|
||||
->where($db->quoteName('type') . ' = ' . $db->quote('component'));
|
||||
|
||||
$db->setQuery($query);
|
||||
$result = $db->loadObject();
|
||||
|
||||
if ($result) {
|
||||
Factory::getApplication()->enqueueMessage(
|
||||
Text::_('PKG_MOKOJOOMCROSS_MIGRATION_DETECTED'),
|
||||
'notice'
|
||||
);
|
||||
|
||||
// Store migration availability in component params
|
||||
$query = $db->getQuery(true)
|
||||
->update($db->quoteName('#__extensions'))
|
||||
->set($db->quoteName('params') . ' = ' . $db->quote(json_encode([
|
||||
'migration_available' => 'perfectpublisher',
|
||||
'migration_source_params' => $result->params,
|
||||
])))
|
||||
->where($db->quoteName('type') . ' = ' . $db->quote('component'))
|
||||
->where($db->quoteName('element') . ' = ' . $db->quote('com_mokojoomcross'));
|
||||
|
||||
$db->setQuery($query);
|
||||
$db->execute();
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user