It'd be nice to show how big the attachments will be, on the export page.  I 
was experimenting with mongo queries to see if it is possible, seems like it 
should be.  Below is 2 queries to get the total size for 1 tool.  Seems to work 
fine, although if you have many tools that could be a lot of queries.  Maybe 
could do some more aggregation to do it all together in a few queries 
(`$lookup` aggregation operator looks interesting, but only available since 
mongo 3.2).

~~~~js
file_ids = db.attachment.find({app_config_id: some_ac_id}).map(function(a) { 
return a.file_id });
db.attachment.files.aggregate([
    {$match: {
        _id: {$in: file_ids},
    }},
    {$group: {
        _id: 'total',
        total_size: {$sum: "$length"},
    }}
]).result[0].total_size / 1024 / 1024;
~~~~


---

** [tickets:#6662] Add attachments to Export [ss5383]**

**Status:** open
**Milestone:** unreleased
**Labels:** export 
**Created:** Tue Sep 17, 2013 03:44 PM UTC by Chris Tsai
**Last Updated:** Tue Oct 22, 2013 01:08 PM UTC
**Owner:** nobody


[forge:site-support:#5383]

>I like the new Project Data Export feature, but what about attachments to 
>wiki, ticket, or discussion items? Not that I really want these encoded into a 
>JSON file, but this isn't really a complete "copy for safekeeping" if the 
>export only has URLs to sourceforge.net for any attached images, patch files, 
>etc.

1. We should put the attachments in a separate folder
2. We should make attachments optional, so folks won't get an enormous backup 
if they don't want it


---

Sent from forge-allura.apache.org because [email protected] is subscribed 
to https://forge-allura.apache.org/p/allura/tickets/

To unsubscribe from further messages, a project admin can change settings at 
https://forge-allura.apache.org/p/allura/admin/tickets/options.  Or, if this is 
a mailing list, you can unsubscribe from the mailing list.

Reply via email to