generated from MokoConsulting/Template-Joomla
Compare commits
1 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| b06cea201b |
@@ -5,7 +5,7 @@
|
|||||||
# FILE INFORMATION
|
# FILE INFORMATION
|
||||||
# DEFGROUP: Gitea.Workflow
|
# DEFGROUP: Gitea.Workflow
|
||||||
# INGROUP: mokocli.Automation
|
# INGROUP: mokocli.Automation
|
||||||
# VERSION: 01.00.37
|
# VERSION: 01.00.36
|
||||||
# BRIEF: Auto-create feature branch when an issue is opened
|
# BRIEF: Auto-create feature branch when an issue is opened
|
||||||
|
|
||||||
name: "Universal: Issue Branch"
|
name: "Universal: Issue Branch"
|
||||||
|
|||||||
+1
-1
@@ -14,7 +14,7 @@
|
|||||||
DEFGROUP: Template-Joomla
|
DEFGROUP: Template-Joomla
|
||||||
INGROUP: Template-Joomla.Documentation
|
INGROUP: Template-Joomla.Documentation
|
||||||
REPO: https://github.com/mokoconsulting-tech/Template-Joomla/
|
REPO: https://github.com/mokoconsulting-tech/Template-Joomla/
|
||||||
VERSION: 01.00.37
|
VERSION: 01.00.36
|
||||||
PATH: ./CODE_OF_CONDUCT.md
|
PATH: ./CODE_OF_CONDUCT.md
|
||||||
BRIEF: Community expectations and enforcement guidelines
|
BRIEF: Community expectations and enforcement guidelines
|
||||||
NOTE: Adapted with attribution from the Contributor Covenant v2.1
|
NOTE: Adapted with attribution from the Contributor Covenant v2.1
|
||||||
|
|||||||
+1
-1
@@ -19,7 +19,7 @@
|
|||||||
DEFGROUP: mokoconsulting-tech.Template-Joomla
|
DEFGROUP: mokoconsulting-tech.Template-Joomla
|
||||||
INGROUP: MokoStandards.Governance
|
INGROUP: MokoStandards.Governance
|
||||||
REPO: https://github.com/mokoconsulting-tech/Template-Joomla
|
REPO: https://github.com/mokoconsulting-tech/Template-Joomla
|
||||||
VERSION: 01.00.37
|
VERSION: 01.00.36
|
||||||
PATH: /GOVERNANCE.md
|
PATH: /GOVERNANCE.md
|
||||||
BRIEF: Project governance rules, roles, and decision process for Template-Joomla
|
BRIEF: Project governance rules, roles, and decision process for Template-Joomla
|
||||||
-->
|
-->
|
||||||
|
|||||||
+1
-1
@@ -23,7 +23,7 @@ DEFGROUP: Template-Joomla
|
|||||||
INGROUP: Template-Joomla.Documentation
|
INGROUP: Template-Joomla.Documentation
|
||||||
REPO: https://git.mokoconsulting.tech/MokoConsulting/Template-Joomla
|
REPO: https://git.mokoconsulting.tech/MokoConsulting/Template-Joomla
|
||||||
PATH: /SECURITY.md
|
PATH: /SECURITY.md
|
||||||
VERSION: 01.00.37
|
VERSION: 01.00.36
|
||||||
BRIEF: Security vulnerability reporting and handling policy
|
BRIEF: Security vulnerability reporting and handling policy
|
||||||
-->
|
-->
|
||||||
|
|
||||||
|
|||||||
@@ -5,7 +5,7 @@
|
|||||||
<creationDate>2026-06-23</creationDate>
|
<creationDate>2026-06-23</creationDate>
|
||||||
<copyright>Copyright (C) 2026 Moko Consulting.</copyright>
|
<copyright>Copyright (C) 2026 Moko Consulting.</copyright>
|
||||||
<license>GPL-3.0-or-later</license>
|
<license>GPL-3.0-or-later</license>
|
||||||
<version>01.00.37</version>
|
<version>01.00.36</version>
|
||||||
<namespace path="src">Moko\Component\MokoSuiteAuto</namespace>
|
<namespace path="src">Moko\Component\MokoSuiteAuto</namespace>
|
||||||
<administration>
|
<administration>
|
||||||
<files folder="admin"><folder>services</folder><folder>src</folder><folder>tmpl</folder></files>
|
<files folder="admin"><folder>services</folder><folder>src</folder><folder>tmpl</folder></files>
|
||||||
|
|||||||
@@ -8,7 +8,7 @@
|
|||||||
<license>GPL-3.0-or-later</license>
|
<license>GPL-3.0-or-later</license>
|
||||||
<authorEmail>hello@mokoconsulting.tech</authorEmail>
|
<authorEmail>hello@mokoconsulting.tech</authorEmail>
|
||||||
<authorUrl>https://mokoconsulting.tech</authorUrl>
|
<authorUrl>https://mokoconsulting.tech</authorUrl>
|
||||||
<version>01.00.37</version>
|
<version>01.00.36</version>
|
||||||
<php_minimum>8.3</php_minimum>
|
<php_minimum>8.3</php_minimum>
|
||||||
<description>PLG_SYSTEM_MOKOSUITEAUTO_DESC</description>
|
<description>PLG_SYSTEM_MOKOSUITEAUTO_DESC</description>
|
||||||
<namespace path="src">Moko\Plugin\System\MokoSuiteAuto</namespace>
|
<namespace path="src">Moko\Plugin\System\MokoSuiteAuto</namespace>
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
<name>Web Services - MokoSuite Auto</name>
|
<name>Web Services - MokoSuite Auto</name>
|
||||||
<element>mokosuiteauto</element>
|
<element>mokosuiteauto</element>
|
||||||
<author>Moko Consulting</author>
|
<author>Moko Consulting</author>
|
||||||
<version>01.00.37</version>
|
<version>01.00.36</version>
|
||||||
<license>GPL-3.0-or-later</license>
|
<license>GPL-3.0-or-later</license>
|
||||||
<namespace path="src">Moko\Plugin\WebServices\MokoSuiteAuto</namespace>
|
<namespace path="src">Moko\Plugin\WebServices\MokoSuiteAuto</namespace>
|
||||||
<files><folder>src</folder><folder>services</folder></files>
|
<files><folder>src</folder><folder>services</folder></files>
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
<extension type="package" method="upgrade">
|
<extension type="package" method="upgrade">
|
||||||
<name>Package - MokoSuite Auto</name>
|
<name>Package - MokoSuite Auto</name>
|
||||||
<packagename>mokosuiteauto</packagename>
|
<packagename>mokosuiteauto</packagename>
|
||||||
<version>01.00.37</version>
|
<version>01.00.36</version>
|
||||||
<creationDate>2026-06-21</creationDate>
|
<creationDate>2026-06-21</creationDate>
|
||||||
<author>Moko Consulting</author>
|
<author>Moko Consulting</author>
|
||||||
<authorEmail>hello@mokoconsulting.tech</authorEmail>
|
<authorEmail>hello@mokoconsulting.tech</authorEmail>
|
||||||
|
|||||||
+37
-181
@@ -1,10 +1,9 @@
|
|||||||
<?php
|
<?php
|
||||||
/**
|
/**
|
||||||
* MokoSuite Auto Package Install Script
|
* @package MokoSuiteAuto
|
||||||
*
|
* @subpackage pkg_mokosuiteauto
|
||||||
* @package MokoSuite Auto
|
|
||||||
* @copyright Copyright (C) 2026 Moko Consulting. All rights reserved.
|
* @copyright Copyright (C) 2026 Moko Consulting. All rights reserved.
|
||||||
* @license GPL-3.0-or-later
|
* @license GNU General Public License version 3 or later; see LICENSE
|
||||||
*/
|
*/
|
||||||
|
|
||||||
defined('_JEXEC') or die;
|
defined('_JEXEC') or die;
|
||||||
@@ -12,72 +11,50 @@ defined('_JEXEC') or die;
|
|||||||
use Joomla\CMS\Factory;
|
use Joomla\CMS\Factory;
|
||||||
use Joomla\CMS\Installer\InstallerAdapter;
|
use Joomla\CMS\Installer\InstallerAdapter;
|
||||||
use Joomla\CMS\Log\Log;
|
use Joomla\CMS\Log\Log;
|
||||||
use Joomla\Database\DatabaseInterface;
|
|
||||||
|
|
||||||
class Pkg_mokosuiteautoInstallerScript
|
/**
|
||||||
|
* Package installation script for MokoSuiteAuto.
|
||||||
|
*/
|
||||||
|
class Pkg_MokoSuiteAutoInstallerScript
|
||||||
{
|
{
|
||||||
private string $savedDlid = '';
|
|
||||||
|
|
||||||
public function preflight(string $type, InstallerAdapter $adapter): bool
|
|
||||||
{
|
|
||||||
if ($type === 'update')
|
|
||||||
{
|
|
||||||
$this->savedDlid = $this->getExistingDlid();
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function postflight(string $type, InstallerAdapter $adapter): void
|
public function postflight(string $type, InstallerAdapter $adapter): void
|
||||||
{
|
{
|
||||||
if ($this->savedDlid)
|
$this->warnMissingLicenseKey();
|
||||||
{
|
|
||||||
$this->restoreDlid($this->savedDlid);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($type === 'install')
|
private function warnMissingLicenseKey(): void
|
||||||
{
|
{
|
||||||
$missing = $this->verifyChildren($adapter);
|
|
||||||
|
|
||||||
if (!empty($missing))
|
|
||||||
{
|
|
||||||
Factory::getApplication()->enqueueMessage(
|
|
||||||
'<strong>MokoSuite Auto — Incomplete Installation</strong><br>'
|
|
||||||
. 'The following extensions failed to install: '
|
|
||||||
. implode(', ', $missing)
|
|
||||||
. '.<br>Please check file permissions and server logs, then reinstall the package.',
|
|
||||||
'error'
|
|
||||||
);
|
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
$this->enablePlugin('system', 'mokosuiteauto');
|
|
||||||
$this->enablePlugin('webservices', 'mokosuiteauto');
|
|
||||||
}
|
|
||||||
|
|
||||||
$dlid = $this->getExistingDlid();
|
|
||||||
|
|
||||||
if (empty($dlid))
|
|
||||||
{
|
|
||||||
$app = Factory::getApplication();
|
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
$db = Factory::getContainer()->get(DatabaseInterface::class);
|
$db = Factory::getDbo();
|
||||||
$db->setQuery(
|
$app = Factory::getApplication();
|
||||||
$db->getQuery(true)
|
|
||||||
->select($db->quoteName('update_site_id'))
|
$query = $db->getQuery(true)
|
||||||
|
->select([$db->quoteName('update_site_id'), $db->quoteName('extra_query')])
|
||||||
->from($db->quoteName('#__update_sites'))
|
->from($db->quoteName('#__update_sites'))
|
||||||
->where($db->quoteName('name') . ' LIKE ' . $db->quote('%MokoSuite Auto%'))
|
->where('(' . $db->quoteName('name') . ' LIKE ' . $db->quote('%MokoSuiteAuto%')
|
||||||
->setLimit(1)
|
. ' OR ' . $db->quoteName('location') . ' LIKE ' . $db->quote('%MokoSuiteAuto%') . ')')
|
||||||
);
|
->setLimit(1);
|
||||||
$siteId = (int) $db->loadResult();
|
$db->setQuery($query);
|
||||||
$editUrl = $siteId
|
$site = $db->loadObject();
|
||||||
? 'index.php?option=com_installer&task=updatesite.edit&update_site_id=' . $siteId
|
|
||||||
: 'index.php?option=com_installer&view=updatesites';
|
if ($site)
|
||||||
|
{
|
||||||
|
$extraQuery = (string) ($site->extra_query ?? '');
|
||||||
|
|
||||||
|
if (!empty($extraQuery) && strpos($extraQuery, 'dlid=') !== false)
|
||||||
|
{
|
||||||
|
parse_str($extraQuery, $parsed);
|
||||||
|
|
||||||
|
if (!empty($parsed['dlid']))
|
||||||
|
{
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
catch (\Throwable $e)
|
}
|
||||||
|
|
||||||
|
$editUrl = 'index.php?option=com_installer&task=updatesite.edit&update_site_id=' . (int) $site->update_site_id;
|
||||||
|
}
|
||||||
|
else
|
||||||
{
|
{
|
||||||
$editUrl = 'index.php?option=com_installer&view=updatesites';
|
$editUrl = 'index.php?option=com_installer&view=updatesites';
|
||||||
}
|
}
|
||||||
@@ -89,130 +66,9 @@ class Pkg_mokosuiteautoInstallerScript
|
|||||||
'warning'
|
'warning'
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
private function verifyChildren(InstallerAdapter $adapter): array
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
$manifest = $adapter->getParent()->getManifest();
|
|
||||||
$files = $manifest->files->file ?? [];
|
|
||||||
|
|
||||||
if (!$files)
|
|
||||||
{
|
|
||||||
return [];
|
|
||||||
}
|
|
||||||
|
|
||||||
$db = Factory::getContainer()->get(DatabaseInterface::class);
|
|
||||||
$missing = [];
|
|
||||||
|
|
||||||
foreach ($files as $file)
|
|
||||||
{
|
|
||||||
$type = (string) ($file['type'] ?? '');
|
|
||||||
$id = (string) ($file['id'] ?? '');
|
|
||||||
$group = (string) ($file['group'] ?? '');
|
|
||||||
|
|
||||||
if ($type === '' || $id === '')
|
|
||||||
{
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
$element = ($type === 'plugin' && $group !== '')
|
|
||||||
? preg_replace('/^plg_' . preg_quote($group, '/') . '_/', '', $id)
|
|
||||||
: $id;
|
|
||||||
|
|
||||||
$query = $db->getQuery(true)
|
|
||||||
->select('COUNT(*)')
|
|
||||||
->from($db->quoteName('#__extensions'))
|
|
||||||
->where($db->quoteName('element') . ' = ' . $db->quote($element))
|
|
||||||
->where($db->quoteName('type') . ' = ' . $db->quote($type));
|
|
||||||
|
|
||||||
if ($type === 'plugin' && $group !== '')
|
|
||||||
{
|
|
||||||
$query->where($db->quoteName('folder') . ' = ' . $db->quote($group));
|
|
||||||
}
|
|
||||||
|
|
||||||
$db->setQuery($query);
|
|
||||||
|
|
||||||
if ((int) $db->loadResult() === 0)
|
|
||||||
{
|
|
||||||
$missing[] = htmlspecialchars($type . ': ' . $id, ENT_QUOTES, 'UTF-8');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return $missing;
|
|
||||||
}
|
|
||||||
catch (\Throwable $e)
|
catch (\Throwable $e)
|
||||||
{
|
{
|
||||||
return [];
|
// Silent — avoid breaking install if update_sites query fails
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private function getExistingDlid(): string
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
$db = Factory::getContainer()->get(DatabaseInterface::class);
|
|
||||||
$db->setQuery(
|
|
||||||
$db->getQuery(true)
|
|
||||||
->select($db->quoteName('extra_query'))
|
|
||||||
->from($db->quoteName('#__update_sites'))
|
|
||||||
->where($db->quoteName('name') . ' LIKE ' . $db->quote('%MokoSuite Auto%'))
|
|
||||||
->setLimit(1)
|
|
||||||
);
|
|
||||||
|
|
||||||
$extraQuery = $db->loadResult() ?? '';
|
|
||||||
|
|
||||||
if (preg_match('/dlid=([a-zA-Z0-9]+)/', $extraQuery, $matches))
|
|
||||||
{
|
|
||||||
return $matches[1];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
catch (\Throwable $e)
|
|
||||||
{
|
|
||||||
Log::add('Auto install: failed to read DLID — ' . $e->getMessage(), Log::WARNING, 'mokosuite.auto');
|
|
||||||
}
|
|
||||||
|
|
||||||
return '';
|
|
||||||
}
|
|
||||||
|
|
||||||
private function restoreDlid(string $dlid): void
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
$db = Factory::getContainer()->get(DatabaseInterface::class);
|
|
||||||
$db->setQuery(
|
|
||||||
$db->getQuery(true)
|
|
||||||
->update($db->quoteName('#__update_sites'))
|
|
||||||
->set($db->quoteName('extra_query') . ' = ' . $db->quote('dlid=' . $dlid))
|
|
||||||
->where($db->quoteName('name') . ' LIKE ' . $db->quote('%MokoSuite Auto%'))
|
|
||||||
);
|
|
||||||
$db->execute();
|
|
||||||
}
|
|
||||||
catch (\Throwable $e)
|
|
||||||
{
|
|
||||||
Log::add('Auto install: failed to restore DLID — ' . $e->getMessage(), Log::WARNING, 'mokosuite.auto');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private function enablePlugin(string $group, string $element): void
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
$db = Factory::getContainer()->get(DatabaseInterface::class);
|
|
||||||
$db->setQuery(
|
|
||||||
$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($group))
|
|
||||||
->where($db->quoteName('element') . ' = ' . $db->quote($element))
|
|
||||||
);
|
|
||||||
$db->execute();
|
|
||||||
}
|
|
||||||
catch (\Throwable $e)
|
|
||||||
{
|
|
||||||
Log::add('Auto install: failed to enable ' . $group . '/' . $element . ' — ' . $e->getMessage(), Log::WARNING, 'mokosuite.auto');
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user