fix: CLI exit codes and SQL schema defaults
Generic: Repo Health / Site Health (pull_request) Has been skipped
Universal: PR Check / Branch Policy (pull_request) Successful in 1s
Generic: Repo Health / Access control (pull_request) Successful in 1s
Universal: Auto Version Bump / Version Bump (push) Failing after 4s
Joomla: Extension CI / Release Readiness Check (pull_request) Failing after 3s
Universal: Secret Scanning / Gitleaks Secret Scan (pull_request) Successful in 4s
Joomla: Extension CI / Lint & Validate (pull_request) Failing after 4s
Universal: PR Check / Validate PR (pull_request) Failing after 6s
Generic: Repo Health / Site Health (push) Has been skipped
Generic: Repo Health / Access control (push) Successful in 1s
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
Universal: PR Check / Build RC Package (pull_request) Has been cancelled
Universal: PR Check / Report Issues (pull_request) Has been cancelled
Generic: Repo Health / Release configuration (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
Generic: Repo Health / Release configuration (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

- Console commands: replace self::SUCCESS/FAILURE with 0/1 (Joomla's
  AbstractCommand doesn't define these Symfony constants)
- SQL: make manifest and log columns DEFAULT NULL to prevent
  "doesn't have a default value" on INSERT

Authored-by: Moko Consulting
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
Jonathan Miller
2026-06-04 20:15:52 -05:00
parent fea1800e06
commit 368461577e
7 changed files with 21 additions and 17 deletions
@@ -63,8 +63,8 @@ CREATE TABLE IF NOT EXISTS `#__mokobackup_records` (
`remote_filename` VARCHAR(512) NOT NULL DEFAULT '',
`checksum` VARCHAR(64) NOT NULL DEFAULT '' COMMENT 'SHA-256 hash of archive',
`base_record_id` INT(11) UNSIGNED NOT NULL DEFAULT 0 COMMENT 'Base full backup ID for differential',
`manifest` LONGTEXT NOT NULL COMMENT 'JSON file manifest for differential comparison',
`log` MEDIUMTEXT NOT NULL COMMENT 'Step-by-step backup log',
`manifest` LONGTEXT DEFAULT NULL COMMENT 'JSON file manifest for differential comparison',
`log` MEDIUMTEXT DEFAULT NULL COMMENT 'Step-by-step backup log',
PRIMARY KEY (`id`),
KEY `idx_profile` (`profile_id`),
KEY `idx_status` (`status`),
@@ -0,0 +1,4 @@
-- MokoJoomBackup 01.01.08
-- Fix: allow NULL defaults for manifest and log columns
ALTER TABLE `#__mokobackup_records` MODIFY `manifest` LONGTEXT DEFAULT NULL;
ALTER TABLE `#__mokobackup_records` MODIFY `log` MEDIUMTEXT DEFAULT NULL;
@@ -120,6 +120,6 @@ class CleanupCommand extends AbstractCommand
$io->success(($dryRun ? 'Would delete ' : 'Deleted ') . $deleted . ' backup record(s).');
}
return self::SUCCESS;
return 0;
}
}
@@ -56,7 +56,7 @@ class ListCommand extends AbstractCommand
if (empty($records)) {
$io->info('No backup records found.');
return self::SUCCESS;
return 0;
}
$rows = [];
@@ -82,6 +82,6 @@ class ListCommand extends AbstractCommand
$rows
);
return self::SUCCESS;
return 0;
}
}
@@ -44,7 +44,7 @@ class ProfilesCommand extends AbstractCommand
if (empty($profiles)) {
$io->info('No backup profiles found.');
return self::SUCCESS;
return 0;
}
$rows = [];
@@ -63,6 +63,6 @@ class ProfilesCommand extends AbstractCommand
$rows
);
return self::SUCCESS;
return 0;
}
}
@@ -48,19 +48,19 @@ class RestoreCommand extends AbstractCommand
if (!$record) {
$io->error('Backup record not found: ' . $recordId);
return self::FAILURE;
return 1;
}
if ($record->status !== 'complete') {
$io->error('Cannot restore — backup status is: ' . $record->status);
return self::FAILURE;
return 1;
}
if (empty($record->absolute_path) || !is_file($record->absolute_path)) {
$io->error('Backup archive not found: ' . ($record->absolute_path ?: 'no path'));
return self::FAILURE;
return 1;
}
$io->warning('This will overwrite the current site files and/or database.');
@@ -70,7 +70,7 @@ class RestoreCommand extends AbstractCommand
if (!$io->confirm('Are you sure you want to continue?', false)) {
$io->info('Restore cancelled.');
return self::SUCCESS;
return 0;
}
$engineFile = JPATH_ADMINISTRATOR . '/components/com_mokobackup/src/Engine/RestoreEngine.php';
@@ -78,7 +78,7 @@ class RestoreCommand extends AbstractCommand
if (!file_exists($engineFile)) {
$io->error('RestoreEngine not found. Is the component fully installed?');
return self::FAILURE;
return 1;
}
if (!class_exists(RestoreEngine::class)) {
@@ -91,11 +91,11 @@ class RestoreCommand extends AbstractCommand
if ($result['success']) {
$io->success($result['message']);
return self::SUCCESS;
return 0;
}
$io->error($result['message']);
return self::FAILURE;
return 1;
}
}
@@ -45,7 +45,7 @@ class RunCommand extends AbstractCommand
if (!file_exists($engineFile)) {
$io->error('MokoJoomBackup component not installed.');
return self::FAILURE;
return 1;
}
if (!class_exists(BackupEngine::class)) {
@@ -58,11 +58,11 @@ class RunCommand extends AbstractCommand
if ($result['success']) {
$io->success($result['message']);
return self::SUCCESS;
return 0;
}
$io->error($result['message']);
return self::FAILURE;
return 1;
}
}