Compare commits
8 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| a57e23dec3 | |||
| a8c4a2ebe1 | |||
| 412b1e643b | |||
| eed25a87b2 | |||
| 838ef5c2c6 | |||
| 319e2df45e | |||
| dc2d6c57fe | |||
| 4c3ec67a7d |
@@ -150,6 +150,14 @@
|
|||||||
<span class="text-muted"> — {{translate 'skipDuplicatesHint' category='messages' scope='DataMigration'}}</span>
|
<span class="text-muted"> — {{translate 'skipDuplicatesHint' category='messages' scope='DataMigration'}}</span>
|
||||||
</label>
|
</label>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div class="checkbox">
|
||||||
|
<label>
|
||||||
|
<input type="checkbox" name="importNoFiles">
|
||||||
|
{{translate 'Skip attachment files' scope='DataMigration'}}
|
||||||
|
<span class="text-muted"> — {{translate 'importNoFilesHint' category='messages' scope='DataMigration'}}</span>
|
||||||
|
</label>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="btn-group">
|
<div class="btn-group">
|
||||||
|
|||||||
@@ -301,6 +301,7 @@ define('modules/data-migration/views/admin/data-migration', ['view'], function (
|
|||||||
|
|
||||||
const preserveIds = this.$el.find('input[name="preserveIds"]').is(':checked');
|
const preserveIds = this.$el.find('input[name="preserveIds"]').is(':checked');
|
||||||
const skipDuplicates = this.$el.find('input[name="skipDuplicates"]').is(':checked');
|
const skipDuplicates = this.$el.find('input[name="skipDuplicates"]').is(':checked');
|
||||||
|
const noFiles = this.$el.find('input[name="importNoFiles"]').is(':checked');
|
||||||
|
|
||||||
const confirmMsg = dryRun
|
const confirmMsg = dryRun
|
||||||
? this.translate('dryRunConfirmation', 'messages', 'DataMigration')
|
? this.translate('dryRunConfirmation', 'messages', 'DataMigration')
|
||||||
@@ -315,6 +316,7 @@ define('modules/data-migration/views/admin/data-migration', ['view'], function (
|
|||||||
Espo.Ajax.postRequest('DataMigration/action/import', {
|
Espo.Ajax.postRequest('DataMigration/action/import', {
|
||||||
backupName: this.selectedBackup,
|
backupName: this.selectedBackup,
|
||||||
preserveIds: preserveIds,
|
preserveIds: preserveIds,
|
||||||
|
noFiles: noFiles,
|
||||||
skipDuplicates: skipDuplicates,
|
skipDuplicates: skipDuplicates,
|
||||||
dryRun: dryRun,
|
dryRun: dryRun,
|
||||||
}, {timeout: 600000})
|
}, {timeout: 600000})
|
||||||
|
|||||||
@@ -46,6 +46,7 @@ class Import implements Action
|
|||||||
$preserveIds = $body->preserveIds ?? true;
|
$preserveIds = $body->preserveIds ?? true;
|
||||||
$skipDuplicates = $body->skipDuplicates ?? true;
|
$skipDuplicates = $body->skipDuplicates ?? true;
|
||||||
$dryRun = $body->dryRun ?? false;
|
$dryRun = $body->dryRun ?? false;
|
||||||
|
$noFiles = $body->noFiles ?? false;
|
||||||
|
|
||||||
$io = new BufferedIO();
|
$io = new BufferedIO();
|
||||||
|
|
||||||
@@ -54,6 +55,7 @@ class Import implements Action
|
|||||||
'preserveIds' => $preserveIds,
|
'preserveIds' => $preserveIds,
|
||||||
'skipDuplicates' => $skipDuplicates,
|
'skipDuplicates' => $skipDuplicates,
|
||||||
'dryRun' => $dryRun,
|
'dryRun' => $dryRun,
|
||||||
|
'noFiles' => $noFiles,
|
||||||
'verbose' => true,
|
'verbose' => true,
|
||||||
], $io);
|
], $io);
|
||||||
|
|
||||||
|
|||||||
@@ -42,6 +42,7 @@
|
|||||||
"deleteBackupConfirmation": "Are you sure you want to delete this backup? This action cannot be undone.",
|
"deleteBackupConfirmation": "Are you sure you want to delete this backup? This action cannot be undone.",
|
||||||
"noFilesHint": "faster export, without attachment files",
|
"noFilesHint": "faster export, without attachment files",
|
||||||
"preserveIdsHint": "keep original record IDs (recommended for same-instance restore)",
|
"preserveIdsHint": "keep original record IDs (recommended for same-instance restore)",
|
||||||
|
"importNoFilesHint": "import only database records, skip attachment files",
|
||||||
"skipDuplicatesHint": "skip records that already exist in the database"
|
"skipDuplicatesHint": "skip records that already exist in the database"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
{
|
{
|
||||||
"labels": {
|
"labels": {
|
||||||
"Data Migration": "העברת נתונים"
|
"Data Migration": "העברת נתונים",
|
||||||
|
"Custom Development": "פיתוח עצמאי"
|
||||||
},
|
},
|
||||||
"descriptions": {
|
"descriptions": {
|
||||||
"dataMigration": "ייצוא וייבוא נתוני תיקים בין מערכות EspoCRM"
|
"dataMigration": "ייצוא וייבוא נתוני תיקים בין מערכות EspoCRM"
|
||||||
|
|||||||
@@ -42,6 +42,7 @@
|
|||||||
"deleteBackupConfirmation": "האם אתה בטוח שברצונך למחוק גיבוי זה? לא ניתן לבטל פעולה זו.",
|
"deleteBackupConfirmation": "האם אתה בטוח שברצונך למחוק גיבוי זה? לא ניתן לבטל פעולה זו.",
|
||||||
"noFilesHint": "ייצוא מהיר יותר, ללא קבצים מצורפים",
|
"noFilesHint": "ייצוא מהיר יותר, ללא קבצים מצורפים",
|
||||||
"preserveIdsHint": "שמור מזהי רשומות מקוריים (מומלץ לשחזור באותה מערכת)",
|
"preserveIdsHint": "שמור מזהי רשומות מקוריים (מומלץ לשחזור באותה מערכת)",
|
||||||
|
"importNoFilesHint": "ייבוא רשומות בלבד, ללא קבצים מצורפים",
|
||||||
"skipDuplicatesHint": "דלג על רשומות שכבר קיימות במסד הנתונים"
|
"skipDuplicatesHint": "דלג על רשומות שכבר קיימות במסד הנתונים"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,14 +1,17 @@
|
|||||||
{
|
{
|
||||||
"system": {
|
"customDev": {
|
||||||
|
"label": "Custom Development",
|
||||||
"itemList": [
|
"itemList": [
|
||||||
|
"__APPEND__",
|
||||||
{
|
{
|
||||||
"url": "#Admin/dataMigration",
|
"url": "#Admin/dataMigration",
|
||||||
"label": "Data Migration",
|
"label": "Data Migration",
|
||||||
"iconClass": "fas fa-exchange-alt",
|
"iconClass": "fas fa-exchange-alt",
|
||||||
"description": "dataMigration",
|
"description": "dataMigration",
|
||||||
"view": "modules/data-migration/views/admin/data-migration",
|
"view": "modules/data-migration/views/admin/data-migration",
|
||||||
"order": 85
|
"order": 50
|
||||||
}
|
}
|
||||||
]
|
],
|
||||||
|
"order": 30
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -62,6 +62,7 @@ class ImportService
|
|||||||
$preserveIds = $options['preserveIds'] ?? true;
|
$preserveIds = $options['preserveIds'] ?? true;
|
||||||
$skipDuplicates = $options['skipDuplicates'] ?? false;
|
$skipDuplicates = $options['skipDuplicates'] ?? false;
|
||||||
$dryRun = $options['dryRun'] ?? false;
|
$dryRun = $options['dryRun'] ?? false;
|
||||||
|
$noFiles = $options['noFiles'] ?? false;
|
||||||
$verbose = $options['verbose'] ?? false;
|
$verbose = $options['verbose'] ?? false;
|
||||||
|
|
||||||
$dataDir = rtrim($inputDir, '/') . '/data';
|
$dataDir = rtrim($inputDir, '/') . '/data';
|
||||||
@@ -100,6 +101,11 @@ class ImportService
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!$this->entityTypeExists($entityType)) {
|
||||||
|
$io->writeLine("Skipping {$entityType} (module not installed)");
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
$io->writeLine("Importing {$entityType}...");
|
$io->writeLine("Importing {$entityType}...");
|
||||||
|
|
||||||
$result = $this->entityImporter->import(
|
$result = $this->entityImporter->import(
|
||||||
@@ -133,7 +139,10 @@ class ImportService
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Restore attachment files
|
// Restore attachment files
|
||||||
if (is_dir($filesDir)) {
|
if ($noFiles) {
|
||||||
|
$io->writeLine('');
|
||||||
|
$io->writeLine('Attachment files: SKIPPED (--no-files)');
|
||||||
|
} else if (is_dir($filesDir)) {
|
||||||
$io->writeLine('');
|
$io->writeLine('');
|
||||||
$io->writeLine('Restoring attachment files...');
|
$io->writeLine('Restoring attachment files...');
|
||||||
|
|
||||||
@@ -171,4 +180,14 @@ class ImportService
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private function entityTypeExists(string $entityType): bool
|
||||||
|
{
|
||||||
|
try {
|
||||||
|
$this->entityManager->getRDBRepository($entityType);
|
||||||
|
return true;
|
||||||
|
} catch (\Exception $e) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "DataMigration",
|
"name": "DataMigration",
|
||||||
"version": "1.1.0",
|
"version": "1.1.4",
|
||||||
"acceptableVersions": [
|
"acceptableVersions": [
|
||||||
">=8.0.0"
|
">=8.0.0"
|
||||||
],
|
],
|
||||||
|
|||||||
Reference in New Issue
Block a user