How does cPanel calculate the quotas for a user?
Quota-calculation is actually handled by the operating system. Using the quota command, you can retrieve the same information that cPanel would utilize to display disk and inode usage:
[root@the ~]$ quota -svu $USER
Disk quotas for user blue (uid 1033):
Filesystem space quota limit grace files quota limit grace
/dev/vda1 3360K 10240M 10240M 91 0 0