This commit is contained in:
AlexBa16
2026-06-08 15:29:52 +02:00
commit 27903eed4a
9931 changed files with 1535659 additions and 0 deletions
@@ -0,0 +1,21 @@
<?xml version="1.0" encoding="UTF-8"?>
<extension type="plugin" group="webservices" method="upgrade">
<name>plg_webservices_joomlaupdate</name>
<author>Joomla! Project</author>
<creationDate>2025-03</creationDate>
<copyright>(C) 2025 Open Source Matters, Inc.</copyright>
<license>GNU General Public License version 2 or later; see LICENSE.txt</license>
<authorEmail>admin@joomla.org</authorEmail>
<authorUrl>www.joomla.org</authorUrl>
<version>5.4.0</version>
<description>PLG_WEBSERVICES_JOOMLAUPDATE_XML_DESCRIPTION</description>
<namespace path="src">Joomla\Plugin\WebServices\Joomlaupdate</namespace>
<files>
<folder plugin="joomlaupdate">services</folder>
<folder>src</folder>
</files>
<languages>
<language tag="en-GB">language/en-GB/plg_webservices_joomlaupdate.ini</language>
<language tag="en-GB">language/en-GB/plg_webservices_joomlaupdate.sys.ini</language>
</languages>
</extension>
@@ -0,0 +1,44 @@
<?php
/**
* @package Joomla.Plugin
* @subpackage Webservices.Joomlaupdate
*
* @copyright (C) 2025 Open Source Matters, Inc. <https://www.joomla.org>
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
\defined('_JEXEC') or die;
use Joomla\CMS\Extension\PluginInterface;
use Joomla\CMS\Factory;
use Joomla\CMS\Plugin\PluginHelper;
use Joomla\DI\Container;
use Joomla\DI\ServiceProviderInterface;
use Joomla\Plugin\WebServices\Joomlaupdate\Extension\Joomlaupdate;
return new class () implements ServiceProviderInterface {
/**
* Registers the service provider with a DI container.
*
* @param Container $container The DI container.
*
* @return void
*
* @since 5.4.0
*/
public function register(Container $container): void
{
$container->set(
PluginInterface::class,
$container->lazy(Joomlaupdate::class, function (Container $container) {
$plugin = new Joomlaupdate(
(array) PluginHelper::getPlugin('webservices', 'joomlaupdate')
);
$plugin->setApplication(Factory::getApplication());
return $plugin;
})
);
}
};
@@ -0,0 +1,68 @@
<?php
/**
* @package Joomla.Plugin
* @subpackage Webservices.joomlaupdate
*
* @copyright (C) 2025 Open Source Matters, Inc. <https://www.joomla.org>
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
namespace Joomla\Plugin\WebServices\Joomlaupdate\Extension;
use Joomla\CMS\Event\Application\BeforeApiRouteEvent;
use Joomla\CMS\Plugin\CMSPlugin;
use Joomla\Event\SubscriberInterface;
use Joomla\Router\Route;
// phpcs:disable PSR1.Files.SideEffects
\defined('_JEXEC') or die;
// phpcs:enable PSR1.Files.SideEffects
/**
* Web Services adapter for com_joomlaupdate.
*
* @since 5.4.0
*/
final class Joomlaupdate extends CMSPlugin implements SubscriberInterface
{
/**
* Returns an array of events this subscriber will listen to.
*
* @return array
*
* @since 5.4.0
*/
public static function getSubscribedEvents(): array
{
return [
'onBeforeApiRoute' => 'onBeforeApiRoute',
];
}
/**
* Registers com_joomlaupdate's API's routes in the application
*
* @param BeforeApiRouteEvent $event The event object
*
* @return void
*
* @since 5.4.0
*/
public function onBeforeApiRoute(BeforeApiRouteEvent $event): void
{
$router = $event->getRouter();
$defaults = ['component' => 'com_joomlaupdate', 'public' => true];
$routes = [
new Route(['GET'], 'v1/joomlaupdate/healthcheck', 'healthcheck.show', [], $defaults),
new Route(['GET'], 'v1/joomlaupdate/getUpdate', 'updates.getUpdate', [], $defaults),
new Route(['POST'], 'v1/joomlaupdate/prepareUpdate', 'updates.prepareUpdate', [], $defaults),
new Route(['POST'], 'v1/joomlaupdate/finalizeUpdate', 'updates.finalizeUpdate', [], $defaults),
new Route(['POST'], 'v1/joomlaupdate/notificationSuccess', 'notification.success', [], $defaults),
new Route(['POST'], 'v1/joomlaupdate/notificationFailed', 'notification.failed', [], $defaults),
];
$router->addRoutes($routes);
}
}