On Wednesday 23 April 2014 15:16:36 Ryan Hoshor wrote:
> Hello everyone,
> I posted this on the public forums, but was directed to post it here,
> so I
> am just copying from my post here:
> http://forum.owncloud.org/viewtopic.php?f=26&t=20857&p=58502
>
> I am attempting to write a script that will calculate the usage of every
> person's account for internal billing purposes. I have a bash script that
> calculates the actual disk space used on the storage backend, but that is
> sort of clunky for what I need. I used the following SQL to try and
> calculate, but am getting incorrect results:
>
>
> SELECT
> oc_storages.id,
> oc_filecache.storage,
> SUM(oc_filecache.size/8589934592) AS size
> FROM
> oc_filecache
> JOIN
> oc_storages
> ON
> oc_filecache.storage = oc_storages.numeric_id
> GROUP BY
> storage
>
>
> Any ideas where the 'settings/templates/personal.php' file gets it's
> information from, or how to access that info for each and every user of the
> system?
The size for folders in the database is already the sum of each file within the
folder, you don't need to sum yourself. You only have to get the size of the
`files` folder
SELECT
oc_storages.id,
oc_filecache.storage,
oc_filecache.size/8589934592 AS size
FROM
oc_filecache
JOIN
oc_storages
ON
oc_filecache.storage = oc_storages.numeric_id
WHERE
name = 'files'
GROUP BY
storage
- Robin Appelman
_______________________________________________
Devel mailing list
[email protected]
http://mailman.owncloud.org/mailman/listinfo/devel