d3b6fe7663
Universal: Auto Version Bump / Version Bump (push) Successful in 6s
Generic: Repo Health / Site Health (push) Has been skipped
Generic: Repo Health / Access control (push) Successful in 2s
Generic: Project CI / Lint & Validate (push) Successful in 13s
Universal: PR Check / Branch Policy (pull_request) Successful in 2s
Generic: Project CI / Lint & Validate (pull_request) Successful in 12s
Generic: Repo Health / Site Health (pull_request) Has been skipped
Generic: Repo Health / Access control (pull_request) Successful in 2s
Branch Cleanup / Delete merged branch (pull_request) Has been skipped
RC Revert / Rename rc/ back to dev/ (pull_request) Has been skipped
Joomla: Extension CI / Release Readiness Check (pull_request) Failing after 7s
Universal: Pre-Release / Build Pre-Release (${{ inputs.stability || github.ref_name }}) (push) Successful in 13s
Universal: Build & Release / Promote to RC (pull_request) Has been skipped
Universal: Secret Scanning / Gitleaks Secret Scan (pull_request) Successful in 12s
Universal: PR Check / Validate PR (pull_request) Failing after 10s
Universal: Build & Release / Build & Release Pipeline (pull_request) Successful in 14s
Joomla: Extension CI / Lint & Validate (pull_request) Failing after 38s
Generic: Project CI / Tests (push) Has been cancelled
Generic: Project CI / Tests (pull_request) 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
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
# Conflicts: # .mokogitea/workflows/issue-branch.yml # .mokogitea/workflows/pre-release.yml # source/pkg_mokojoombackup.xml
99 lines
2.3 KiB
PHP
99 lines
2.3 KiB
PHP
<?php
|
|
|
|
/**
|
|
* @package MokoSuiteBackup
|
|
* @subpackage plg_webservices_mokosuitebackup
|
|
* @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
|
|
*
|
|
* REST API endpoints — wire-compatible with the mcp_mokosuitebackup MCP server.
|
|
*
|
|
* Akeeba-compatible routes:
|
|
* POST /api/index.php/v1/mokosuitebackup/backup — Start backup
|
|
* GET /api/index.php/v1/mokosuitebackup/backups — List records
|
|
* DELETE /api/index.php/v1/mokosuitebackup/backup/:id — Delete record
|
|
* GET /api/index.php/v1/mokosuitebackup/backup/:id/download — Download archive
|
|
* GET /api/index.php/v1/mokosuitebackup/profiles — List profiles
|
|
*/
|
|
|
|
namespace Joomla\Plugin\WebServices\MokoSuiteBackup\Extension;
|
|
|
|
defined('_JEXEC') or die;
|
|
|
|
use Joomla\CMS\Plugin\CMSPlugin;
|
|
use Joomla\CMS\Router\ApiRouter;
|
|
use Joomla\Event\Event;
|
|
use Joomla\Event\SubscriberInterface;
|
|
use Joomla\Router\Route;
|
|
|
|
final class MokoSuiteBackupWebServices extends CMSPlugin implements SubscriberInterface
|
|
{
|
|
protected $autoloadLanguage = true;
|
|
|
|
public static function getSubscribedEvents(): array
|
|
{
|
|
return [
|
|
'onBeforeApiRoute' => 'onBeforeApiRoute',
|
|
];
|
|
}
|
|
|
|
public function onBeforeApiRoute(Event $event): void
|
|
{
|
|
/** @var ApiRouter $router */
|
|
[$router] = array_values($event->getArguments());
|
|
|
|
$defaults = [
|
|
'component' => 'com_mokosuitebackup',
|
|
'public' => false,
|
|
];
|
|
|
|
// Standard CRUD for backup records
|
|
$router->createCRUDRoutes('v1/mokosuitebackup/backups', 'backups', $defaults);
|
|
|
|
// Start a backup (POST)
|
|
$router->addRoute(
|
|
new Route(
|
|
['POST'],
|
|
'v1/mokosuitebackup/backup',
|
|
'backups.backup',
|
|
[],
|
|
$defaults
|
|
)
|
|
);
|
|
|
|
// Delete a backup (DELETE)
|
|
$router->addRoute(
|
|
new Route(
|
|
['DELETE'],
|
|
'v1/mokosuitebackup/backup/:id',
|
|
'backups.delete',
|
|
['id' => '(\d+)'],
|
|
$defaults
|
|
)
|
|
);
|
|
|
|
// Download a backup archive (GET)
|
|
$router->addRoute(
|
|
new Route(
|
|
['GET'],
|
|
'v1/mokosuitebackup/backup/:id/download',
|
|
'backups.download',
|
|
['id' => '(\d+)'],
|
|
$defaults
|
|
)
|
|
);
|
|
|
|
// List backup profiles (GET)
|
|
$router->addRoute(
|
|
new Route(
|
|
['GET'],
|
|
'v1/mokosuitebackup/profiles',
|
|
'backups.profiles',
|
|
[],
|
|
$defaults
|
|
)
|
|
);
|
|
}
|
|
}
|