1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
|
<?php
/**
* ownCloud - DjazzLab Storage Charts plugin
*
* @author Xavier Beurois
* @copyright 2012 Xavier Beurois www.djazz-lab.net
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE
* License as published by the Free Software Foundation; either
* version 3 of the License, or any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU AFFERO GENERAL PUBLIC LICENSE for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
*
*/
OCP\App::checkAppEnabled('storage_charts');
$l = OC_L10N::get('storage_charts');
OC::$CLASSPATH['OC_DLStCharts'] = "apps/storage_charts/lib/db.class.php";
OC::$CLASSPATH['OC_DLStChartsLoader'] = "apps/storage_charts/lib/loader.class.php";
if(OC_Group::inGroup(OCP\User::getUser(), 'admin')){
OCP\App::register(Array(
'order' => 60,
'id' => 'storage_charts',
'name' => 'Storage Charts'
));
OCP\App::addNavigationEntry(Array(
'id' => 'storage_charts',
'order' => 60,
'href' => OCP\Util::linkTo('storage_charts', 'charts.php'),
'icon' => OCP\Util::imagePath('storage_charts', 'chart.png'),
'name' => 'DL Charts'
));
OCP\App::registerPersonal('storage_charts','settings');
}elseif(OCP\User::isLoggedIn() && $_GET['app'] == 'storage_charts'){
die($l->t('Permission denied.'));
}
// Get storage value for logged in user
$data_dir = OCP\Config::getSystemValue('datadirectory', '');
if(OCP\User::getUser() && strlen($data_dir) != 0){
$fs = OCP\Files::getStorage('files');
$used = OC_DLStCharts::getTotalDataSize(OC::$CONFIG_DATADIRECTORY);
$total = OC_DLStCharts::getTotalDataSize($data_dir) + $fs->free_space();
OC_DLStCharts::update($used, $total);
}
|