Hey Tom,

That's a pretty interesting question! ... which...well..raises more questions :)
- what do you want to count, exactly ? Disk space usage, amount of... pages ? 
Of... content, as the subject line suggests ?
- what do you consider as content ? Articles' main text ? How about titles, 
abstracts and other pieces of text ? Attached binaries ? Binaries from the dms ?

That blog post is fairly interesting, but can't really be applied to Magnolia - 
Magnolia doesn't use nt:file and related nodetypes, because, well, it doesn't 
manage files and folders.

If you're interesting in disk space usage and the like, the pragmatic solutions 
are along the lines of, well, looking at how much space your db users on the 
filesystem, and/or exporting your content to jcr/xml files and looking at their 
sizes. But I'm guessing that's not exactly what you're interested in. In terms 
of API, you probably want to have a look at visitors, which will let you do all 
sorts of fancy counting.
Pre 4.5, you'll want ContentUtil.Visitor : 
http://nexus.magnolia-cms.com/content/sites/magnolia.public.sites/ref/4.5-RC2/magnolia-core/apidocs/info/magnolia/cms/util/ContentUtil.html#visit(info.magnolia.cms.core.Content,%20info.magnolia.cms.util.ContentUtil.Visitor)
As per 4.5, switch to JCR-based APIs and use 
http://nexus.magnolia-cms.com/content/sites/magnolia.public.sites/ref/4.5-RC2/magnolia-core/apidocs/info/magnolia/jcr/util/NodeUtil.html#visit(javax.jcr.Node,%20info.magnolia.jcr.util.NodeVisitor)
 instead.

I seem to remember the are a few examples lying about on the wiki - search for 
"visitor" or "scripts", perhaps they'll give some inspiration.

As a side note, this is the kind of thing that'd be great to see as a script 
that others can use. I started a GitHub repo just for this kind of thing - see 
https://github.com/gjoseph/Magnolia-Groovy-Scripts

Cheers !

-greg

On 01 Mar 2012, at 20:37, Tom Duffey wrote:

> Hi Everyone,
> 
> I have a need to calculate the size of the content stored in one of our 
> Magnolia sites (That is rapidly growing!).  There is a blog post over here 
> about doing this with the JCR:
> 
> http://tugdualgrall.blogspot.com/2011/03/how-to-calculate-size-of-folder-in-jcr.html
> 
> Does anyone know how to do something similar in Magnolia?  I tried using 
> Magnolia's QueryManager and related query tools but am not sure how to 
> properly write either the code or query to retrieve the nt:file nodes.
> 
> Thanks,
> 
> Tom
> 
> --
> Tom Duffey
> [email protected]
> 414-751-0600 x102
> 
> 
> 
> 
> 
> 
> 
> ----------------------------------------------------------------
> For list details, see http://www.magnolia-cms.com/community/mailing-lists.html
> Alternatively, use our forums: http://forum.magnolia-cms.com/
> To unsubscribe, E-mail to: <[email protected]>
> ----------------------------------------------------------------



----------------------------------------------------------------
For list details, see http://www.magnolia-cms.com/community/mailing-lists.html
Alternatively, use our forums: http://forum.magnolia-cms.com/
To unsubscribe, E-mail to: <[email protected]>
----------------------------------------------------------------

Reply via email to