owncloud/core — pull request #5684 by PVince81 (2013-11-04 16:09:45+00:00)
Title: Workaround to calculate root folder usage when not in DB

In some cases when a scan process is in progress (or not started yet),
the root folder might have a size of -1.

To make sure that the quota can still be calculated correctly, an
special SQL query is used to pre-calculate the root folder size by
summing the size of all known files, which is better than no value at
all.

Fixes #5509

Please review @DeepDiver1975 @icewind1991 @karlitschek

This shouldn't happen too often, only when some race condition occurs.
If it is not acceptable to select that way (in case it still happens too often), we can replace it with an UPDATE that writes the value into the DB, which might have some other side effects related to scanners (but unlikely)