Commit 4719423b8c68ef16c1adf6976fae27bcd1a5b84b

Authored by Conrad Vermeulen
1 parent 48f7b210

KTS-1753

" Implement Disk Usage Plugin"
Updated. Added cross platform calling of df

Committed By: Conrad Vermeulen
Reviewed By: Kevin Fourie

git-svn-id: https://kt-dms.svn.sourceforge.net/svnroot/kt-dms/trunk@7517 c91229c3-7414-0410-bfa2-8a42b809f60b
plugins/housekeeper/DiskUsageDashlet.inc.php
... ... @@ -6,32 +6,32 @@
6 6 * KnowledgeTree Open Source Edition
7 7 * Document Management Made Simple
8 8 * Copyright (C) 2004 - 2007 The Jam Warehouse Software (Pty) Limited
9   - *
  9 + *
10 10 * This program is free software; you can redistribute it and/or modify it under
11 11 * the terms of the GNU General Public License version 3 as published by the
12 12 * Free Software Foundation.
13   - *
  13 + *
14 14 * This program is distributed in the hope that it will be useful, but WITHOUT
15 15 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
16 16 * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
17 17 * details.
18   - *
  18 + *
19 19 * You should have received a copy of the GNU General Public License
20 20 * along with this program. If not, see <http://www.gnu.org/licenses/>.
21   - *
  21 + *
22 22 * You can contact The Jam Warehouse Software (Pty) Limited, Unit 1, Tramber Place,
23 23 * Blake Street, Observatory, 7925 South Africa. or email info@knowledgetree.com.
24   - *
  24 + *
25 25 * The interactive user interfaces in modified source and object code versions
26 26 * of this program must display Appropriate Legal Notices, as required under
27 27 * Section 5 of the GNU General Public License version 3.
28   - *
  28 + *
29 29 * In accordance with Section 7(b) of the GNU General Public License version 3,
30 30 * these Appropriate Legal Notices must retain the display of the "Powered by
31   - * KnowledgeTree" logo and retain the original copyright notice. If the display of the
  31 + * KnowledgeTree" logo and retain the original copyright notice. If the display of the
32 32 * logo is not reasonably feasible for technical reasons, the Appropriate Legal Notices
33   - * must display the words "Powered by KnowledgeTree" and retain the original
34   - * copyright notice.
  33 + * must display the words "Powered by KnowledgeTree" and retain the original
  34 + * copyright notice.
35 35 * Contributor( s): ______________________________________
36 36 */
37 37  
... ... @@ -83,10 +83,21 @@ class DiskUsageDashlet extends KTBaseDashlet
83 83 // we will only check if the result is not cached, or after 5 minutes
84 84 if ($check)
85 85 {
86   - $result = ktutil::pexec($this->dfCmd);
  86 + $cmd = $this->dfCmd;
  87 +
  88 + if (OS_WINDOWS)
  89 + {
  90 + $cmd = str_replace( '/','\\',$cmd);
  91 + $result = `"$cmd" 2>&1`;
  92 + }
  93 + else
  94 + {
  95 + $result = shell_exec($cmd." 2>&1");
  96 + }
  97 +
  98 + $result = explode("\n", $result);
87 99  
88   - $result = $result['out'];
89   - unset($result[0]);
  100 + unset($result[0]); // gets rid of headings
90 101  
91 102 $usage=array();
92 103 foreach($result as $line)
... ...