Commit 6d1dcd8ef467bac5dc1faaa8f8a8d46917a8f471

Authored by Conrad Vermeulen
1 parent 126685ea

KTS-3431

"Disk Usage stats should be a background task and cached"
Implemented.

KTS-3432
"Storage Usage status should be retrieved in a background task and cached"
Implemented.

Committed By: Conrad Vermeulen
Reviewed By: Megan Watson

git-svn-id: https://kt-dms.svn.sourceforge.net/svnroot/kt-dms/trunk@8602 c91229c3-7414-0410-bfa2-8a42b809f60b
plugins/housekeeper/DiskUsageDashlet.inc.php
... ... @@ -38,165 +38,54 @@
38 38  
39 39 class DiskUsageDashlet extends KTBaseDashlet
40 40 {
41   - private $dfCmd;
42   - private $usage;
43   - private $warningPercent;
44   - private $urgentPercent;
  41 + private $usage;
45 42  
46   - function DiskUsageDashlet()
47   - {
48   - $this->sTitle = _kt('Storage Utilization');
49   - $this->sClass = "ktInfo";
50   - }
51   -
52   - function is_active($oUser)
53   - {
54   - $dfCmd = KTUtil::findCommand('externalBinary/df','df');
55   - if ($dfCmd === false)
56   - {
57   - return false;
58   - }
59   - $this->dfCmd = $dfCmd;
60   -
61   - $config = KTConfig::getSingleton();
62   - $this->warningPercent = $config->get('DiskUsage/warningThreshold', 15);
63   - $this->urgentPercent = $config->get('DiskUsage/urgentThreshold', 5);
64   -
65   - $got_usage = $this->getUsage();
66   -
67   - if ($got_usage == false)
68   - {
69   - return false;
70   - }
71   -
72   - return Permission::userIsSystemAdministrator();
73   - }
74   -
75   - function getUsage($refresh=false)
76   - {
77   - if (isset($_SESSION['DiskUsage']['problem']))
78   - {
79   - return false;
80   - }
81   -
82   - $check = true;
83   - // check if we have a cached result
84   - if (isset($_SESSION['DiskUsage']))
85   - {
86   - // we will only do the check every 5 minutes
87   - if (time() - $_SESSION['DiskUsage']['time'] < 5 * 60)
88   - {
89   - $check = false;
90   - $this->usage = $_SESSION['DiskUsage']['usage'];
91   - }
92   - }
93   -
94   - // we will only check if the result is not cached, or after 5 minutes
95   - if ($check)
96   - {
97   - $cmd = $this->dfCmd;
98   -
99   - if (OS_WINDOWS)
100   - {
101   - $cmd = str_replace( '/','\\',$cmd);
102   - $res = KTUtil::pexec("\"$cmd\" -B 1 2>&1");
103   - $result = implode("\r\n",$res['out']);
104   - }
105   - else
106   - {
107   - if(strtolower(PHP_OS) == 'darwin'){
108   - $result = shell_exec($cmd." -k 2>&1");
109   - }else{
110   - $result = shell_exec($cmd." -B 1 2>&1");
111   - }
112   - }
113   -
114   - if (strpos($result, 'cannot read table of mounted file systems') !== false)
115   - {
116   - $_SESSION['DiskUsage']['problem'] = true;
117   - return false;
118   - }
119   -
120   -
121   - $result = explode("\n", $result);
122   -
123   - unset($result[0]); // gets rid of headings
124   -
125   - $usage=array();
126   - foreach($result as $line)
127   - {
128   - if (empty($line)) continue;
129   - preg_match('/(.*)\s+(\d+)\s+(\d+)\s+(\d+)\s+(\d+)\%\s+(.*)/', $line, $matches);
130   - list($line, $filesystem, $size, $used, $avail, $usedp, $mount) = $matches;
131   -
132   - if ($size === 0) continue;
133   -
134   - if(strtolower(PHP_OS) == 'darwin'){
135   - $size = $size * 1024;
136   - $used = $used * 1024;
137   - $avail = $avail * 1024;
138   - }
139   -
140   - $colour = '';
141   - if ($usedp >= 100 - $this->urgentPercent)
142   - {
143   - $colour = 'red';
144   - }
145   - elseif ($usedp >= 100 - $this->warningPercent)
146   - {
147   - $colour = 'orange';
148   - }
149   -
150   - $usage[] = array(
151   - 'filesystem'=>$filesystem,
152   - 'size'=>KTUtil::filesizeToString($size),
153   - 'used'=>KTUtil::filesizeToString($used),
154   - 'available'=>KTUtil::filesizeToString($avail),
155   - 'usage'=>$usedp . '%',
156   - 'mounted'=>$mount,
157   - 'colour'=>$colour
158   - );
159   - }
160   -
161   - $this->usage = $usage;
162   -
163   - $_SESSION['DiskUsage']['time'] = time();
164   - $_SESSION['DiskUsage']['usage'] = $this->usage;
165   - }
  43 + function DiskUsageDashlet()
  44 + {
  45 + $this->sTitle = _kt('Storage Utilization');
  46 + $this->sClass = "ktInfo";
  47 + }
166 48  
167   - return true;
168   - }
  49 + function is_active($oUser)
  50 + {
  51 + $usage = unserialize(KTUtil::getSystemSetting('DiskUsage','n/a'));
  52 + if ($usage == 'n/a') return false;
  53 + $this->usage = $usage;
  54 + return Permission::userIsSystemAdministrator();
  55 + }
169 56  
170   - function render()
171   - {
172   - $oTemplating =& KTTemplating::getSingleton();
173   - $oTemplate = $oTemplating->loadTemplate('DiskUsage');
  57 + function render()
  58 + {
  59 + $oTemplating =& KTTemplating::getSingleton();
  60 + $oTemplate = $oTemplating->loadTemplate('DiskUsage');
174 61  
175   - $oRegistry =& KTPluginRegistry::getSingleton();
176   - $oPlugin =& $oRegistry->getPlugin('ktcore.housekeeper.plugin');
  62 + $oRegistry =& KTPluginRegistry::getSingleton();
  63 + $oPlugin =& $oRegistry->getPlugin('ktcore.housekeeper.plugin');
177 64  
178   - $config = KTConfig::getSingleton();
179   - $rootUrl = $config->get('KnowledgeTree/rootUrl');
  65 + $config = KTConfig::getSingleton();
  66 + $rootUrl = $config->get('KnowledgeTree/rootUrl');
180 67  
181   - $dispatcherURL = $oPlugin->getURLPath('HouseKeeperDispatcher.php');
182   - if (!empty($rootUrl)) $dispatcherURL = $rootUrl . $dispatcherURL;
183   - $dispatcherURL = str_replace( '\\', '/', $dispatcherURL);
  68 + $dispatcherURL = $oPlugin->getURLPath('HouseKeeperDispatcher.php');
  69 + if (!empty($rootUrl)) $dispatcherURL = $rootUrl . $dispatcherURL;
  70 + $dispatcherURL = str_replace( '\\', '/', $dispatcherURL);
184 71 if ( substr( $dispatcherURL, 0,1 ) != '/')
185   - {
186   - $dispatcherURL = '/'.$dispatcherURL;
187   - }
  72 + {
  73 + $dispatcherURL = '/'.$dispatcherURL;
  74 + }
  75 +
  76 + $warningPercent = $config->get('DiskUsage/warningThreshold', 15);
  77 + $urgentPercent = $config->get('DiskUsage/urgentThreshold', 5);
188 78  
189   - $aTemplateData = array(
190   - 'context' => $this,
191   - 'usages'=>$this->usage,
192   - 'warnPercent'=>$this->warningPercent,
193   - 'urgentPercent'=>$this->urgentPercent,
194   - 'dispatcherURL'=>$dispatcherURL
195   - );
  79 + $aTemplateData = array(
  80 + 'context' => $this,
  81 + 'usages'=> $this->usage,
  82 + 'warnPercent'=>$warningPercent,
  83 + 'urgentPercent'=>$urgentPercent,
  84 + 'dispatcherURL'=>$dispatcherURL
  85 + );
196 86  
197 87 return $oTemplate->render($aTemplateData);
198 88 }
199 89 }
200 90  
201   -
202 91 ?>
... ...
plugins/housekeeper/FolderUsageDashlet.inc.php
... ... @@ -38,141 +38,48 @@
38 38  
39 39 class FolderUsageDashlet extends KTBaseDashlet
40 40 {
41   - private $usage;
  41 + private $usage;
42 42  
43   - function FolderUsageDashlet()
44   - {
45   - $this->sTitle = _kt('System Folder Utilization');
46   - $this->sClass = "ktInfo";
47   - }
  43 + function FolderUsageDashlet()
  44 + {
  45 + $this->sTitle = _kt('System Folder Utilization');
  46 + $this->sClass = "ktInfo";
  47 + }
48 48  
49   - function is_active($oUser)
50   - {
51   - return Permission::userIsSystemAdministrator();
52   - }
  49 + function is_active($oUser)
  50 + {
  51 + return Permission::userIsSystemAdministrator();
  52 + }
53 53  
54   - function scanPath($path,$pattern)
55   - {
56   - $files=0;
57   - $filesize=0;
  54 + function render()
  55 + {
  56 + $oTemplating =& KTTemplating::getSingleton();
  57 + $oTemplate = $oTemplating->loadTemplate('FolderUsage');
58 58  
59   - if (is_dir($path) && ($dh = opendir($path)))
60   - {
61   - while (($file = readdir($dh)) !== false)
62   - {
63   - if (substr($file,0,1) == '.')
64   - {
65   - continue;
66   - }
  59 + $oRegistry =& KTPluginRegistry::getSingleton();
  60 + $oPlugin =& $oRegistry->getPlugin('ktcore.housekeeper.plugin');
67 61  
68   - $full = $path . '/' . $file;
  62 + $config = KTConfig::getSingleton();
  63 + $rootUrl = $config->get('KnowledgeTree/rootUrl');
69 64  
70   - if (!is_readable($full) || !is_writable($full))
71   - {
72   - continue;
73   - }
74   -
75   - if (is_dir($full))
76   - {
77   - $result = $this->scanPath($full,$pattern);
78   - $files += $result['files'];
79   - $filesize += $result['filesize'];
80   - continue;
81   - }
82   - if ($pattern != '')
83   - {
84   - if (preg_match('/' . $pattern . '/', $file) === false)
85   - {
86   - continue;
87   - }
88   - }
89   -
90   - $files++;
91   - $filesize += filesize($full);
92   - }
93   - closedir($dh);
94   - }
95   - return array('files'=>$files,'filesize'=>$filesize,'dir'=>$path);
96   - }
97   -
98   - function getUsage()
99   - {
100   - $check = true;
101   - // check if we have a cached result
102   - if (isset($_SESSION['SystemFolderUsage']))
103   - {
104   - // we will only do the check every 5 minutes
105   - if (time() - $_SESSION['SystemFolderUsage']['time'] < 5 * 60)
106   - {
107   - $check = false;
108   - $this->usage = $_SESSION['SystemFolderUsage']['usage'];
109   - }
110   - }
111   -
112   - // we will only check if the result is not cached, or after 5 minutes
113   - if ($check)
114   - {
115   - $usage = array();
116   -
117   - $oRegistry =& KTPluginRegistry::getSingleton();
118   - $oPlugin =& $oRegistry->getPlugin('ktcore.housekeeper.plugin');
119   -
120   - $folders = $oPlugin->getDirectories();
121   -
122   - foreach($folders as $folder)
123   - {
124   - $directory = $folder['folder'];
125   - $pattern = $folder['pattern'];
126   - $canClean = $folder['canClean'];
127   - $name = $folder['name'];
128   -
129   - $temp = $this->scanPath($directory,$pattern);
130   -
131   - $usage[] = array(
132   - 'description'=>$name,
133   - 'folder'=>$directory,
134   - 'files'=>number_format($temp['files'],0,'.',','),
135   - 'filesize'=>KTUtil::filesizeToString($temp['filesize']),
136   - 'action'=>$i,
137   - 'canClean'=>$canClean
138   - );
139   - $this->usage = $usage;
140   - }
141   -
142   - $_SESSION['SystemFolderUsage']['time'] = time();
143   - $_SESSION['SystemFolderUsage']['usage'] = $this->usage;
144   - }
145   - }
146   -
147   - function render()
148   - {
149   - $oTemplating =& KTTemplating::getSingleton();
150   - $oTemplate = $oTemplating->loadTemplate('FolderUsage');
151   -
152   - $oRegistry =& KTPluginRegistry::getSingleton();
153   - $oPlugin =& $oRegistry->getPlugin('ktcore.housekeeper.plugin');
154   -
155   - $config = KTConfig::getSingleton();
156   - $rootUrl = $config->get('KnowledgeTree/rootUrl');
157   -
158   - $dispatcherURL = $oPlugin->getURLPath('HouseKeeperDispatcher.php');
159   - if (!empty($rootUrl)) $dispatcherURL = $rootUrl . $dispatcherURL;
  65 + $dispatcherURL = $oPlugin->getURLPath('HouseKeeperDispatcher.php');
  66 + if (!empty($rootUrl)) $dispatcherURL = $rootUrl . $dispatcherURL;
160 67 $dispatcherURL = str_replace( '\\', '/', $dispatcherURL);
161 68 if ( substr( $dispatcherURL, 0,1 ) != '/')
162   - {
163   - $dispatcherURL = '/'.$dispatcherURL;
164   - }
  69 + {
  70 + $dispatcherURL = '/'.$dispatcherURL;
  71 + }
165 72  
166   - $this->getUsage();
  73 + $usage = unserialize(KTUtil::getSystemSetting('KTUsage','n/a'));
167 74  
168   - $aTemplateData = array(
169   - 'context' => $this,
170   - 'usages'=>$this->usage,
171   - 'dispatcherURL'=>$dispatcherURL
172   - );
  75 + $aTemplateData = array(
  76 + 'context' => $this,
  77 + 'usages'=>$usage,
  78 + 'dispatcherURL'=>$dispatcherURL
  79 + );
173 80  
174   - return $oTemplate->render($aTemplateData);
175   - }
  81 + return $oTemplate->render($aTemplateData);
  82 + }
176 83 }
177 84  
178 85  
... ...
plugins/housekeeper/HouseKeeper.inc.php 0 → 100644
  1 +<?php
  2 +
  3 +/**
  4 + * $Id: $
  5 + *
  6 + * KnowledgeTree Community Edition
  7 + * Document Management Made Simple
  8 + * Copyright (C) 2008 KnowledgeTree Inc.
  9 + * Portions copyright The Jam Warehouse Software (Pty) Limited
  10 + *
  11 + * This program is free software; you can redistribute it and/or modify it under
  12 + * the terms of the GNU General Public License version 3 as published by the
  13 + * Free Software Foundation.
  14 + *
  15 + * This program is distributed in the hope that it will be useful, but WITHOUT
  16 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
  17 + * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
  18 + * details.
  19 + *
  20 + * You should have received a copy of the GNU General Public License
  21 + * along with this program. If not, see <http://www.gnu.org/licenses/>.
  22 + *
  23 + * You can contact KnowledgeTree Inc., PO Box 7775 #87847, San Francisco,
  24 + * California 94120-7775, or email info@knowledgetree.com.
  25 + *
  26 + * The interactive user interfaces in modified source and object code versions
  27 + * of this program must display Appropriate Legal Notices, as required under
  28 + * Section 5 of the GNU General Public License version 3.
  29 + *
  30 + * In accordance with Section 7(b) of the GNU General Public License version 3,
  31 + * these Appropriate Legal Notices must retain the display of the "Powered by
  32 + * KnowledgeTree" logo and retain the original copyright notice. If the display of the
  33 + * logo is not reasonably feasible for technical reasons, the Appropriate Legal Notices
  34 + * must display the words "Powered by KnowledgeTree" and retain the original
  35 + * copyright notice.
  36 + * Contributor( s): ______________________________________
  37 + *
  38 + */
  39 +
  40 +class HouseKeeper
  41 +{
  42 + public static
  43 + function getDiskUsageStats($update = true)
  44 + {
  45 + $config = KTConfig::getSingleton();
  46 +
  47 + $cmd = KTUtil::findCommand('externalBinary/df','df');
  48 + if ($cmd === false)
  49 + {
  50 + if ($update)
  51 + KTUtil::setSystemSetting('DiskUsage','n/a');
  52 + return false;
  53 + }
  54 +
  55 +
  56 + $warningPercent = $config->get('DiskUsage/warningThreshold', 15);
  57 + $urgentPercent = $config->get('DiskUsage/urgentThreshold', 5);
  58 +
  59 + if (OS_WINDOWS)
  60 + {
  61 + $cmd = str_replace( '/','\\',$cmd);
  62 + $res = KTUtil::pexec("\"$cmd\" -B 1 2>&1");
  63 + $result = implode("\r\n",$res['out']);
  64 + }
  65 + else
  66 + {
  67 + if(strtolower(PHP_OS) == 'darwin'){
  68 + $result = shell_exec($cmd." -k 2>&1");
  69 + }else{
  70 + $result = shell_exec($cmd." -B 1 2>&1");
  71 + }
  72 + }
  73 +
  74 + if (strpos($result, 'cannot read table of mounted file systems') !== false)
  75 + {
  76 + if ($update)
  77 + KTUtil::setSystemSetting('DiskUsage','n/a');
  78 + return false;
  79 + }
  80 +
  81 + $result = explode("\n", $result);
  82 +
  83 + unset($result[0]); // gets rid of headings
  84 +
  85 + $usage=array();
  86 + foreach($result as $line)
  87 + {
  88 + if (empty($line)) continue;
  89 + preg_match('/(.*)\s+(\d+)\s+(\d+)\s+(\d+)\s+(\d+)\%\s+(.*)/', $line, $matches);
  90 + list($line, $filesystem, $size, $used, $avail, $usedp, $mount) = $matches;
  91 +
  92 + if ($size === 0) continue;
  93 +
  94 + if(strtolower(PHP_OS) == 'darwin'){
  95 + $size = $size * 1024;
  96 + $used = $used * 1024;
  97 + $avail = $avail * 1024;
  98 + }
  99 +
  100 + $colour = '';
  101 + if ($usedp >= 100 - $urgentPercent)
  102 + {
  103 + $colour = 'red';
  104 + }
  105 + elseif ($usedp >= 100 - $warningPercent)
  106 + {
  107 + $colour = 'orange';
  108 + }
  109 +
  110 + $usage[] = array(
  111 + 'filesystem'=>trim($filesystem),
  112 + 'size'=>KTUtil::filesizeToString($size),
  113 + 'used'=>KTUtil::filesizeToString($used),
  114 + 'available'=>KTUtil::filesizeToString($avail),
  115 + 'usage'=>$usedp . '%',
  116 + 'mounted'=>trim($mount),
  117 + 'colour'=>$colour
  118 + );
  119 + }
  120 +
  121 + if ($update)
  122 + KTUtil::setSystemSetting('DiskUsage',serialize($usage));
  123 +
  124 + return $usage;
  125 + }
  126 +
  127 + private static
  128 + function scanPath($path,$pattern)
  129 + {
  130 + $files=0;
  131 + $filesize=0;
  132 +
  133 + if (is_dir($path) && ($dh = opendir($path)))
  134 + {
  135 + while (($file = readdir($dh)) !== false)
  136 + {
  137 + if (substr($file,0,1) == '.')
  138 + {
  139 + continue;
  140 + }
  141 +
  142 + $full = $path . '/' . $file;
  143 +
  144 + if (!is_readable($full) || !is_writable($full))
  145 + {
  146 + continue;
  147 + }
  148 +
  149 + if (is_dir($full))
  150 + {
  151 + $result = self::scanPath($full,$pattern);
  152 + $files += $result['files'];
  153 + $filesize += $result['filesize'];
  154 + continue;
  155 + }
  156 + if ($pattern != '')
  157 + {
  158 + if (preg_match('/' . $pattern . '/', $file) === false)
  159 + {
  160 + continue;
  161 + }
  162 + }
  163 +
  164 + $files++;
  165 + $filesize += filesize($full);
  166 + }
  167 + closedir($dh);
  168 + }
  169 + return array('files'=>$files,'filesize'=>$filesize,'dir'=>$path);
  170 + }
  171 +
  172 +
  173 +
  174 + private static
  175 + function getDirectories()
  176 + {
  177 + $config = KTConfig::getSingleton();
  178 + $cacheDir = $config->get('cache/cacheDirectory');
  179 +
  180 + $tempDir = $config->get('urls/tmpDirectory');
  181 + $logDir = $config->get('urls/logDirectory');
  182 + $docsDir = $config->get('urls/documentRoot');
  183 +
  184 + $indexer = Indexer::get();
  185 + $luceneDir = $indexer->getIndexDirectory();
  186 +
  187 + $systemDir = OS_UNIX?'/tmp':'c:/windows/temp';
  188 +
  189 + $folders = array(
  190 + array(
  191 + 'name'=>_kt('Smarty Cache'),
  192 + 'folder'=>$tempDir,
  193 + 'pattern'=>'^%%.*',
  194 + 'canClean'=>true
  195 + ),
  196 + array(
  197 + 'name'=>_kt('System Cache'),
  198 + 'folder'=>$cacheDir,
  199 + 'pattern'=>'',
  200 + 'canClean'=>true
  201 + ),
  202 + array(
  203 + 'name'=>_kt('System Logs'),
  204 + 'folder'=>$logDir,
  205 + 'pattern'=>'.+\.txt$',
  206 + 'canClean'=>true
  207 + ));
  208 +
  209 + $folders[] =
  210 + array(
  211 + 'name'=>_kt('Temporary Folder'),
  212 + 'folder'=>$tempDir,
  213 + 'pattern'=>'',
  214 + 'canClean'=>true
  215 + );
  216 +
  217 + $folders[] =
  218 + array(
  219 + 'name'=>_kt('System Temporary Folder'),
  220 + 'folder'=>$systemDir,
  221 + 'pattern'=>'(sess_.+)?(.+\.log$)?',
  222 + 'canClean'=>true
  223 + );
  224 +
  225 + if (is_dir($docsDir))
  226 + {
  227 + $folders[] =
  228 + array(
  229 + 'name'=>_kt('Documents'),
  230 + 'folder'=>$docsDir,
  231 + 'pattern'=>'',
  232 + 'canClean'=>false
  233 + );
  234 + }
  235 +
  236 + if (is_dir($luceneDir))
  237 + {
  238 + $folders[] =
  239 + array(
  240 + 'name'=>_kt('Document Index'),
  241 + 'folder'=>$luceneDir,
  242 + 'pattern'=>'',
  243 + 'canClean'=>false
  244 + );
  245 +
  246 + }
  247 + return $folders;
  248 + }
  249 +
  250 +
  251 + public static
  252 + function getKTUsageStats($update = true)
  253 + {
  254 + $usage = array();
  255 +
  256 + $oRegistry =& KTPluginRegistry::getSingleton();
  257 + $oPlugin =& $oRegistry->getPlugin('ktcore.housekeeper.plugin');
  258 +
  259 + $folders = self::getDirectories();
  260 +
  261 + foreach($folders as $folder)
  262 + {
  263 + $directory = $folder['folder'];
  264 + $pattern = $folder['pattern'];
  265 + $canClean = $folder['canClean'];
  266 + $name = $folder['name'];
  267 +
  268 + $temp = self::scanPath($directory,$pattern);
  269 +
  270 + $usage[] = array(
  271 + 'description'=>$name,
  272 + 'folder'=>$directory,
  273 + 'files'=>number_format($temp['files'],0,'.',','),
  274 + 'filesize'=>KTUtil::filesizeToString($temp['filesize']),
  275 + 'action'=>$i,
  276 + 'canClean'=>$canClean
  277 + );
  278 + }
  279 +
  280 + if ($update)
  281 + KTUtil::setSystemSetting('KTUsage',serialize($usage));
  282 + return $usage;
  283 + }
  284 +
  285 + private static $folders = null;
  286 +
  287 + public static
  288 + function getDirectory($folder)
  289 + {
  290 + if (is_null(self::$folders))
  291 + {
  292 + self::$folders = self::getDirectories();
  293 + }
  294 + foreach(self::$folders as $dir)
  295 + {
  296 + if ($dir['folder'] == $folder)
  297 + {
  298 + return $dir;
  299 + }
  300 + }
  301 + return null;
  302 + }
  303 +
  304 +
  305 + public static
  306 + function cleanDirectory($path, $pattern)
  307 + {
  308 + if (!is_readable($path))
  309 + {
  310 + return;
  311 + }
  312 + if ($dh = opendir($path))
  313 + {
  314 + while (($file = readdir($dh)) !== false)
  315 + {
  316 + if (substr($file,0,1) == '.')
  317 + {
  318 + continue;
  319 + }
  320 +
  321 + $full = $path . '/' . $file;
  322 + if (is_dir($full))
  323 + {
  324 + self::cleanDirectory($full,$pattern);
  325 + if (is_writable($full))
  326 + {
  327 + @rmdir($full);
  328 + }
  329 + continue;
  330 + }
  331 +
  332 + if (!empty($pattern) && !preg_match('/' . $pattern . '/', $file))
  333 + {
  334 + continue;
  335 + }
  336 +
  337 + if (is_writable($full))
  338 + {
  339 + @unlink($full);
  340 + }
  341 +
  342 + }
  343 + closedir($dh);
  344 + }
  345 + }
  346 +
  347 +}
  348 +
  349 +
  350 +?>
0 351 \ No newline at end of file
... ...
plugins/housekeeper/HouseKeeperDispatcher.php
... ... @@ -7,31 +7,31 @@
7 7 * Document Management Made Simple
8 8 * Copyright (C) 2008 KnowledgeTree Inc.
9 9 * Portions copyright The Jam Warehouse Software (Pty) Limited
10   - *
  10 + *
11 11 * This program is free software; you can redistribute it and/or modify it under
12 12 * the terms of the GNU General Public License version 3 as published by the
13 13 * Free Software Foundation.
14   - *
  14 + *
15 15 * This program is distributed in the hope that it will be useful, but WITHOUT
16 16 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
17 17 * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
18 18 * details.
19   - *
  19 + *
20 20 * You should have received a copy of the GNU General Public License
21 21 * along with this program. If not, see <http://www.gnu.org/licenses/>.
22   - *
23   - * You can contact KnowledgeTree Inc., PO Box 7775 #87847, San Francisco,
  22 + *
  23 + * You can contact KnowledgeTree Inc., PO Box 7775 #87847, San Francisco,
24 24 * California 94120-7775, or email info@knowledgetree.com.
25   - *
  25 + *
26 26 * The interactive user interfaces in modified source and object code versions
27 27 * of this program must display Appropriate Legal Notices, as required under
28 28 * Section 5 of the GNU General Public License version 3.
29   - *
  29 + *
30 30 * In accordance with Section 7(b) of the GNU General Public License version 3,
31 31 * these Appropriate Legal Notices must retain the display of the "Powered by
32   - * KnowledgeTree" logo and retain the original copyright notice. If the display of the
  32 + * KnowledgeTree" logo and retain the original copyright notice. If the display of the
33 33 * logo is not reasonably feasible for technical reasons, the Appropriate Legal Notices
34   - * must display the words "Powered by KnowledgeTree" and retain the original
  34 + * must display the words "Powered by KnowledgeTree" and retain the original
35 35 * copyright notice.
36 36 * Contributor( s): ______________________________________
37 37 */
... ... @@ -41,85 +41,34 @@ session_start();
41 41 require_once("../../config/dmsDefaults.php");
42 42 require_once(KT_LIB_DIR . "/templating/templating.inc.php");
43 43 require_once(KT_LIB_DIR . "/dispatcher.inc.php");
  44 +require_once('HouseKeeper.inc.php');
44 45  
45 46 class HouseKeeperDispatcher extends KTStandardDispatcher
46 47 {
47   - function cleanDirectory($path, $pattern)
48   - {
49   - if (!is_readable($path))
50   - {
51   - return;
52   - }
53   - if ($dh = opendir($path))
54   - {
55   - while (($file = readdir($dh)) !== false)
56   - {
57   - if (substr($file,0,1) == '.')
58   - {
59   - continue;
60   - }
61   -
62   - $full = $path . '/' . $file;
63   - if (is_dir($full))
64   - {
65   - $this->cleanDirectory($full,$pattern);
66   - if (is_writable($full))
67   - {
68   - @rmdir($full);
69   - }
70   - continue;
71   - }
72   -
73   - if (!empty($pattern) && !preg_match('/' . $pattern . '/', $file))
74   - {
75   - continue;
76   - }
77 48  
78   - if (is_writable($full))
79   - {
80   - @unlink($full);
81   - }
82   -
83   - }
84   - closedir($dh);
85   - }
86   -
87   - }
88   -
89   - function do_cleanup()
90   - {
91   - $folder = KTUtil::arrayGet($_REQUEST, 'folder');
92   - if (is_null($folder))
93   - {
94   - exit(redirect(generateControllerLink('dashboard')));
95   - }
  49 + function do_cleanup()
  50 + {
  51 + $folder = KTUtil::arrayGet($_REQUEST, 'folder');
  52 + if (is_null($folder))
  53 + {
  54 + exit(redirect(generateControllerLink('dashboard')));
  55 + }
96 56  
97   - $oRegistry =& KTPluginRegistry::getSingleton();
98   - $oPlugin =& $oRegistry->getPlugin('ktcore.housekeeper.plugin');
  57 + $oRegistry =& KTPluginRegistry::getSingleton();
  58 + $oPlugin =& $oRegistry->getPlugin('ktcore.housekeeper.plugin');
99 59  
100 60 // we must avoid doing anything to the documents folder at all costs!
101   - $folder = $oPlugin->getDirectory($folder);
  61 + $folder = HouseKeeper::getDirectory($folder);
102 62 if (is_null($folder) || !$folder['canClean'])
103 63 {
104   - exit(redirect(generateControllerLink('dashboard')));
  64 + exit(redirect(generateControllerLink('dashboard')));
105 65 }
106 66  
107   - $this->cleanDirectory($folder['folder'], $folder['pattern']);
108   -
109   - $this->do_refreshFolderUsage();
110   - }
111   -
112   - function do_refreshDiskUsage()
113   - {
114   - session_unregister('DiskUsage');
115   - exit(redirect(generateControllerLink('dashboard')));
116   - }
  67 + HouseKeeper::cleanDirectory($folder['folder'], $folder['pattern']);
  68 + HouseKeeper::getKTUsageStats();
117 69  
118   - function do_refreshFolderUsage()
119   - {
120   - session_unregister('SystemFolderUsage');
121   - exit(redirect(generateControllerLink('dashboard')));
122   - }
  70 + exit(redirect(generateControllerLink('dashboard')));
  71 + }
123 72 }
124 73 $oDispatcher = new HouseKeeperDispatcher();
125 74 $oDispatcher->dispatch();
... ...
plugins/housekeeper/HouseKeeperPlugin.php
... ... @@ -7,31 +7,31 @@
7 7 * Document Management Made Simple
8 8 * Copyright (C) 2008 KnowledgeTree Inc.
9 9 * Portions copyright The Jam Warehouse Software (Pty) Limited
10   - *
  10 + *
11 11 * This program is free software; you can redistribute it and/or modify it under
12 12 * the terms of the GNU General Public License version 3 as published by the
13 13 * Free Software Foundation.
14   - *
  14 + *
15 15 * This program is distributed in the hope that it will be useful, but WITHOUT
16 16 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
17 17 * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
18 18 * details.
19   - *
  19 + *
20 20 * You should have received a copy of the GNU General Public License
21 21 * along with this program. If not, see <http://www.gnu.org/licenses/>.
22   - *
23   - * You can contact KnowledgeTree Inc., PO Box 7775 #87847, San Francisco,
  22 + *
  23 + * You can contact KnowledgeTree Inc., PO Box 7775 #87847, San Francisco,
24 24 * California 94120-7775, or email info@knowledgetree.com.
25   - *
  25 + *
26 26 * The interactive user interfaces in modified source and object code versions
27 27 * of this program must display Appropriate Legal Notices, as required under
28 28 * Section 5 of the GNU General Public License version 3.
29   - *
  29 + *
30 30 * In accordance with Section 7(b) of the GNU General Public License version 3,
31 31 * these Appropriate Legal Notices must retain the display of the "Powered by
32   - * KnowledgeTree" logo and retain the original copyright notice. If the display of the
  32 + * KnowledgeTree" logo and retain the original copyright notice. If the display of the
33 33 * logo is not reasonably feasible for technical reasons, the Appropriate Legal Notices
34   - * must display the words "Powered by KnowledgeTree" and retain the original
  34 + * must display the words "Powered by KnowledgeTree" and retain the original
35 35 * copyright notice.
36 36 * Contributor( s): ______________________________________
37 37 */
... ... @@ -40,118 +40,26 @@ require_once(KT_LIB_DIR . &#39;/plugins/plugin.inc.php&#39;);
40 40 require_once(KT_LIB_DIR . '/plugins/pluginregistry.inc.php');
41 41  
42 42 class HouseKeeperPlugin extends KTPlugin
43   - {
44   - var $autoRegister = true;
45   - var $sNamespace = 'ktcore.housekeeper.plugin';
  43 +{
  44 + var $autoRegister = true;
  45 + var $sNamespace = 'ktcore.housekeeper.plugin';
46 46  
47   - var $folders = array();
  47 + var $folders = array();
48 48  
49   - function HouseKeeperPlugin($sFilename = null)
50   - {
51   - parent::KTPlugin($sFilename);
  49 + function HouseKeeperPlugin($sFilename = null)
  50 + {
  51 + parent::KTPlugin($sFilename);
52 52  
53 53 $this->sFriendlyName = _kt('Housekeeper');
54   -
55   - $config = KTConfig::getSingleton();
56   - $cacheDir = $config->get('cache/cacheDirectory');
57   - $cacheFile = $cacheDir . '/houseKeeper.folders';
58   -
59   - if (is_file($cacheFile))
60   - {
61   - $this->folders = unserialize(file_get_contents($cacheFile));
62   - return;
63   - }
64   -
65   - $tempDir = $config->get('urls/tmpDirectory');
66   - $logDir = $config->get('urls/logDirectory');
67   - $docsDir = $config->get('urls/documentRoot');
68   -
69   - $indexer = Indexer::get();
70   - $luceneDir = $indexer->getIndexDirectory();
71   -
72   - $systemDir = OS_UNIX?'/tmp':'c:/windows/temp';
73   -
74   - $this->folders = array(
75   - array(
76   - 'name'=>_kt('Smarty Cache'),
77   - 'folder'=>$tempDir,
78   - 'pattern'=>'^%%.*',
79   - 'canClean'=>true
80   - ),
81   - array(
82   - 'name'=>_kt('System Cache'),
83   - 'folder'=>$cacheDir,
84   - 'pattern'=>'',
85   - 'canClean'=>true
86   - ),
87   - array(
88   - 'name'=>_kt('System Logs'),
89   - 'folder'=>$logDir,
90   - 'pattern'=>'.+\.txt$',
91   - 'canClean'=>true
92   - ));
93   -
94   - $this->folders[] =
95   - array(
96   - 'name'=>_kt('System Temporary Folder'),
97   - 'folder'=>$systemDir,
98   - 'pattern'=>'(sess_.+)?(.+\.log$)?',
99   - 'canClean'=>true
100   - );
101   -
102   - if (is_dir($docsDir))
103   - {
104   - $this->folders[] =
105   - array(
106   - 'name'=>_kt('Documents'),
107   - 'folder'=>$docsDir,
108   - 'pattern'=>'',
109   - 'canClean'=>false
110   - );
111   - }
112   -
113   - if (is_dir($luceneDir))
114   - {
115   - $this->folders[] =
116   - array(
117   - 'name'=>_kt('Document Index'),
118   - 'folder'=>$luceneDir,
119   - 'pattern'=>'',
120   - 'canClean'=>false
121   - );
122   -
123   - // lets only cache this once it has been resolved!
124   - file_put_contents($cacheFile, serialize($this->folders));
125   - }
126   -
127   -
128   -
129   - }
130   -
131   - function getDirectories()
132   - {
133   - return $this->folders;
134   - }
135   -
136   - function getDirectory($folder)
137   - {
138   - foreach($this->folders as $dir)
139   - {
140   - if ($dir['folder'] == $folder)
141   - {
142   - return $dir;
143   - }
144   - }
145   - return null;
146 54 }
147 55  
148 56 function setup()
149 57 {
150   - $this->registerDashlet('DiskUsageDashlet', 'ktcore.diskusage.dashlet', 'DiskUsageDashlet.inc.php');
151   - $this->registerDashlet('FolderUsageDashlet', 'ktcore.folderusage.dashlet', 'FolderUsageDashlet.inc.php');
  58 + $this->registerDashlet('DiskUsageDashlet', 'ktcore.diskusage.dashlet', 'DiskUsageDashlet.inc.php');
  59 + $this->registerDashlet('FolderUsageDashlet', 'ktcore.folderusage.dashlet', 'FolderUsageDashlet.inc.php');
152 60  
153 61 $oTemplating =& KTTemplating::getSingleton();
154   - $oTemplating->addLocation('housekeeper', '/plugins/housekeeper/templates');
  62 + $oTemplating->addLocation('housekeeper', '/plugins/housekeeper/templates');
155 63 }
156 64  
157 65 }
... ...
plugins/housekeeper/bin/UpdateStats.php 0 → 100644
  1 +<?php
  2 +
  3 +/**
  4 + * $Id: $
  5 + *
  6 + * KnowledgeTree Community Edition
  7 + * Document Management Made Simple
  8 + * Copyright (C) 2008 KnowledgeTree Inc.
  9 + * Portions copyright The Jam Warehouse Software (Pty) Limited
  10 + *
  11 + * This program is free software; you can redistribute it and/or modify it under
  12 + * the terms of the GNU General Public License version 3 as published by the
  13 + * Free Software Foundation.
  14 + *
  15 + * This program is distributed in the hope that it will be useful, but WITHOUT
  16 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
  17 + * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
  18 + * details.
  19 + *
  20 + * You should have received a copy of the GNU General Public License
  21 + * along with this program. If not, see <http://www.gnu.org/licenses/>.
  22 + *
  23 + * You can contact KnowledgeTree Inc., PO Box 7775 #87847, San Francisco,
  24 + * California 94120-7775, or email info@knowledgetree.com.
  25 + *
  26 + * The interactive user interfaces in modified source and object code versions
  27 + * of this program must display Appropriate Legal Notices, as required under
  28 + * Section 5 of the GNU General Public License version 3.
  29 + *
  30 + * In accordance with Section 7(b) of the GNU General Public License version 3,
  31 + * these Appropriate Legal Notices must retain the display of the "Powered by
  32 + * KnowledgeTree" logo and retain the original copyright notice. If the display of the
  33 + * logo is not reasonably feasible for technical reasons, the Appropriate Legal Notices
  34 + * must display the words "Powered by KnowledgeTree" and retain the original
  35 + * copyright notice.
  36 + * Contributor( s): ______________________________________
  37 + *
  38 + */
  39 +
  40 +chdir(dirname(__FILE__));
  41 +require_once(realpath('../../../config/dmsDefaults.php'));
  42 +require_once('../HouseKeeper.inc.php');
  43 +
  44 +HouseKeeper::getDiskUsageStats();
  45 +HouseKeeper::getKTUsageStats();
  46 +
  47 +?>
0 48 \ No newline at end of file
... ...
plugins/housekeeper/templates/DiskUsage.smarty
... ... @@ -43,5 +43,5 @@
43 43 {if $red==1}
44 44 <td bgcolor=red><nobr> &lt; {$urgentPercent} %</td>
45 45 {/if}
46   -<td width="100%" align="right"><a href="{$dispatcherURL}?action=refreshDiskUsage">{i18n}refresh{/i18n}</a></td>
  46 +<td width="100%" align="right">&nbsp;</td>
47 47 </table>
48 48 \ No newline at end of file
... ...
plugins/housekeeper/templates/FolderUsage.smarty
... ... @@ -30,7 +30,3 @@ function cleanupFolder(path)
30 30 {/section}
31 31 <tr><td colspan=4><hr></tr>
32 32 </table>
33   -<table width="100%">
34   -<tr width="100%">
35   -<td align="right"><a href="{$dispatcherURL}?action=refreshFolderUsage">{i18n}refresh{/i18n}</a></td>
36   -</table>
... ...
sql/mysql/install/data.sql
... ... @@ -121,13 +121,114 @@ UNLOCK TABLES;
121 121  
122 122 LOCK TABLES `config_settings` WRITE;
123 123 /*!40000 ALTER TABLE `config_settings` DISABLE KEYS */;
124   -INSERT INTO `config_settings`(`id`,`group_name`,`item`,`type`,`value`,`helptext`,`default_value`,`can_edit`) VALUES (1,'ui','appName','','KnowledgeTree','OEM application name','KnowledgeTree',1),(2,'KnowledgeTree','schedulerInterval','','30','','30',1),(3,'dashboard','alwaysShowYCOD','boolean','default','Display the \"Your Checked-out Documents\" dashlet even when empty.','0',1),(4,'urls','graphicsUrl','','${rootUrl}/graphics','','${rootUrl}/graphics',1),(5,'urls','uiUrl','','${rootUrl}/presentation/lookAndFeel/knowledgeTree','','${rootUrl}/presentation/lookAndFeel/knowledgeTree',1),(6,'tweaks','browseToUnitFolder','boolean','default','Whether to browse to the user\'s (first) unit when first going to the browse section.','0',1),(7,'tweaks','genericMetaDataRequired','boolean','1','','1',1),(8,'tweaks','developmentWindowLog','boolean','0','','0',1),(9,'tweaks','noisyBulkOperations','boolean','default','Whether bulk operations should generate a transaction notice on each ; item, or only on the folder. Default of \"false\" indicates that only the folder transaction should occur.','0',1),(10,'email','emailServer','','none','','none',1),(11,'email','emailPort','','default','','',1),(12,'email','emailAuthentication','boolean','0','Do you need auth to connect to SMTP?\r\n','0',1),(13,'email','emailUsername','','username','','username',1),(14,'email','emailPassword','','password','','password',1),(15,'email','emailFrom','','kt@example.org','','kt@example.org',1),(16,'email','emailFromName','','KnowledgeTree Document Management System','','KnowledgeTree Document Management System',1),(17,'email','allowAttachment','boolean','default','Set to true to allow users to send attachments from the document\r\n management system\r\n.','0',1),(18,'email','allowEmailAddresses','boolean','default','Set to true to allow users to send to any email address, as opposed to\r\n only users of the system\r\n.','0',1),(19,'email','sendAsSystem','boolean','default','Set to true to always send email from the emailFrom address listed above, even if there is an identifiable sending user\r\n.','0',1),(20,'email','onlyOwnGroups','boolean','default','Set to true to only allow users to send emails to those in the same\r\n groups as them\r\n.','0',1),(21,'user_prefs','passwordLength','','6','Minimum password length on password-setting\r\n','6',1),(22,'user_prefs','restrictAdminPasswords','boolean','default','Apply the minimum password length to admin while creating / editing accounts?\r\n default is set to \"false\" meaning that admins can create users with shorter passwords.\r\n','0',1),
125   -(23,'user_prefs','restrictPreferences','boolean','0','Restrict users from accessing their preferences menus?\r\n','0',1),(24,'session','sessionTimeout','','1200','Session timeout (in seconds)\r\n','1200',1),(25,'session','allowAnonymousLogin','boolean','0','By default, do not auto-login users as anonymous.\r\n Set this to true if you UNDERSTAND the security system that KT\r\n uses, and have sensibly applied the roles \"Everyone\" and \"Authenticated Users\".\r\n','0',1),(26,'ui','companyLogo','','${rootUrl}/resources/companylogo.png','Add the logo of your company to the site\'s appearance. This logo MUST be 50px tall, and on a white background.\r\n','${rootUrl}/resources/companylogo.png',1),(27,'ui','companyLogoWidth','','313px','The logo\'s width in pixels\r\n','313px',1),(28,'ui','companyLogoTitle','','ACME Corporation','ALT text - for accessibility purposes.\r\n','ACME Corporation',1),(29,'ui','alwaysShowAll','boolean','0','Do not restrict to searches (e.g. always show_all) on users and groups pages.\r\n','0',1),(30,'ui','condensedAdminUI','boolean','0','Use a condensed admin ui\r\n?','0',1),(31,'ui','fakeMimetype','boolean','0','Allow \"open\" from downloads. Changing this to \"true\" will prevent (most)\r\n browsers from giving users the \"open\" option.\r\n','0',1),(32,'ui','metadata_sort','boolean','0','Sort the metadata fields alphabetically\r\n','1',1),(33,'i18n','useLike','boolean','default','If your language doesn\'t have distinguishable words (usually, doesn\'t\r\n have a space character), set useLike to true to use a search that can\r\n deal with this, but which is slower.\r\n','0',1),(34,'import','unzip','','unzip','Unzip command - will use execSearchPath to find if the path to the binary is not given\r\n.','unzip',1),(35,'export','zip','','zip','Zip command - will use execSearchPath to find if the path to the\r\n binary is not given\r\n.','zip',1),(36,'externalBinary','xls2csv','','xls2csv','','xls2csv',1),
126   -(37,'externalBinary','pdftotext','','pdftotext','','pdftotext',1),(38,'externalBinary','catppt','','catppt','','catppt',1),(39,'externalBinary','pstotext','','pstotext','','pstotext',1),(40,'externalBinary','catdoc','','catdoc','','catdoc',1),(41,'externalBinary','antiword','','antiword','','antiword',1),(42,'externalBinary','python','','python','','python',1),(43,'externalBinary','java','','java','','java',1),(44,'externalBinary','php','','php','','php',1),(45,'externalBinary','df','','df','','df',1),(46,'cache','proxyCacheDirectory','','${varDirectory}/proxies','','${varDirectory}/proxies',1),(47,'cache','proxyCacheEnabled','boolean','1','','1',1),(48,'KTWebDAVSettings','debug','','off','This section is for KTWebDAV only, _LOTS_ of debug info will be logged if the following is \"on\"\r\n','off',1),(49,'KTWebDAVSettings','safemode','','on','To allow write access to WebDAV clients set safe mode to \"off\".','on',1),(50,'BaobabSettings','debug','','off','This section is for Baobab only\r\n, _LOTS_ of debug info will be logged if the following is \"on\"\r\n.','off',1),(51,'BaobabSettings','safemode','','on','To allow write access to WebDAV clients set safe mode to \"off\" below\r\n.','on',1),(52,'search','searchBasePath','','${fileSystemRoot}/search2','','${fileSystemRoot}/search2',1),(53,'search','fieldsPath','','${searchBasePath}/search/fields','','${searchBasePath}/search/fields',1),(54,'search','resultsDisplayFormat','','searchengine','The format in which to display the results\r\n options are searchengine or browseview defaults to searchengine\r\n.','searchengine',1),(55,'search','resultsPerPage','','50','The number of results per page\r\n, defaults to 25\r\n','25',1),(56,'search','dateFormat','','Y-m-d','The date format used when making queries using widgets\r\n, defaults to Y-m-d\r\n','Y-m-d',1),(57,'browse','previewActivation','','default','The document info box / preview is activated by mousing over or clicking on the icon\r\n. Options: mouse-over (default) or onclick\r\n.','mouse-over',1),
127   -(58,'indexer','coreClass','','JavaXMLRPCLuceneIndexer','The core indexing class\r\n. Choices: JavaXMLRPCLuceneIndexer or PHPLuceneIndexer.','JavaXMLRPCLuceneIndexer',1),(59,'indexer','batchDocuments','','20','The number of documents to be indexed in a cron session, defaults to 20\r\n.','20',1),(60,'indexer','batchMigrateDocuments','','500','The number of documents to be migrated in a cron session, defaults to 500\r\n.','500',1),(61,'indexer','indexingBasePath','','${searchBasePath}/indexing','','${searchBasePath}/indexing',1),(62,'indexer','luceneDirectory','','${varDirectory}/indexes','The location of the lucene indexes\r\n.','${varDirectory}/indexes',1),(63,'indexer','extractorPath','','${indexingBasePath}/extractors','','${indexingBasePath}/extractors',1),(64,'indexer','extractorHookPath','','${indexingBasePath}/extractorHooks','','${indexingBasePath}/extractorHooks',1),(65,'indexer','javaLuceneURL','','http://127.0.0.1:8875','The url for the Java Lucene Server. This should match up the the Lucene Server configuration. Defaults to http://127.0.0.1:8875\r\n','http://127.0.0.1:8875',1),(66,'openoffice','host','','default','The host on which open office is installed\r\n. Defaults to 127.0.0.1\r\n','127.0.0.1',1),(67,'openoffice','port','','default','The port on which open office is listening. Defaults to 8100\r\n','8100',1),(68,'webservice','uploadDirectory','','${varDirectory}/uploads','Directory to which all uploads via webservices are persisted before moving into the repository\r\n.','${varDirectory}/uploads',1),
128   -(69,'webservice','downloadUrl','','${rootUrl}/ktwebservice/download.php','Url which is sent to clients via web service calls so they can then download file via HTTP GET\r\n.','${rootUrl}/ktwebservice/download.php',1),(70,'webservice','uploadExpiry','','30','Period indicating how long a file should be retained in the uploads directory.\r\n','30',1),(71,'webservice','downloadExpiry','','30','Period indicating how long a download link will be available.','30',1),(72,'webservice','randomKeyText','','bkdfjhg23yskjdhf2iu','Random text used to construct a hash. This can be customised on installations so there is less chance of overlap between installations.\r\n','bkdfjhg23yskjdhf2iu',1),(73,'webservice','validateSessionCount','boolean','0','Validating session counts can interfere with access. It is best to leave this disabled, unless very strict access is required.\r\n','0',1),(74,'webservice','useDefaultDocumentTypeIfInvalid','boolean','1','If the document type is invalid when adding a document, we can be tollerant and just default to the Default document type.\r\n','1',1),(75,'webservice','debug','boolean','0','The web service debugging if the logLevel is set to DEBUG. We can set the value to 4 or 5 to get more verbose web service logging.\r\n Level 4 logs the name of functions being accessed. Level 5 logs the SOAP XML requests and responses.\r\n','0',1),(76,'clientToolPolicies','explorerMetadataCapture','boolean','1','This setting is one of two which control whether or not the client is prompted for metadata when a\r\n document is added to knowledgetree via KTtools. It defaults to true.\r\n','1',1),(77,'clientToolPolicies','officeMetadataCapture','boolean','1','This setting is one of two which control whether or not the client is prompted for metadata when a document is added to knowledgetree via KTtools. It defaults to true.','1',1),
129   -(78,'clientToolPolicies','captureReasonsDelete','boolean','1','This setting is one of six which govern whether reasons are asked for in KTtools\r\n.','1',1),(79,'clientToolPolicies','captureReasonsCheckin','boolean','1','This setting is one of six which govern whether reasons are asked for in KTtools\r\n.','1',1),(80,'clientToolPolicies','captureReasonsCheckout','boolean','1','This setting is one of six which govern whether reasons are asked for in KTtools\r\n.','1',1),(81,'clientToolPolicies','captureReasonsCancelCheckout','boolean','1','This setting is one of six which govern whether reasons are asked for in KTtools\r\n.','1',1),(82,'clientToolPolicies','captureReasonsCopyInKT','boolean','1','This setting is one of six which govern whether reasons are asked for in KTtools\r\n.','1',1),(83,'clientToolPolicies','captureReasonsMoveInKT','boolean','1','This setting is one of six which govern whether reasons are asked for in KTtools\r\n.','1',1),
130   -(84,'clientToolPolicies','allowRememberPassword','boolean','1','This setting governs whether the password can be stored on the client or not.','1',1),(85,'DiskUsage','warningThreshold','','10','When free space in a mount point is less than this percentage, the disk usage dashlet will highlight the mount in ORANGE\r\n.','10',1),(86,'DiskUsage','urgentThreshold','','5','When free space in a mount point is less than this percentage, the disk usage dashlet will highlight the mount in RED\r\n.','5',1),(87,'KnowledgeTree','useNewDashboard','','default','','1',1),(88,'i18n','defaultLanguage','','en','Default language for the interface\r\n.','en',1),(89,'CustomErrorMessages','customerrormessages','','off','Turn custom error messages on or off here','on',1),(90,'CustomErrorMessages','customerrorpagepath','','customerrorpage.php','Name or url of custom error page\r\n.','customerrorpage.php',1),(91,'CustomErrorMessages','customerrorhandler','','off','Turn custom error handler on or off','on',1),(92,'ui','morphEnabled','boolean','0','Enable Morph','0',1),(93,'ui','morphTo','','blue','Morph Theme\r\n','blue',1),(94,'KnowledgeTree','logLevel','','default','Choice: INFO or DEBUG','INFO',1),(95,'storage','manager','','default','','KTOnDiskHashedStorageManager',1),(96,'ui','ieGIF','boolean','0','','1',1),(97,'ui','automaticRefresh','boolean','0','','0',1),(98,'ui','dot','','dot','','dot',1),(99,'tweaks','phpErrorLogFile','boolean','default','If you want to enable PHP error logging to the log/php_error_log file, change this setting to true\r\n.','0',1),(100,'urls','logDirectory','','default','','${varDirectory}/log',1),(101,'urls','uiDirectory','','default','','${fileSystemRoot}/presentation/lookAndFeel/knowledgeTree',1),(102,'urls','tmpDirectory','','default','','${varDirectory}/tmp',1),(103,'urls','stopwordsFile','','default','','${fileSystemRoot}/config/stopwords.txt',1),(104,'cache','cacheEnabled','boolean','default','','0',1),(105,'cache','cacheDirectory','','default','','${varDirectory}/cache',1),(106,'cache','cachePlugins','boolean','default','','1',1),(107,'urls','varDirectory','','default','','${fileSystemRoot}/var',1);
  124 +INSERT INTO `config_settings`(`id`,`group_name`,`item`,`type`,`value`,`helptext`,`default_value`,`can_edit`) VALUES
  125 +(1,'ui','appName','','KnowledgeTree','OEM application name','KnowledgeTree',1),
  126 +(2,'KnowledgeTree','schedulerInterval','','30','','30',1),
  127 +(3,'dashboard','alwaysShowYCOD','boolean','default','Display the \"Your Checked-out Documents\" dashlet even when empty.','0',1),
  128 +(4,'urls','graphicsUrl','','${rootUrl}/graphics','','${rootUrl}/graphics',1),
  129 +(5,'urls','uiUrl','','${rootUrl}/presentation/lookAndFeel/knowledgeTree','','${rootUrl}/presentation/lookAndFeel/knowledgeTree',1),
  130 +(6,'tweaks','browseToUnitFolder','boolean','default','Whether to browse to the user\'s (first) unit when first going to the browse section.','0',1),
  131 +(7,'tweaks','genericMetaDataRequired','boolean','1','','1',1),
  132 +(8,'tweaks','developmentWindowLog','boolean','0','','0',1),
  133 +(9,'tweaks','noisyBulkOperations','boolean','default','Whether bulk operations should generate a transaction notice on each ; item, or only on the folder. Default of \"false\" indicates that only the folder transaction should occur.','0',1),
  134 +(10,'email','emailServer','','none','','none',1),
  135 +(11,'email','emailPort','','default','','',1),
  136 +(12,'email','emailAuthentication','boolean','0','Do you need auth to connect to SMTP?\r\n','0',1),
  137 +(13,'email','emailUsername','','username','','username',1),
  138 +(14,'email','emailPassword','','password','','password',1),
  139 +(15,'email','emailFrom','','kt@example.org','','kt@example.org',1),
  140 +(16,'email','emailFromName','','KnowledgeTree Document Management System','','KnowledgeTree Document Management System',1),
  141 +(17,'email','allowAttachment','boolean','default','Set to true to allow users to send attachments from the document\r\n management system\r\n.','0',1),
  142 +(18,'email','allowEmailAddresses','boolean','default','Set to true to allow users to send to any email address, as opposed to\r\n only users of the system\r\n.','0',1),(19,'email','sendAsSystem','boolean','default','Set to true to always send email from the emailFrom address listed above, even if there is an identifiable sending user\r\n.','0',1),
  143 +(20,'email','onlyOwnGroups','boolean','default','Set to true to only allow users to send emails to those in the same\r\n groups as them\r\n.','0',1),
  144 +(21,'user_prefs','passwordLength','','6','Minimum password length on password-setting\r\n','6',1),
  145 +(22,'user_prefs','restrictAdminPasswords','boolean','default','Apply the minimum password length to admin while creating / editing accounts?\r\n default is set to \"false\" meaning that admins can create users with shorter passwords.\r\n','0',1),
  146 +(23,'user_prefs','restrictPreferences','boolean','0','Restrict users from accessing their preferences menus?\r\n','0',1),
  147 +(24,'session','sessionTimeout','','1200','Session timeout (in seconds)\r\n','1200',1),
  148 +(25,'session','allowAnonymousLogin','boolean','0','By default, do not auto-login users as anonymous.\r\n Set this to true if you UNDERSTAND the security system that KT\r\n uses, and have sensibly applied the roles \"Everyone\" and \"Authenticated Users\".\r\n','0',1),
  149 +(26,'ui','companyLogo','','${rootUrl}/resources/companylogo.png','Add the logo of your company to the site\'s appearance. This logo MUST be 50px tall, and on a white background.\r\n','${rootUrl}/resources/companylogo.png',1),
  150 +(27,'ui','companyLogoWidth','','313px','The logo\'s width in pixels\r\n','313px',1),
  151 +(28,'ui','companyLogoTitle','','ACME Corporation','ALT text - for accessibility purposes.\r\n','ACME Corporation',1),
  152 +(29,'ui','alwaysShowAll','boolean','0','Do not restrict to searches (e.g. always show_all) on users and groups pages.\r\n','0',1),
  153 +(30,'ui','condensedAdminUI','boolean','0','Use a condensed admin ui\r\n?','0',1),
  154 +(31,'ui','fakeMimetype','boolean','0','Allow \"open\" from downloads. Changing this to \"true\" will prevent (most)\r\n browsers from giving users the \"open\" option.\r\n','0',1),
  155 +(32,'ui','metadata_sort','boolean','0','Sort the metadata fields alphabetically\r\n','1',1),
  156 +(33,'i18n','useLike','boolean','default','If your language doesn\'t have distinguishable words (usually, doesn\'t\r\n have a space character), set useLike to true to use a search that can\r\n deal with this, but which is slower.\r\n','0',1),
  157 +(34,'import','unzip','','unzip','Unzip command - will use execSearchPath to find if the path to the binary is not given\r\n.','unzip',1),
  158 +(35,'export','zip','','zip','Zip command - will use execSearchPath to find if the path to the\r\n binary is not given\r\n.','zip',1),
  159 +(36,'externalBinary','xls2csv','','xls2csv','','xls2csv',1),
  160 +(37,'externalBinary','pdftotext','','pdftotext','','pdftotext',1),
  161 +(38,'externalBinary','catppt','','catppt','','catppt',1),
  162 +(39,'externalBinary','pstotext','','pstotext','','pstotext',1),
  163 +(40,'externalBinary','catdoc','','catdoc','','catdoc',1),
  164 +(41,'externalBinary','antiword','','antiword','','antiword',1),
  165 +(42,'externalBinary','python','','python','','python',1),
  166 +(43,'externalBinary','java','','java','','java',1),
  167 +(44,'externalBinary','php','','php','','php',1),
  168 +(45,'externalBinary','df','','df','','df',1),
  169 +(46,'cache','proxyCacheDirectory','','${varDirectory}/proxies','','${varDirectory}/proxies',1),
  170 +(47,'cache','proxyCacheEnabled','boolean','1','','1',1),
  171 +(48,'KTWebDAVSettings','debug','','off','This section is for KTWebDAV only, _LOTS_ of debug info will be logged if the following is \"on\"\r\n','off',1),
  172 +(49,'KTWebDAVSettings','safemode','','on','To allow write access to WebDAV clients set safe mode to \"off\".','on',1),
  173 +(50,'BaobabSettings','debug','','off','This section is for Baobab only\r\n, _LOTS_ of debug info will be logged if the following is \"on\"\r\n.','off',1),
  174 +(51,'BaobabSettings','safemode','','on','To allow write access to WebDAV clients set safe mode to \"off\" below\r\n.','on',1),
  175 +(52,'search','searchBasePath','','${fileSystemRoot}/search2','','${fileSystemRoot}/search2',1),
  176 +(53,'search','fieldsPath','','${searchBasePath}/search/fields','','${searchBasePath}/search/fields',1),
  177 +(54,'search','resultsDisplayFormat','','searchengine','The format in which to display the results\r\n options are searchengine or browseview defaults to searchengine\r\n.','searchengine',1),
  178 +(55,'search','resultsPerPage','','50','The number of results per page\r\n, defaults to 25\r\n','25',1),
  179 +(56,'search','dateFormat','','Y-m-d','The date format used when making queries using widgets\r\n, defaults to Y-m-d\r\n','Y-m-d',1),
  180 +(57,'browse','previewActivation','','default','The document info box / preview is activated by mousing over or clicking on the icon\r\n. Options: mouse-over (default) or onclick\r\n.','mouse-over',1),
  181 +(58,'indexer','coreClass','','JavaXMLRPCLuceneIndexer','The core indexing class\r\n. Choices: JavaXMLRPCLuceneIndexer or PHPLuceneIndexer.','JavaXMLRPCLuceneIndexer',1),
  182 +(59,'indexer','batchDocuments','','20','The number of documents to be indexed in a cron session, defaults to 20\r\n.','20',1),
  183 +(60,'indexer','batchMigrateDocuments','','500','The number of documents to be migrated in a cron session, defaults to 500\r\n.','500',1),
  184 +(61,'indexer','indexingBasePath','','${searchBasePath}/indexing','','${searchBasePath}/indexing',1),
  185 +(62,'indexer','luceneDirectory','','${varDirectory}/indexes','The location of the lucene indexes\r\n.','${varDirectory}/indexes',1),
  186 +(63,'indexer','extractorPath','','${indexingBasePath}/extractors','','${indexingBasePath}/extractors',1),
  187 +(64,'indexer','extractorHookPath','','${indexingBasePath}/extractorHooks','','${indexingBasePath}/extractorHooks',1),
  188 +(65,'indexer','javaLuceneURL','','http://127.0.0.1:8875','The url for the Java Lucene Server. This should match up the the Lucene Server configuration. Defaults to http://127.0.0.1:8875\r\n','http://127.0.0.1:8875',1),
  189 +(66,'openoffice','host','','default','The host on which open office is installed\r\n. Defaults to 127.0.0.1\r\n','127.0.0.1',1),
  190 +(67,'openoffice','port','','default','The port on which open office is listening. Defaults to 8100\r\n','8100',1),
  191 +(68,'webservice','uploadDirectory','','${varDirectory}/uploads','Directory to which all uploads via webservices are persisted before moving into the repository\r\n.','${varDirectory}/uploads',1),
  192 +(69,'webservice','downloadUrl','','${rootUrl}/ktwebservice/download.php','Url which is sent to clients via web service calls so they can then download file via HTTP GET\r\n.','${rootUrl}/ktwebservice/download.php',1),
  193 +(70,'webservice','uploadExpiry','','30','Period indicating how long a file should be retained in the uploads directory.\r\n','30',1),
  194 +(71,'webservice','downloadExpiry','','30','Period indicating how long a download link will be available.','30',1),
  195 +(72,'webservice','randomKeyText','','bkdfjhg23yskjdhf2iu','Random text used to construct a hash. This can be customised on installations so there is less chance of overlap between installations.\r\n','bkdfjhg23yskjdhf2iu',1),
  196 +(73,'webservice','validateSessionCount','boolean','0','Validating session counts can interfere with access. It is best to leave this disabled, unless very strict access is required.\r\n','0',1),
  197 +(74,'webservice','useDefaultDocumentTypeIfInvalid','boolean','1','If the document type is invalid when adding a document, we can be tollerant and just default to the Default document type.\r\n','1',1),
  198 +(75,'webservice','debug','boolean','0','The web service debugging if the logLevel is set to DEBUG. We can set the value to 4 or 5 to get more verbose web service logging.\r\n Level 4 logs the name of functions being accessed. Level 5 logs the SOAP XML requests and responses.\r\n','0',1),
  199 +(76,'clientToolPolicies','explorerMetadataCapture','boolean','1','This setting is one of two which control whether or not the client is prompted for metadata when a\r\n document is added to knowledgetree via KTtools. It defaults to true.\r\n','1',1),
  200 +(77,'clientToolPolicies','officeMetadataCapture','boolean','1','This setting is one of two which control whether or not the client is prompted for metadata when a document is added to knowledgetree via KTtools. It defaults to true.','1',1),
  201 +(78,'clientToolPolicies','captureReasonsDelete','boolean','1','This setting is one of six which govern whether reasons are asked for in KTtools\r\n.','1',1),
  202 +(79,'clientToolPolicies','captureReasonsCheckin','boolean','1','This setting is one of six which govern whether reasons are asked for in KTtools\r\n.','1',1),
  203 +(80,'clientToolPolicies','captureReasonsCheckout','boolean','1','This setting is one of six which govern whether reasons are asked for in KTtools\r\n.','1',1),
  204 +(81,'clientToolPolicies','captureReasonsCancelCheckout','boolean','1','This setting is one of six which govern whether reasons are asked for in KTtools\r\n.','1',1),
  205 +(82,'clientToolPolicies','captureReasonsCopyInKT','boolean','1','This setting is one of six which govern whether reasons are asked for in KTtools\r\n.','1',1),
  206 +(83,'clientToolPolicies','captureReasonsMoveInKT','boolean','1','This setting is one of six which govern whether reasons are asked for in KTtools\r\n.','1',1),
  207 +(84,'clientToolPolicies','allowRememberPassword','boolean','1','This setting governs whether the password can be stored on the client or not.','1',1),
  208 +(85,'DiskUsage','warningThreshold','','10','When free space in a mount point is less than this percentage, the disk usage dashlet will highlight the mount in ORANGE\r\n.','10',1),
  209 +(86,'DiskUsage','urgentThreshold','','5','When free space in a mount point is less than this percentage, the disk usage dashlet will highlight the mount in RED\r\n.','5',1),
  210 +(87,'KnowledgeTree','useNewDashboard','','default','','1',1),
  211 +(88,'i18n','defaultLanguage','','en','Default language for the interface\r\n.','en',1),
  212 +(89,'CustomErrorMessages','customerrormessages','','off','Turn custom error messages on or off here','on',1),
  213 +(90,'CustomErrorMessages','customerrorpagepath','','customerrorpage.php','Name or url of custom error page\r\n.','customerrorpage.php',1),
  214 +(91,'CustomErrorMessages','customerrorhandler','','off','Turn custom error handler on or off','on',1),
  215 +(92,'ui','morphEnabled','boolean','0','Enable Morph','0',1),
  216 +(93,'ui','morphTo','','blue','Morph Theme\r\n','blue',1),
  217 +(94,'KnowledgeTree','logLevel','','default','Choice: INFO or DEBUG','INFO',1),
  218 +(95,'storage','manager','','default','','KTOnDiskHashedStorageManager',1),
  219 +(96,'ui','ieGIF','boolean','0','','1',1),
  220 +(97,'ui','automaticRefresh','boolean','0','','0',1),
  221 +(98,'ui','dot','','dot','','dot',1),
  222 +(99,'tweaks','phpErrorLogFile','boolean','default','If you want to enable PHP error logging to the log/php_error_log file, change this setting to true\r\n.','0',1),
  223 +(100,'urls','logDirectory','','default','','${varDirectory}/log',1),
  224 +(101,'urls','uiDirectory','','default','','${fileSystemRoot}/presentation/lookAndFeel/knowledgeTree',1),
  225 +(102,'urls','tmpDirectory','','default','','${varDirectory}/tmp',1),
  226 +(103,'urls','stopwordsFile','','default','','${fileSystemRoot}/config/stopwords.txt',1),
  227 +(104,'cache','cacheEnabled','boolean','default','','0',1),
  228 +(105,'cache','cacheDirectory','','default','','${varDirectory}/cache',1),
  229 +(106,'cache','cachePlugins','boolean','default','','1',1),
  230 +(107,'urls','varDirectory','','default','','${fileSystemRoot}/var',1),
  231 +(108,'urls','documentRoot','','default','','${varDirectory}/Documents',0);
131 232 /*!40000 ALTER TABLE `config_settings` ENABLE KEYS */;
132 233 UNLOCK TABLES;
133 234  
... ... @@ -830,8 +931,8 @@ INSERT INTO `scheduler_tasks` VALUES
830 931 (4,'Periodic Document Expunge','bin/expungeall.php','',0,'weekly','2007-10-01',NULL,0,'disabled'),
831 932 (5,'Database Maintenance','bin/dbmaint.php','optimize',0,'monthly','2007-10-01',NULL,0,'disabled'),
832 933 (6,'Open Office test','bin/checkopenoffice.php','',0,'1min','2007-10-01',NULL,0,'enabled'),
833   -(7,'Cleanup Temporary Directory','search2/bin/cronCleanup.php','',0,'1min','2007-10-01',NULL,0,'enabled');
834   -
  934 +(7,'Cleanup Temporary Directory','search2/bin/cronCleanup.php','',0,'1min','2007-10-01',NULL,0,'enabled'),
  935 +(8,'Disk Usage and Folder Utilisation Statistics','plugins/housekeeper/bin/UpdateStats.php','',0,'5mins','2007-10-01',NULL,0,'enabled');
835 936 /*!40000 ALTER TABLE `scheduler_tasks` ENABLE KEYS */;
836 937 UNLOCK TABLES;
837 938  
... ...
sql/mysql/upgrade/3.5.2/zdashboard_tasks.sql 0 → 100644
  1 +select @id:=max(id)+1 from scheduler_tasks;
  2 +INSERT INTO `scheduler_tasks` VALUES (@id,'Disk Usage and Folder Utilisation Statistics','plugins/housekeeper/bin/UpdateStats.php','',0,'5mins','2007-10-01',NULL,0,'enabled');
  3 +
  4 +UPDATE zseq_scheduler_tasks set id=@id;
0 5 \ No newline at end of file
... ...