447f7b572e
Universal: PR Check / Require Docs Update (pull_request) Has been skipped
Universal: PR Check / Wiki Update Reminder (pull_request) Has been skipped
Universal: PR Check / Branch Policy (pull_request) Successful in 2s
Universal: PR Check / Secret Scan (pull_request) Successful in 10s
Universal: PR Check / Validate PR (pull_request) Failing after 14s
Universal: Pre-Release / Build Pre-Release (${{ inputs.stability || github.ref_name }}) (push) Successful in 40s
Generic: Project CI / Lint & Validate (pull_request) Successful in 52s
Joomla: Metadata Validation / Validate Joomla Metadata (pull_request) Successful in 1m8s
Generic: Project CI / Tests (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
Retention (RetentionManager and the plugin's hourly cleanup) only ever deleted local files; remote archives grew unbounded. Add an idempotent delete() to RemoteUploaderInterface + all four uploaders and have RetentionManager remove each pruned archive from the profile's enabled remotes (best-effort; failures logged). The shared restore.php is left in place since every backup overwrites it. (#229) Consolidate duplicated plumbing (#230): - New RemoteUploaderFactory replaces the createUploaderFromParams copy duplicated in BackupEngine and SteppedBackupEngine. - RetentionManager becomes the single retention authority (global-default fallback + pruneOrphans()); the system plugin delegates to it and its duplicate doCleanup()/deleteBackupRecord() logic is removed. - Backend controller, API controller and legacy cli/mokosuitebackup.php now run through the shared BackupRunner instead of BackupEngine directly. Refs #229 #230 Claude-Session: https://claude.ai/code/session_01WbGBN9VyRK61zczYWcCQ2i
68 lines
1.6 KiB
PHP
68 lines
1.6 KiB
PHP
<?php
|
|
|
|
/**
|
|
* @package MokoSuiteBackup
|
|
* @subpackage com_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
|
|
*
|
|
* CLI backup script for cron/scheduled use.
|
|
*
|
|
* Usage:
|
|
* php cli/mokosuitebackup.php --profile=1 --description="Scheduled backup"
|
|
*
|
|
* Must be run from the Joomla root directory.
|
|
*/
|
|
|
|
// Define Joomla constants
|
|
const _JEXEC = 1;
|
|
|
|
// Bootstrap Joomla
|
|
if (file_exists(dirname(__DIR__, 4) . '/includes/defines.php')) {
|
|
require_once dirname(__DIR__, 4) . '/includes/defines.php';
|
|
}
|
|
|
|
if (!defined('JPATH_BASE')) {
|
|
define('JPATH_BASE', dirname(__DIR__, 4));
|
|
}
|
|
|
|
require_once JPATH_BASE . '/includes/framework.php';
|
|
|
|
use Joomla\CMS\Factory;
|
|
use Joomla\Component\MokoSuiteBackup\Administrator\Service\BackupRunner;
|
|
|
|
// Parse CLI arguments
|
|
$profileId = 1;
|
|
$description = '';
|
|
|
|
foreach ($argv as $arg) {
|
|
if (str_starts_with($arg, '--profile=')) {
|
|
$profileId = (int) substr($arg, 10);
|
|
} elseif (str_starts_with($arg, '--description=')) {
|
|
$description = substr($arg, 14);
|
|
}
|
|
}
|
|
|
|
if (empty($description)) {
|
|
$description = 'CLI backup ' . date('Y-m-d H:i:s');
|
|
}
|
|
|
|
// Boot the application
|
|
$app = Factory::getApplication('administrator');
|
|
|
|
echo "MokoSuiteBackup CLI\n";
|
|
echo "Profile: {$profileId}\n";
|
|
echo "Description: {$description}\n";
|
|
echo "Starting backup...\n\n";
|
|
|
|
$result = (new BackupRunner())->run($profileId, $description, 'cli');
|
|
|
|
if ($result['success']) {
|
|
echo "SUCCESS: " . $result['message'] . "\n";
|
|
exit(0);
|
|
} else {
|
|
echo "FAILED: " . $result['message'] . "\n";
|
|
exit(1);
|
|
}
|