Skip to content
Snippets Groups Projects
Commit 2982dc73 authored by Florian Kaiser's avatar Florian Kaiser
Browse files

version 2.0.0: ownCloud 10 compatibility

now uses oc_accounts table, no longer compatible
or at least tested with ownCloud < 10.0
parent f1bd077d
No related branches found
No related tags found
No related merge requests found
......@@ -9,6 +9,8 @@ This app is only meant for admins, so best restrict it to the admin group in the
Otherwise normal users will see it in their navigation but get an error when they try to access it.
Requires ownCloud 10 or later.
# Disclaimer
This app basically does SUMs over the oc_filecache table.
......
......@@ -5,10 +5,10 @@
<description>Displays used space for all users</description>
<licence>AGPL</licence>
<author>Florian Kaiser</author>
<version>0.0.1</version>
<version>2.0.0</version>
<namespace>StorageUsage</namespace>
<category>other</category>
<dependencies>
<owncloud min-version="8.1" />
<owncloud min-version="10.0" max-version="11.0" />
</dependencies>
</info>
......@@ -13,16 +13,15 @@ class UsageDAO {
public function getUsage() {
$dbPlatform = $this->db->getDatabasePlatform();
$join_storage_expr = $dbPlatform->getConcatExpression('"home::"', '*PREFIX*preferences.userid');
$sql = 'SELECT *PREFIX*preferences.userid AS username, *PREFIX*preferences.configvalue as quotastring, *PREFIX*filecache.size as bytes, sub.num as objects
FROM *PREFIX*preferences
LEFT JOIN *PREFIX*storages ON (*PREFIX*storages.id=' . $join_storage_expr . ')
LEFT JOIN *PREFIX*filecache ON (*PREFIX*storages.numeric_id=*PREFIX*filecache.storage)
LEFT JOIN (SELECT storage, COUNT(*) as num FROM *PREFIX*filecache GROUP BY storage) sub ON (sub.storage=*PREFIX*storages.numeric_id)
WHERE *PREFIX*preferences.appid="files" and *PREFIX*preferences.configkey="quota"
AND *PREFIX*filecache.path="files"
ORDER BY *PREFIX*filecache.size DESC;';
$join_storage_expr = $dbPlatform->getConcatExpression('"home::"', '*PREFIX*accounts.user_id');
$sql = 'SELECT *PREFIX*accounts.user_id AS username, *PREFIX*accounts.quota as quotastring, *PREFIX*filecache.size as bytes, sub.num as objects
FROM *PREFIX*accounts
LEFT JOIN *PREFIX*storages ON (*PREFIX*storages.id=' . $join_storage_expr . ')
LEFT JOIN *PREFIX*filecache ON (*PREFIX*storages.numeric_id=*PREFIX*filecache.storage)
LEFT JOIN (SELECT storage, COUNT(*) as num FROM *PREFIX*filecache GROUP BY storage) sub ON (sub.storage=*PREFIX*storages.numeric_id)
WHERE *PREFIX*filecache.path="files"
ORDER BY *PREFIX*filecache.size DESC;';
$stmt = $this->db->prepare($sql);
$stmt->execute();
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment