@xuda.io/drive_module 1.1.1437 → 1.1.1439
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.mjs +39 -38
- package/package.json +1 -1
package/index.mjs
CHANGED
|
@@ -624,53 +624,54 @@ export const delete_drive_files = async (req, job_id, headers) => {
|
|
|
624
624
|
ret = await db_module.sava_app_couch_bulk_docs(app_id_delete, docs);
|
|
625
625
|
|
|
626
626
|
// cleanup
|
|
627
|
-
for
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
627
|
+
for (const doc of docs) {
|
|
628
|
+
try {
|
|
629
|
+
switch (drive_type) {
|
|
630
|
+
case 'studio': {
|
|
631
|
+
const app_id_reference = await _common.get_project_app_id(app_id);
|
|
632
|
+
const target_dir = path.join(_conf[`studio_drive_path`], app_id_reference, doc.originalname);
|
|
633
633
|
|
|
634
|
-
|
|
634
|
+
rimraf.sync(target_dir);
|
|
635
635
|
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
636
|
+
misc_msa.rsync_drive_resources_to_remote_servers('studio', app_id_reference);
|
|
637
|
+
break;
|
|
638
|
+
}
|
|
639
639
|
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
640
|
+
case 'workspace': {
|
|
641
|
+
if (doc.type === 'file') {
|
|
642
|
+
try {
|
|
643
|
+
if (doc.bucket) {
|
|
644
|
+
await delete_file_from_bucket(doc.bucket);
|
|
645
|
+
} else {
|
|
646
|
+
const { data: app_obj } = await db_module.get_app_obj(app_id);
|
|
647
|
+
if (app_obj?.app_type === 'datacenter') {
|
|
648
|
+
const host = `root@${app_obj.app_hosting_server.ip}`;
|
|
649
|
+
await _utils.run_ssh_script(`ssh ${host} "mv /var/xuda/workspace_drive/${doc.server_file_name} /tmp/;" `);
|
|
650
|
+
} else if (app_obj?.is_deployment) {
|
|
651
|
+
const { data: datacenter_obj } = await db_module.get_app_obj(app_obj.app_datacenter_id);
|
|
652
|
+
const host = `root@${datacenter_obj.app_hosting_server.ip}`;
|
|
653
|
+
await _utils.run_ssh_script(`ssh ${host} "mv /var/xuda/workspace_drive/${doc.server_file_name} /tmp/;" `);
|
|
654
|
+
}
|
|
654
655
|
}
|
|
655
|
-
}
|
|
656
|
-
}
|
|
656
|
+
} catch (error) {}
|
|
657
|
+
}
|
|
658
|
+
|
|
659
|
+
break;
|
|
657
660
|
}
|
|
658
661
|
|
|
659
|
-
|
|
660
|
-
|
|
662
|
+
case 'user': {
|
|
663
|
+
if (doc.type === 'file') {
|
|
664
|
+
try {
|
|
665
|
+
await delete_file_from_bucket(doc.bucket);
|
|
666
|
+
} catch (error) {}
|
|
667
|
+
}
|
|
661
668
|
|
|
662
|
-
|
|
663
|
-
if (doc.type === 'file') {
|
|
664
|
-
try {
|
|
665
|
-
await delete_file_from_bucket(doc.bucket);
|
|
666
|
-
} catch (error) {}
|
|
669
|
+
break;
|
|
667
670
|
}
|
|
668
|
-
|
|
669
|
-
|
|
671
|
+
default:
|
|
672
|
+
break;
|
|
670
673
|
}
|
|
671
|
-
|
|
672
|
-
break;
|
|
673
|
-
}
|
|
674
|
+
} catch (error) {}
|
|
674
675
|
}
|
|
675
676
|
|
|
676
677
|
return {
|