* [ADD] Test API module without using a real sysPass instance.

* [MOD] Improve module loading.
* [MOD] Improve backup file regex.
* [MOD] Minor code tweaks.

Signed-off-by: Rubén D <nuxsmin@syspass.org>
This commit is contained in:
Rubén D
2021-10-17 16:26:39 +02:00
parent 58249da565
commit ebe58282f6
66 changed files with 3076 additions and 2228 deletions

View File

@@ -51,8 +51,8 @@ final class ConfigController extends ControllerBase
$path = $this->apiService->getParamString('path', false, BACKUP_PATH);
$this->dic->get(FileBackupService::class)
->doBackup($path);
$backupService = $this->dic->get(FileBackupService::class);
$backupService->doBackup($path);
$this->eventDispatcher->notifyEvent(
'run.backup.end',
@@ -64,9 +64,24 @@ final class ConfigController extends ControllerBase
)
);
$backupFiles = [
'files' => [
'app' => FileBackupService::getAppBackupFilename(
$path,
$backupService->getHash(),
true
),
'db' => FileBackupService::getDbBackupFilename(
$path,
$backupService->getHash(),
true
)
]
];
$this->returnResponse(
ApiResponse::makeSuccess(
$path,
$backupFiles,
null,
__('Backup process finished')
)
@@ -99,8 +114,9 @@ final class ConfigController extends ControllerBase
)
);
$this->dic->get(XmlExportService::class)
->doExport($path, $password);
$exportService = $this->dic->get(XmlExportService::class);
$exportService->doExport($path, $password);
$this->eventDispatcher->notifyEvent(
'run.export.end',
@@ -111,9 +127,15 @@ final class ConfigController extends ControllerBase
)
);
$exportFiles = [
'files' => [
'xml' => $exportService->getExportFile()
]
];
$this->returnResponse(
ApiResponse::makeSuccess(
$path,
$exportFiles,
null,
__('Export process finished')
)