@xuda.io/drive_module 1.1.1445 → 1.1.1446
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 +42 -44
- package/package.json +1 -1
package/index.mjs
CHANGED
|
@@ -624,59 +624,57 @@ 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
|
-
setTimeout(() => {
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
const app_id_reference = await _common.get_project_app_id(app_id);
|
|
635
|
-
const target_dir = path.join(_conf[`studio_drive_path`], app_id_reference, doc.originalname);
|
|
627
|
+
setTimeout(async () => {
|
|
628
|
+
for (const doc of docs) {
|
|
629
|
+
try {
|
|
630
|
+
switch (drive_type) {
|
|
631
|
+
case 'studio': {
|
|
632
|
+
const app_id_reference = await _common.get_project_app_id(app_id);
|
|
633
|
+
const target_dir = path.join(_conf[`studio_drive_path`], app_id_reference, doc.originalname);
|
|
636
634
|
|
|
637
|
-
|
|
635
|
+
rimraf.sync(target_dir);
|
|
638
636
|
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
637
|
+
misc_msa.rsync_drive_resources_to_remote_servers('studio', app_id_reference);
|
|
638
|
+
break;
|
|
639
|
+
}
|
|
642
640
|
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
641
|
+
case 'workspace': {
|
|
642
|
+
if (doc.type === 'file') {
|
|
643
|
+
try {
|
|
644
|
+
if (doc.bucket) {
|
|
645
|
+
await delete_file_from_bucket(doc.bucket);
|
|
646
|
+
} else {
|
|
647
|
+
const { data: app_obj } = await db_module.get_app_obj(app_id);
|
|
648
|
+
if (app_obj?.app_type === 'datacenter') {
|
|
649
|
+
const host = `root@${app_obj.app_hosting_server.ip}`;
|
|
650
|
+
await _utils.run_ssh_script(`ssh ${host} "mv /var/xuda/workspace_drive/${doc.server_file_name} /tmp/;" `);
|
|
651
|
+
} else if (app_obj?.is_deployment) {
|
|
652
|
+
const { data: datacenter_obj } = await db_module.get_app_obj(app_obj.app_datacenter_id);
|
|
653
|
+
const host = `root@${datacenter_obj.app_hosting_server.ip}`;
|
|
654
|
+
await _utils.run_ssh_script(`ssh ${host} "mv /var/xuda/workspace_drive/${doc.server_file_name} /tmp/;" `);
|
|
655
|
+
}
|
|
657
656
|
}
|
|
658
|
-
}
|
|
659
|
-
}
|
|
657
|
+
} catch (error) {}
|
|
658
|
+
}
|
|
659
|
+
|
|
660
|
+
break;
|
|
660
661
|
}
|
|
661
662
|
|
|
662
|
-
|
|
663
|
-
|
|
663
|
+
case 'user': {
|
|
664
|
+
if (doc.type === 'file') {
|
|
665
|
+
try {
|
|
666
|
+
await delete_file_from_bucket(doc.bucket);
|
|
667
|
+
} catch (error) {}
|
|
668
|
+
}
|
|
664
669
|
|
|
665
|
-
|
|
666
|
-
if (doc.type === 'file') {
|
|
667
|
-
try {
|
|
668
|
-
await delete_file_from_bucket(doc.bucket);
|
|
669
|
-
} catch (error) {}
|
|
670
|
+
break;
|
|
670
671
|
}
|
|
671
|
-
|
|
672
|
-
|
|
672
|
+
default:
|
|
673
|
+
break;
|
|
673
674
|
}
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
} catch (error) {}
|
|
678
|
-
}
|
|
679
|
-
}, 1000);
|
|
675
|
+
} catch (error) {}
|
|
676
|
+
}
|
|
677
|
+
}, 1000);
|
|
680
678
|
return {
|
|
681
679
|
code: 200,
|
|
682
680
|
data: ret,
|