diff --git a/plugins/housekeeper/DiskUsageDashlet.inc.php b/plugins/housekeeper/DiskUsageDashlet.inc.php index 32f7e56..ba0c402 100755 --- a/plugins/housekeeper/DiskUsageDashlet.inc.php +++ b/plugins/housekeeper/DiskUsageDashlet.inc.php @@ -38,165 +38,54 @@ class DiskUsageDashlet extends KTBaseDashlet { - private $dfCmd; - private $usage; - private $warningPercent; - private $urgentPercent; + private $usage; - function DiskUsageDashlet() - { - $this->sTitle = _kt('Storage Utilization'); - $this->sClass = "ktInfo"; - } - - function is_active($oUser) - { - $dfCmd = KTUtil::findCommand('externalBinary/df','df'); - if ($dfCmd === false) - { - return false; - } - $this->dfCmd = $dfCmd; - - $config = KTConfig::getSingleton(); - $this->warningPercent = $config->get('DiskUsage/warningThreshold', 15); - $this->urgentPercent = $config->get('DiskUsage/urgentThreshold', 5); - - $got_usage = $this->getUsage(); - - if ($got_usage == false) - { - return false; - } - - return Permission::userIsSystemAdministrator(); - } - - function getUsage($refresh=false) - { - if (isset($_SESSION['DiskUsage']['problem'])) - { - return false; - } - - $check = true; - // check if we have a cached result - if (isset($_SESSION['DiskUsage'])) - { - // we will only do the check every 5 minutes - if (time() - $_SESSION['DiskUsage']['time'] < 5 * 60) - { - $check = false; - $this->usage = $_SESSION['DiskUsage']['usage']; - } - } - - // we will only check if the result is not cached, or after 5 minutes - if ($check) - { - $cmd = $this->dfCmd; - - if (OS_WINDOWS) - { - $cmd = str_replace( '/','\\',$cmd); - $res = KTUtil::pexec("\"$cmd\" -B 1 2>&1"); - $result = implode("\r\n",$res['out']); - } - else - { - if(strtolower(PHP_OS) == 'darwin'){ - $result = shell_exec($cmd." -k 2>&1"); - }else{ - $result = shell_exec($cmd." -B 1 2>&1"); - } - } - - if (strpos($result, 'cannot read table of mounted file systems') !== false) - { - $_SESSION['DiskUsage']['problem'] = true; - return false; - } - - - $result = explode("\n", $result); - - unset($result[0]); // gets rid of headings - - $usage=array(); - foreach($result as $line) - { - if (empty($line)) continue; - preg_match('/(.*)\s+(\d+)\s+(\d+)\s+(\d+)\s+(\d+)\%\s+(.*)/', $line, $matches); - list($line, $filesystem, $size, $used, $avail, $usedp, $mount) = $matches; - - if ($size === 0) continue; - - if(strtolower(PHP_OS) == 'darwin'){ - $size = $size * 1024; - $used = $used * 1024; - $avail = $avail * 1024; - } - - $colour = ''; - if ($usedp >= 100 - $this->urgentPercent) - { - $colour = 'red'; - } - elseif ($usedp >= 100 - $this->warningPercent) - { - $colour = 'orange'; - } - - $usage[] = array( - 'filesystem'=>$filesystem, - 'size'=>KTUtil::filesizeToString($size), - 'used'=>KTUtil::filesizeToString($used), - 'available'=>KTUtil::filesizeToString($avail), - 'usage'=>$usedp . '%', - 'mounted'=>$mount, - 'colour'=>$colour - ); - } - - $this->usage = $usage; - - $_SESSION['DiskUsage']['time'] = time(); - $_SESSION['DiskUsage']['usage'] = $this->usage; - } + function DiskUsageDashlet() + { + $this->sTitle = _kt('Storage Utilization'); + $this->sClass = "ktInfo"; + } - return true; - } + function is_active($oUser) + { + $usage = unserialize(KTUtil::getSystemSetting('DiskUsage','n/a')); + if ($usage == 'n/a') return false; + $this->usage = $usage; + return Permission::userIsSystemAdministrator(); + } - function render() - { - $oTemplating =& KTTemplating::getSingleton(); - $oTemplate = $oTemplating->loadTemplate('DiskUsage'); + function render() + { + $oTemplating =& KTTemplating::getSingleton(); + $oTemplate = $oTemplating->loadTemplate('DiskUsage'); - $oRegistry =& KTPluginRegistry::getSingleton(); - $oPlugin =& $oRegistry->getPlugin('ktcore.housekeeper.plugin'); + $oRegistry =& KTPluginRegistry::getSingleton(); + $oPlugin =& $oRegistry->getPlugin('ktcore.housekeeper.plugin'); - $config = KTConfig::getSingleton(); - $rootUrl = $config->get('KnowledgeTree/rootUrl'); + $config = KTConfig::getSingleton(); + $rootUrl = $config->get('KnowledgeTree/rootUrl'); - $dispatcherURL = $oPlugin->getURLPath('HouseKeeperDispatcher.php'); - if (!empty($rootUrl)) $dispatcherURL = $rootUrl . $dispatcherURL; - $dispatcherURL = str_replace( '\\', '/', $dispatcherURL); + $dispatcherURL = $oPlugin->getURLPath('HouseKeeperDispatcher.php'); + if (!empty($rootUrl)) $dispatcherURL = $rootUrl . $dispatcherURL; + $dispatcherURL = str_replace( '\\', '/', $dispatcherURL); if ( substr( $dispatcherURL, 0,1 ) != '/') - { - $dispatcherURL = '/'.$dispatcherURL; - } + { + $dispatcherURL = '/'.$dispatcherURL; + } + + $warningPercent = $config->get('DiskUsage/warningThreshold', 15); + $urgentPercent = $config->get('DiskUsage/urgentThreshold', 5); - $aTemplateData = array( - 'context' => $this, - 'usages'=>$this->usage, - 'warnPercent'=>$this->warningPercent, - 'urgentPercent'=>$this->urgentPercent, - 'dispatcherURL'=>$dispatcherURL - ); + $aTemplateData = array( + 'context' => $this, + 'usages'=> $this->usage, + 'warnPercent'=>$warningPercent, + 'urgentPercent'=>$urgentPercent, + 'dispatcherURL'=>$dispatcherURL + ); return $oTemplate->render($aTemplateData); } } - ?> diff --git a/plugins/housekeeper/FolderUsageDashlet.inc.php b/plugins/housekeeper/FolderUsageDashlet.inc.php index a8cfd6a..c3c4b7a 100755 --- a/plugins/housekeeper/FolderUsageDashlet.inc.php +++ b/plugins/housekeeper/FolderUsageDashlet.inc.php @@ -38,141 +38,48 @@ class FolderUsageDashlet extends KTBaseDashlet { - private $usage; + private $usage; - function FolderUsageDashlet() - { - $this->sTitle = _kt('System Folder Utilization'); - $this->sClass = "ktInfo"; - } + function FolderUsageDashlet() + { + $this->sTitle = _kt('System Folder Utilization'); + $this->sClass = "ktInfo"; + } - function is_active($oUser) - { - return Permission::userIsSystemAdministrator(); - } + function is_active($oUser) + { + return Permission::userIsSystemAdministrator(); + } - function scanPath($path,$pattern) - { - $files=0; - $filesize=0; + function render() + { + $oTemplating =& KTTemplating::getSingleton(); + $oTemplate = $oTemplating->loadTemplate('FolderUsage'); - if (is_dir($path) && ($dh = opendir($path))) - { - while (($file = readdir($dh)) !== false) - { - if (substr($file,0,1) == '.') - { - continue; - } + $oRegistry =& KTPluginRegistry::getSingleton(); + $oPlugin =& $oRegistry->getPlugin('ktcore.housekeeper.plugin'); - $full = $path . '/' . $file; + $config = KTConfig::getSingleton(); + $rootUrl = $config->get('KnowledgeTree/rootUrl'); - if (!is_readable($full) || !is_writable($full)) - { - continue; - } - - if (is_dir($full)) - { - $result = $this->scanPath($full,$pattern); - $files += $result['files']; - $filesize += $result['filesize']; - continue; - } - if ($pattern != '') - { - if (preg_match('/' . $pattern . '/', $file) === false) - { - continue; - } - } - - $files++; - $filesize += filesize($full); - } - closedir($dh); - } - return array('files'=>$files,'filesize'=>$filesize,'dir'=>$path); - } - - function getUsage() - { - $check = true; - // check if we have a cached result - if (isset($_SESSION['SystemFolderUsage'])) - { - // we will only do the check every 5 minutes - if (time() - $_SESSION['SystemFolderUsage']['time'] < 5 * 60) - { - $check = false; - $this->usage = $_SESSION['SystemFolderUsage']['usage']; - } - } - - // we will only check if the result is not cached, or after 5 minutes - if ($check) - { - $usage = array(); - - $oRegistry =& KTPluginRegistry::getSingleton(); - $oPlugin =& $oRegistry->getPlugin('ktcore.housekeeper.plugin'); - - $folders = $oPlugin->getDirectories(); - - foreach($folders as $folder) - { - $directory = $folder['folder']; - $pattern = $folder['pattern']; - $canClean = $folder['canClean']; - $name = $folder['name']; - - $temp = $this->scanPath($directory,$pattern); - - $usage[] = array( - 'description'=>$name, - 'folder'=>$directory, - 'files'=>number_format($temp['files'],0,'.',','), - 'filesize'=>KTUtil::filesizeToString($temp['filesize']), - 'action'=>$i, - 'canClean'=>$canClean - ); - $this->usage = $usage; - } - - $_SESSION['SystemFolderUsage']['time'] = time(); - $_SESSION['SystemFolderUsage']['usage'] = $this->usage; - } - } - - function render() - { - $oTemplating =& KTTemplating::getSingleton(); - $oTemplate = $oTemplating->loadTemplate('FolderUsage'); - - $oRegistry =& KTPluginRegistry::getSingleton(); - $oPlugin =& $oRegistry->getPlugin('ktcore.housekeeper.plugin'); - - $config = KTConfig::getSingleton(); - $rootUrl = $config->get('KnowledgeTree/rootUrl'); - - $dispatcherURL = $oPlugin->getURLPath('HouseKeeperDispatcher.php'); - if (!empty($rootUrl)) $dispatcherURL = $rootUrl . $dispatcherURL; + $dispatcherURL = $oPlugin->getURLPath('HouseKeeperDispatcher.php'); + if (!empty($rootUrl)) $dispatcherURL = $rootUrl . $dispatcherURL; $dispatcherURL = str_replace( '\\', '/', $dispatcherURL); if ( substr( $dispatcherURL, 0,1 ) != '/') - { - $dispatcherURL = '/'.$dispatcherURL; - } + { + $dispatcherURL = '/'.$dispatcherURL; + } - $this->getUsage(); + $usage = unserialize(KTUtil::getSystemSetting('KTUsage','n/a')); - $aTemplateData = array( - 'context' => $this, - 'usages'=>$this->usage, - 'dispatcherURL'=>$dispatcherURL - ); + $aTemplateData = array( + 'context' => $this, + 'usages'=>$usage, + 'dispatcherURL'=>$dispatcherURL + ); - return $oTemplate->render($aTemplateData); - } + return $oTemplate->render($aTemplateData); + } } diff --git a/plugins/housekeeper/HouseKeeper.inc.php b/plugins/housekeeper/HouseKeeper.inc.php new file mode 100644 index 0000000..4ed8830 --- /dev/null +++ b/plugins/housekeeper/HouseKeeper.inc.php @@ -0,0 +1,350 @@ +. + * + * You can contact KnowledgeTree Inc., PO Box 7775 #87847, San Francisco, + * California 94120-7775, or email info@knowledgetree.com. + * + * The interactive user interfaces in modified source and object code versions + * of this program must display Appropriate Legal Notices, as required under + * Section 5 of the GNU General Public License version 3. + * + * In accordance with Section 7(b) of the GNU General Public License version 3, + * these Appropriate Legal Notices must retain the display of the "Powered by + * KnowledgeTree" logo and retain the original copyright notice. If the display of the + * logo is not reasonably feasible for technical reasons, the Appropriate Legal Notices + * must display the words "Powered by KnowledgeTree" and retain the original + * copyright notice. + * Contributor( s): ______________________________________ + * + */ + +class HouseKeeper +{ + public static + function getDiskUsageStats($update = true) + { + $config = KTConfig::getSingleton(); + + $cmd = KTUtil::findCommand('externalBinary/df','df'); + if ($cmd === false) + { + if ($update) + KTUtil::setSystemSetting('DiskUsage','n/a'); + return false; + } + + + $warningPercent = $config->get('DiskUsage/warningThreshold', 15); + $urgentPercent = $config->get('DiskUsage/urgentThreshold', 5); + + if (OS_WINDOWS) + { + $cmd = str_replace( '/','\\',$cmd); + $res = KTUtil::pexec("\"$cmd\" -B 1 2>&1"); + $result = implode("\r\n",$res['out']); + } + else + { + if(strtolower(PHP_OS) == 'darwin'){ + $result = shell_exec($cmd." -k 2>&1"); + }else{ + $result = shell_exec($cmd." -B 1 2>&1"); + } + } + + if (strpos($result, 'cannot read table of mounted file systems') !== false) + { + if ($update) + KTUtil::setSystemSetting('DiskUsage','n/a'); + return false; + } + + $result = explode("\n", $result); + + unset($result[0]); // gets rid of headings + + $usage=array(); + foreach($result as $line) + { + if (empty($line)) continue; + preg_match('/(.*)\s+(\d+)\s+(\d+)\s+(\d+)\s+(\d+)\%\s+(.*)/', $line, $matches); + list($line, $filesystem, $size, $used, $avail, $usedp, $mount) = $matches; + + if ($size === 0) continue; + + if(strtolower(PHP_OS) == 'darwin'){ + $size = $size * 1024; + $used = $used * 1024; + $avail = $avail * 1024; + } + + $colour = ''; + if ($usedp >= 100 - $urgentPercent) + { + $colour = 'red'; + } + elseif ($usedp >= 100 - $warningPercent) + { + $colour = 'orange'; + } + + $usage[] = array( + 'filesystem'=>trim($filesystem), + 'size'=>KTUtil::filesizeToString($size), + 'used'=>KTUtil::filesizeToString($used), + 'available'=>KTUtil::filesizeToString($avail), + 'usage'=>$usedp . '%', + 'mounted'=>trim($mount), + 'colour'=>$colour + ); + } + + if ($update) + KTUtil::setSystemSetting('DiskUsage',serialize($usage)); + + return $usage; + } + + private static + function scanPath($path,$pattern) + { + $files=0; + $filesize=0; + + if (is_dir($path) && ($dh = opendir($path))) + { + while (($file = readdir($dh)) !== false) + { + if (substr($file,0,1) == '.') + { + continue; + } + + $full = $path . '/' . $file; + + if (!is_readable($full) || !is_writable($full)) + { + continue; + } + + if (is_dir($full)) + { + $result = self::scanPath($full,$pattern); + $files += $result['files']; + $filesize += $result['filesize']; + continue; + } + if ($pattern != '') + { + if (preg_match('/' . $pattern . '/', $file) === false) + { + continue; + } + } + + $files++; + $filesize += filesize($full); + } + closedir($dh); + } + return array('files'=>$files,'filesize'=>$filesize,'dir'=>$path); + } + + + + private static + function getDirectories() + { + $config = KTConfig::getSingleton(); + $cacheDir = $config->get('cache/cacheDirectory'); + + $tempDir = $config->get('urls/tmpDirectory'); + $logDir = $config->get('urls/logDirectory'); + $docsDir = $config->get('urls/documentRoot'); + + $indexer = Indexer::get(); + $luceneDir = $indexer->getIndexDirectory(); + + $systemDir = OS_UNIX?'/tmp':'c:/windows/temp'; + + $folders = array( + array( + 'name'=>_kt('Smarty Cache'), + 'folder'=>$tempDir, + 'pattern'=>'^%%.*', + 'canClean'=>true + ), + array( + 'name'=>_kt('System Cache'), + 'folder'=>$cacheDir, + 'pattern'=>'', + 'canClean'=>true + ), + array( + 'name'=>_kt('System Logs'), + 'folder'=>$logDir, + 'pattern'=>'.+\.txt$', + 'canClean'=>true + )); + + $folders[] = + array( + 'name'=>_kt('Temporary Folder'), + 'folder'=>$tempDir, + 'pattern'=>'', + 'canClean'=>true + ); + + $folders[] = + array( + 'name'=>_kt('System Temporary Folder'), + 'folder'=>$systemDir, + 'pattern'=>'(sess_.+)?(.+\.log$)?', + 'canClean'=>true + ); + + if (is_dir($docsDir)) + { + $folders[] = + array( + 'name'=>_kt('Documents'), + 'folder'=>$docsDir, + 'pattern'=>'', + 'canClean'=>false + ); + } + + if (is_dir($luceneDir)) + { + $folders[] = + array( + 'name'=>_kt('Document Index'), + 'folder'=>$luceneDir, + 'pattern'=>'', + 'canClean'=>false + ); + + } + return $folders; + } + + + public static + function getKTUsageStats($update = true) + { + $usage = array(); + + $oRegistry =& KTPluginRegistry::getSingleton(); + $oPlugin =& $oRegistry->getPlugin('ktcore.housekeeper.plugin'); + + $folders = self::getDirectories(); + + foreach($folders as $folder) + { + $directory = $folder['folder']; + $pattern = $folder['pattern']; + $canClean = $folder['canClean']; + $name = $folder['name']; + + $temp = self::scanPath($directory,$pattern); + + $usage[] = array( + 'description'=>$name, + 'folder'=>$directory, + 'files'=>number_format($temp['files'],0,'.',','), + 'filesize'=>KTUtil::filesizeToString($temp['filesize']), + 'action'=>$i, + 'canClean'=>$canClean + ); + } + + if ($update) + KTUtil::setSystemSetting('KTUsage',serialize($usage)); + return $usage; + } + + private static $folders = null; + + public static + function getDirectory($folder) + { + if (is_null(self::$folders)) + { + self::$folders = self::getDirectories(); + } + foreach(self::$folders as $dir) + { + if ($dir['folder'] == $folder) + { + return $dir; + } + } + return null; + } + + + public static + function cleanDirectory($path, $pattern) + { + if (!is_readable($path)) + { + return; + } + if ($dh = opendir($path)) + { + while (($file = readdir($dh)) !== false) + { + if (substr($file,0,1) == '.') + { + continue; + } + + $full = $path . '/' . $file; + if (is_dir($full)) + { + self::cleanDirectory($full,$pattern); + if (is_writable($full)) + { + @rmdir($full); + } + continue; + } + + if (!empty($pattern) && !preg_match('/' . $pattern . '/', $file)) + { + continue; + } + + if (is_writable($full)) + { + @unlink($full); + } + + } + closedir($dh); + } + } + +} + + +?> \ No newline at end of file diff --git a/plugins/housekeeper/HouseKeeperDispatcher.php b/plugins/housekeeper/HouseKeeperDispatcher.php index 1ef53cb..5c72849 100644 --- a/plugins/housekeeper/HouseKeeperDispatcher.php +++ b/plugins/housekeeper/HouseKeeperDispatcher.php @@ -7,31 +7,31 @@ * Document Management Made Simple * Copyright (C) 2008 KnowledgeTree Inc. * Portions copyright The Jam Warehouse Software (Pty) Limited - * + * * This program is free software; you can redistribute it and/or modify it under * the terms of the GNU General Public License version 3 as published by the * Free Software Foundation. - * + * * This program 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 General Public License for more * details. - * + * * You should have received a copy of the GNU General Public License * along with this program. If not, see . - * - * You can contact KnowledgeTree Inc., PO Box 7775 #87847, San Francisco, + * + * You can contact KnowledgeTree Inc., PO Box 7775 #87847, San Francisco, * California 94120-7775, or email info@knowledgetree.com. - * + * * The interactive user interfaces in modified source and object code versions * of this program must display Appropriate Legal Notices, as required under * Section 5 of the GNU General Public License version 3. - * + * * In accordance with Section 7(b) of the GNU General Public License version 3, * these Appropriate Legal Notices must retain the display of the "Powered by - * KnowledgeTree" logo and retain the original copyright notice. If the display of the + * KnowledgeTree" logo and retain the original copyright notice. If the display of the * logo is not reasonably feasible for technical reasons, the Appropriate Legal Notices - * must display the words "Powered by KnowledgeTree" and retain the original + * must display the words "Powered by KnowledgeTree" and retain the original * copyright notice. * Contributor( s): ______________________________________ */ @@ -41,85 +41,34 @@ session_start(); require_once("../../config/dmsDefaults.php"); require_once(KT_LIB_DIR . "/templating/templating.inc.php"); require_once(KT_LIB_DIR . "/dispatcher.inc.php"); +require_once('HouseKeeper.inc.php'); class HouseKeeperDispatcher extends KTStandardDispatcher { - function cleanDirectory($path, $pattern) - { - if (!is_readable($path)) - { - return; - } - if ($dh = opendir($path)) - { - while (($file = readdir($dh)) !== false) - { - if (substr($file,0,1) == '.') - { - continue; - } - - $full = $path . '/' . $file; - if (is_dir($full)) - { - $this->cleanDirectory($full,$pattern); - if (is_writable($full)) - { - @rmdir($full); - } - continue; - } - - if (!empty($pattern) && !preg_match('/' . $pattern . '/', $file)) - { - continue; - } - if (is_writable($full)) - { - @unlink($full); - } - - } - closedir($dh); - } - - } - - function do_cleanup() - { - $folder = KTUtil::arrayGet($_REQUEST, 'folder'); - if (is_null($folder)) - { - exit(redirect(generateControllerLink('dashboard'))); - } + function do_cleanup() + { + $folder = KTUtil::arrayGet($_REQUEST, 'folder'); + if (is_null($folder)) + { + exit(redirect(generateControllerLink('dashboard'))); + } - $oRegistry =& KTPluginRegistry::getSingleton(); - $oPlugin =& $oRegistry->getPlugin('ktcore.housekeeper.plugin'); + $oRegistry =& KTPluginRegistry::getSingleton(); + $oPlugin =& $oRegistry->getPlugin('ktcore.housekeeper.plugin'); // we must avoid doing anything to the documents folder at all costs! - $folder = $oPlugin->getDirectory($folder); + $folder = HouseKeeper::getDirectory($folder); if (is_null($folder) || !$folder['canClean']) { - exit(redirect(generateControllerLink('dashboard'))); + exit(redirect(generateControllerLink('dashboard'))); } - $this->cleanDirectory($folder['folder'], $folder['pattern']); - - $this->do_refreshFolderUsage(); - } - - function do_refreshDiskUsage() - { - session_unregister('DiskUsage'); - exit(redirect(generateControllerLink('dashboard'))); - } + HouseKeeper::cleanDirectory($folder['folder'], $folder['pattern']); + HouseKeeper::getKTUsageStats(); - function do_refreshFolderUsage() - { - session_unregister('SystemFolderUsage'); - exit(redirect(generateControllerLink('dashboard'))); - } + exit(redirect(generateControllerLink('dashboard'))); + } } $oDispatcher = new HouseKeeperDispatcher(); $oDispatcher->dispatch(); diff --git a/plugins/housekeeper/HouseKeeperPlugin.php b/plugins/housekeeper/HouseKeeperPlugin.php index bc99449..726988f 100755 --- a/plugins/housekeeper/HouseKeeperPlugin.php +++ b/plugins/housekeeper/HouseKeeperPlugin.php @@ -7,31 +7,31 @@ * Document Management Made Simple * Copyright (C) 2008 KnowledgeTree Inc. * Portions copyright The Jam Warehouse Software (Pty) Limited - * + * * This program is free software; you can redistribute it and/or modify it under * the terms of the GNU General Public License version 3 as published by the * Free Software Foundation. - * + * * This program 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 General Public License for more * details. - * + * * You should have received a copy of the GNU General Public License * along with this program. If not, see . - * - * You can contact KnowledgeTree Inc., PO Box 7775 #87847, San Francisco, + * + * You can contact KnowledgeTree Inc., PO Box 7775 #87847, San Francisco, * California 94120-7775, or email info@knowledgetree.com. - * + * * The interactive user interfaces in modified source and object code versions * of this program must display Appropriate Legal Notices, as required under * Section 5 of the GNU General Public License version 3. - * + * * In accordance with Section 7(b) of the GNU General Public License version 3, * these Appropriate Legal Notices must retain the display of the "Powered by - * KnowledgeTree" logo and retain the original copyright notice. If the display of the + * KnowledgeTree" logo and retain the original copyright notice. If the display of the * logo is not reasonably feasible for technical reasons, the Appropriate Legal Notices - * must display the words "Powered by KnowledgeTree" and retain the original + * must display the words "Powered by KnowledgeTree" and retain the original * copyright notice. * Contributor( s): ______________________________________ */ @@ -40,118 +40,26 @@ require_once(KT_LIB_DIR . '/plugins/plugin.inc.php'); require_once(KT_LIB_DIR . '/plugins/pluginregistry.inc.php'); class HouseKeeperPlugin extends KTPlugin - { - var $autoRegister = true; - var $sNamespace = 'ktcore.housekeeper.plugin'; +{ + var $autoRegister = true; + var $sNamespace = 'ktcore.housekeeper.plugin'; - var $folders = array(); + var $folders = array(); - function HouseKeeperPlugin($sFilename = null) - { - parent::KTPlugin($sFilename); + function HouseKeeperPlugin($sFilename = null) + { + parent::KTPlugin($sFilename); $this->sFriendlyName = _kt('Housekeeper'); - - $config = KTConfig::getSingleton(); - $cacheDir = $config->get('cache/cacheDirectory'); - $cacheFile = $cacheDir . '/houseKeeper.folders'; - - if (is_file($cacheFile)) - { - $this->folders = unserialize(file_get_contents($cacheFile)); - return; - } - - $tempDir = $config->get('urls/tmpDirectory'); - $logDir = $config->get('urls/logDirectory'); - $docsDir = $config->get('urls/documentRoot'); - - $indexer = Indexer::get(); - $luceneDir = $indexer->getIndexDirectory(); - - $systemDir = OS_UNIX?'/tmp':'c:/windows/temp'; - - $this->folders = array( - array( - 'name'=>_kt('Smarty Cache'), - 'folder'=>$tempDir, - 'pattern'=>'^%%.*', - 'canClean'=>true - ), - array( - 'name'=>_kt('System Cache'), - 'folder'=>$cacheDir, - 'pattern'=>'', - 'canClean'=>true - ), - array( - 'name'=>_kt('System Logs'), - 'folder'=>$logDir, - 'pattern'=>'.+\.txt$', - 'canClean'=>true - )); - - $this->folders[] = - array( - 'name'=>_kt('System Temporary Folder'), - 'folder'=>$systemDir, - 'pattern'=>'(sess_.+)?(.+\.log$)?', - 'canClean'=>true - ); - - if (is_dir($docsDir)) - { - $this->folders[] = - array( - 'name'=>_kt('Documents'), - 'folder'=>$docsDir, - 'pattern'=>'', - 'canClean'=>false - ); - } - - if (is_dir($luceneDir)) - { - $this->folders[] = - array( - 'name'=>_kt('Document Index'), - 'folder'=>$luceneDir, - 'pattern'=>'', - 'canClean'=>false - ); - - // lets only cache this once it has been resolved! - file_put_contents($cacheFile, serialize($this->folders)); - } - - - - } - - function getDirectories() - { - return $this->folders; - } - - function getDirectory($folder) - { - foreach($this->folders as $dir) - { - if ($dir['folder'] == $folder) - { - return $dir; - } - } - return null; } function setup() { - $this->registerDashlet('DiskUsageDashlet', 'ktcore.diskusage.dashlet', 'DiskUsageDashlet.inc.php'); - $this->registerDashlet('FolderUsageDashlet', 'ktcore.folderusage.dashlet', 'FolderUsageDashlet.inc.php'); + $this->registerDashlet('DiskUsageDashlet', 'ktcore.diskusage.dashlet', 'DiskUsageDashlet.inc.php'); + $this->registerDashlet('FolderUsageDashlet', 'ktcore.folderusage.dashlet', 'FolderUsageDashlet.inc.php'); $oTemplating =& KTTemplating::getSingleton(); - $oTemplating->addLocation('housekeeper', '/plugins/housekeeper/templates'); + $oTemplating->addLocation('housekeeper', '/plugins/housekeeper/templates'); } } diff --git a/plugins/housekeeper/bin/UpdateStats.php b/plugins/housekeeper/bin/UpdateStats.php new file mode 100644 index 0000000..7b0a7db --- /dev/null +++ b/plugins/housekeeper/bin/UpdateStats.php @@ -0,0 +1,47 @@ +. + * + * You can contact KnowledgeTree Inc., PO Box 7775 #87847, San Francisco, + * California 94120-7775, or email info@knowledgetree.com. + * + * The interactive user interfaces in modified source and object code versions + * of this program must display Appropriate Legal Notices, as required under + * Section 5 of the GNU General Public License version 3. + * + * In accordance with Section 7(b) of the GNU General Public License version 3, + * these Appropriate Legal Notices must retain the display of the "Powered by + * KnowledgeTree" logo and retain the original copyright notice. If the display of the + * logo is not reasonably feasible for technical reasons, the Appropriate Legal Notices + * must display the words "Powered by KnowledgeTree" and retain the original + * copyright notice. + * Contributor( s): ______________________________________ + * + */ + +chdir(dirname(__FILE__)); +require_once(realpath('../../../config/dmsDefaults.php')); +require_once('../HouseKeeper.inc.php'); + +HouseKeeper::getDiskUsageStats(); +HouseKeeper::getKTUsageStats(); + +?> \ No newline at end of file diff --git a/plugins/housekeeper/templates/DiskUsage.smarty b/plugins/housekeeper/templates/DiskUsage.smarty index 41a1d30..a5f43ad 100755 --- a/plugins/housekeeper/templates/DiskUsage.smarty +++ b/plugins/housekeeper/templates/DiskUsage.smarty @@ -43,5 +43,5 @@ {if $red==1} < {$urgentPercent} % {/if} -{i18n}refresh{/i18n} +  \ No newline at end of file diff --git a/plugins/housekeeper/templates/FolderUsage.smarty b/plugins/housekeeper/templates/FolderUsage.smarty index f948e54..cd1543a 100755 --- a/plugins/housekeeper/templates/FolderUsage.smarty +++ b/plugins/housekeeper/templates/FolderUsage.smarty @@ -30,7 +30,3 @@ function cleanupFolder(path) {/section}
- - - -
{i18n}refresh{/i18n}
diff --git a/plugins/ktstandard/AdminVersionPlugin/AdminVersion.inc.php b/plugins/ktstandard/AdminVersionPlugin/AdminVersion.inc.php new file mode 100644 index 0000000..755fb29 --- /dev/null +++ b/plugins/ktstandard/AdminVersionPlugin/AdminVersion.inc.php @@ -0,0 +1,90 @@ + $v) + { + $aEncoded[] = sprintf("%s=%s", urlencode($k), urlencode($v)); + } + + if (empty($url)) + $sUrl = self::KT_VERSION_URL; + else + $sUrl = $url; + $sUrl .= '?' . implode('&', $aEncoded); + + $sIdentifier = KTUtil::getSystemIdentifier(); + $sUrl .= '&' . sprintf("system_identifier=%s", $sIdentifier); + + if (!function_exists('curl_init')) + { + $stuff = @file_get_contents($sUrl); + } + else + { + $ch = @curl_init($sUrl); + if (!$ch) + { + return false; + } + curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); + curl_setopt($ch, CURLOPT_TIMEOUT, 10); + $stuff = curl_exec($ch); + curl_close($ch); + } + if ($stuff === false) + { + $stuff = ""; + } + else + { + $stuff = str_replace('\'','"', $stuff); + $decoded = json_decode($stuff); + if ($decoded === false) + { + return false; + } + KTUtil::setSystemSetting('ktadminversion_lastcheck', date('Y-m-d H:i:s')); + KTUtil::setSystemSetting('ktadminversion_lastvalue', serialize($decoded)); + } + } + + public static + function isNewVersionAvailable() + { + $aVersions = KTUtil::getKTVersions(); + + $name = array_keys($aVersions); + $name = $name[0]; + $version = array_values($aVersions); + $version = $version[0]; + + $aRemoteVersions = unserialize(KTUtil::getSystemSetting('ktadminversion_lastvalue')); + + $aVersions = get_object_vars($aRemoteVersions); + + if (!isset($aVersions[$name])) + { + return false; + } + + $newVersion = $aRemoteVersions->$name; + if (version_compare($version, $newVersion) == -1) + { + return array('name'=>$name,'version'=>$aRemoteVersions->$name); + } + + return false; + } +} + +?> \ No newline at end of file diff --git a/plugins/ktstandard/AdminVersionPlugin/AdminVersionDashlet.php b/plugins/ktstandard/AdminVersionPlugin/AdminVersionDashlet.php index 49e4558..f59c80e 100644 --- a/plugins/ktstandard/AdminVersionPlugin/AdminVersionDashlet.php +++ b/plugins/ktstandard/AdminVersionPlugin/AdminVersionDashlet.php @@ -6,71 +6,70 @@ * Document Management Made Simple * Copyright (C) 2008 KnowledgeTree Inc. * Portions copyright The Jam Warehouse Software (Pty) Limited - * + * * This program is free software; you can redistribute it and/or modify it under * the terms of the GNU General Public License version 3 as published by the * Free Software Foundation. - * + * * This program 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 General Public License for more * details. - * + * * You should have received a copy of the GNU General Public License * along with this program. If not, see . - * - * You can contact KnowledgeTree Inc., PO Box 7775 #87847, San Francisco, + * + * You can contact KnowledgeTree Inc., PO Box 7775 #87847, San Francisco, * California 94120-7775, or email info@knowledgetree.com. - * + * * The interactive user interfaces in modified source and object code versions * of this program must display Appropriate Legal Notices, as required under * Section 5 of the GNU General Public License version 3. - * + * * In accordance with Section 7(b) of the GNU General Public License version 3, * these Appropriate Legal Notices must retain the display of the "Powered by - * KnowledgeTree" logo and retain the original copyright notice. If the display of the + * KnowledgeTree" logo and retain the original copyright notice. If the display of the * logo is not reasonably feasible for technical reasons, the Appropriate Legal Notices - * must display the words "Powered by KnowledgeTree" and retain the original + * must display the words "Powered by KnowledgeTree" and retain the original * copyright notice. * Contributor( s): ______________________________________ * */ +require_once('AdminVersion.inc.php'); + class AdminVersionDashlet extends KTBaseDashlet { - var $oUser; var $sClass = 'ktError'; - + function AdminVersionDashlet(){ $this->sTitle = _kt('New Version Available'); } - - /*function is_active($oUser) { - $this->oUser = $oUser; - return true; - } - */ - - function is_active($oUser) { - $this->oUser = $oUser; - return Permission::userIsSystemAdministrator($oUser); + + function is_active($oUser) + { + $this->version = AdminVersion::isNewVersionAvailable(); + if ($this->version === false) + { + return false; + } + return Permission::userIsSystemAdministrator(); } - + function render() { global $main; - $main->requireJSResource("plugins/ktstandard/AdminVersionPlugin/js/update.js"); - - $oPlugin =& $this->oPlugin; - + $oTemplating =& KTTemplating::getSingleton(); - $oTemplate = $oTemplating->loadTemplate('AdminVersionPlugin/dashlet'); - + $oTemplate = $oTemplating->loadTemplate('dashlet'); + + $name = $this->version['name']; + $version = $this->version['version']; + $aTemplateData = array( 'context' => $this, - 'url' => $oPlugin->getPagePath('versions'), - + 'name' => $name, + 'version' => $version ); - - + return $oTemplate->render($aTemplateData); } } diff --git a/plugins/ktstandard/AdminVersionPlugin/AdminVersionPage.php b/plugins/ktstandard/AdminVersionPlugin/AdminVersionPage.php deleted file mode 100644 index 1f0d4b4..0000000 --- a/plugins/ktstandard/AdminVersionPlugin/AdminVersionPage.php +++ /dev/null @@ -1,210 +0,0 @@ -. - * - * You can contact KnowledgeTree Inc., PO Box 7775 #87847, San Francisco, - * California 94120-7775, or email info@knowledgetree.com. - * - * The interactive user interfaces in modified source and object code versions - * of this program must display Appropriate Legal Notices, as required under - * Section 5 of the GNU General Public License version 3. - * - * In accordance with Section 7(b) of the GNU General Public License version 3, - * these Appropriate Legal Notices must retain the display of the "Powered by - * KnowledgeTree" logo and retain the original copyright notice. If the display of the - * logo is not reasonably feasible for technical reasons, the Appropriate Legal Notices - * must display the words "Powered by KnowledgeTree" and retain the original - * copyright notice. - * Contributor( s): ______________________________________ - * - */ - - -require_once(KT_LIB_DIR . "/plugins/plugin.inc.php"); -require_once(KT_LIB_DIR . "/plugins/pluginregistry.inc.php"); -require_once(KT_LIB_DIR . "/dashboard/dashlet.inc.php"); - -define('KT_VERSION_URL', 'http://version.knowledgetree.com/kt_versions'); - -class AdminVersionPage extends KTStandardDispatcher { - - function _checkCache() { - global $default; - $iLastCheck = KTUtil::getSystemSetting('ktadminversion_lastcheck'); - if (empty($iLastCheck)) { - return; - } - $sLastValue = KTUtil::getSystemSetting('ktadminversion_lastvalue'); - if (empty($sLastValue)) { - $now = time(); - $diff = $now - $iLastCheck; - if ($diff > (24*60*60)) { - return; - } - } - $now = time(); - $diff = $now - $iLastCheck; - if ($diff > (24*60*60)) { - return; - } - return $sLastValue; - } - - function do_main() { - session_write_close(); - - $sCache = $this->_checkCache(); - if (!is_null($sCache)) { - $sCachedVersion = $sCache; - - $sVName = ""; - $sVNum = ""; - - $sTrimmer = str_replace('{', '', str_replace('}', '', str_replace('\'', '', $sCachedVersion))); - $aCachedVersionsTemp = explode(',',$sTrimmer); - - for($i=0;$i"; - print_r($aCachedVersions); - echo ""; - echo "
";
-        	print_r($aVersions);
-        	echo "
"; - exit; -*/ - - foreach ($aVersions as $k => $v) { - foreach($aCachedVersions as $j => $l) { - if (($k == $j) && (version_compare($aVersions[$k], $aCachedVersions[$j]) == -1)) - { - //save new name and version - $sVName = $j; - $sVNum = $l; - } - }//end foreach - - }//end foreach - - if ($sVName != "") - { - return "
"; - } - else - { - return ""; - } - } - - $sUrl = KT_VERSION_URL; - $aVersions = KTUtil::getKTVersions(); - - foreach ($aVersions as $k => $v) { - $sUrl .= '?' . sprintf("%s=%s", $k, $v); - } - $sIdentifier = KTUtil::getSystemIdentifier(); - $sUrl .= '&' . sprintf("system_identifier=%s", $sIdentifier); - - if (!function_exists('curl_init')) { - if (OS_WINDOWS) { - return ""; - } - - $stuff = @file_get_contents($sUrl); - if ($stuff === false) { - $stuff = ""; - } - } else { - - $ch = @curl_init($sUrl); - if (!$ch) { - return ""; - } - curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); - curl_setopt($ch, CURLOPT_TIMEOUT, 10); - $stuff = curl_exec($ch); - curl_close($ch); - if (!$stuff) { - $stuff = ""; - } - } - KTUtil::setSystemSetting('ktadminversion_lastcheck', time()); - KTUtil::setSystemSetting('ktadminversion_lastvalue', (string)$stuff); - - $sVName = ""; - $sVNum = ""; - - $trim_stuff = str_replace('{', '', str_replace('}', '', str_replace('\'', '', $stuff))); - $aRemoteVersionstemp = explode(',',$trim_stuff); - - for($i=0;$i"; - print_r($aRemoteVersions); - echo ""; - echo "
";
-        	print_r($aVersions);
-        echo "
"; - exit; -*/ - foreach ($aVersions as $k => $v) { - foreach($aRemoteVersions as $j => $l) { - if (($k == $j) && (version_compare($aVersions[$k], $aRemoteVersions[$j]) == -1)) - { - //save new name and version - $sVName = $j; - $sVNum = $l; - } - } - } - - if ($sVName != "") - { - return "
"; - } - else - { - return ""; - } - } - - function handleOutput($sOutput) { - print $sOutput; - } -} - -?> \ No newline at end of file diff --git a/plugins/ktstandard/AdminVersionPlugin/AdminVersionPlugin.php b/plugins/ktstandard/AdminVersionPlugin/AdminVersionPlugin.php index 8a84ab5..c45f24d 100644 --- a/plugins/ktstandard/AdminVersionPlugin/AdminVersionPlugin.php +++ b/plugins/ktstandard/AdminVersionPlugin/AdminVersionPlugin.php @@ -6,63 +6,63 @@ * Document Management Made Simple * Copyright (C) 2008 KnowledgeTree Inc. * Portions copyright The Jam Warehouse Software (Pty) Limited - * + * * This program is free software; you can redistribute it and/or modify it under * the terms of the GNU General Public License version 3 as published by the * Free Software Foundation. - * + * * This program 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 General Public License for more * details. - * + * * You should have received a copy of the GNU General Public License * along with this program. If not, see . - * - * You can contact KnowledgeTree Inc., PO Box 7775 #87847, San Francisco, + * + * You can contact KnowledgeTree Inc., PO Box 7775 #87847, San Francisco, * California 94120-7775, or email info@knowledgetree.com. - * + * * The interactive user interfaces in modified source and object code versions * of this program must display Appropriate Legal Notices, as required under * Section 5 of the GNU General Public License version 3. - * + * * In accordance with Section 7(b) of the GNU General Public License version 3, * these Appropriate Legal Notices must retain the display of the "Powered by - * KnowledgeTree" logo and retain the original copyright notice. If the display of the + * KnowledgeTree" logo and retain the original copyright notice. If the display of the * logo is not reasonably feasible for technical reasons, the Appropriate Legal Notices - * must display the words "Powered by KnowledgeTree" and retain the original + * must display the words "Powered by KnowledgeTree" and retain the original * copyright notice. * Contributor( s): ______________________________________ * */ - + require_once(KT_LIB_DIR . "/plugins/plugin.inc.php"); require_once(KT_LIB_DIR . "/plugins/pluginregistry.inc.php"); +require_once(KT_LIB_DIR . "/templating/templating.inc.php"); class AdminVersionPlugin extends KTPlugin { var $sNamespace = 'ktstandard.adminversion.plugin'; var $autoRegister = true; - + function AdminVersionPlugin($sFilename = null) { - + $res = parent::KTPlugin($sFilename); $this->sFriendlyName = _kt('Admin Version Notifier'); return $res; - + } - + function setup() { - + $this->registerDashlet('AdminVersionDashlet', 'ktstandard.adminversion.dashlet', 'AdminVersionDashlet.php'); - $this->registerPage('versions', 'AdminVersionPage', 'AdminVersionPage.php'); - - require_once(KT_LIB_DIR . "/templating/templating.inc.php"); + $oTemplating =& KTTemplating::getSingleton(); $oTemplating->addLocation('AdminVersionDashlet', '/plugins/ktstandard/AdminVersionPlugin/templates'); } } + $oPluginRegistry =& KTPluginRegistry::getSingleton(); $oPluginRegistry->registerPlugin('AdminVersionPlugin', 'ktstandard.adminversion.plugin', __FILE__); -?> +?> \ No newline at end of file diff --git a/plugins/ktstandard/AdminVersionPlugin/bin/UpdateNewVersion.php b/plugins/ktstandard/AdminVersionPlugin/bin/UpdateNewVersion.php new file mode 100644 index 0000000..ae01a20 --- /dev/null +++ b/plugins/ktstandard/AdminVersionPlugin/bin/UpdateNewVersion.php @@ -0,0 +1,45 @@ +. + * + * You can contact KnowledgeTree Inc., PO Box 7775 #87847, San Francisco, + * California 94120-7775, or email info@knowledgetree.com. + * + * The interactive user interfaces in modified source and object code versions + * of this program must display Appropriate Legal Notices, as required under + * Section 5 of the GNU General Public License version 3. + * + * In accordance with Section 7(b) of the GNU General Public License version 3, + * these Appropriate Legal Notices must retain the display of the "Powered by + * KnowledgeTree" logo and retain the original copyright notice. If the display of the + * logo is not reasonably feasible for technical reasons, the Appropriate Legal Notices + * must display the words "Powered by KnowledgeTree" and retain the original + * copyright notice. + * Contributor( s): ______________________________________ + * + */ + +chdir(dirname(__FILE__)); +require_once(realpath('../../../../config/dmsDefaults.php')); +require_once('../AdminVersion.inc.php'); + +AdminVersion::refresh(); + diff --git a/plugins/ktstandard/AdminVersionPlugin/templates/AdminVersionPlugin/computer_go.png b/plugins/ktstandard/AdminVersionPlugin/templates/computer_go.png index 0b26144..0b26144 100644 --- a/plugins/ktstandard/AdminVersionPlugin/templates/AdminVersionPlugin/computer_go.png +++ b/plugins/ktstandard/AdminVersionPlugin/templates/computer_go.png diff --git a/plugins/ktstandard/AdminVersionPlugin/templates/AdminVersionPlugin/dashlet.smarty b/plugins/ktstandard/AdminVersionPlugin/templates/dashlet.smarty index 6c71ea0..8c7ac42 100644 --- a/plugins/ktstandard/AdminVersionPlugin/templates/AdminVersionPlugin/dashlet.smarty +++ b/plugins/ktstandard/AdminVersionPlugin/templates/dashlet.smarty @@ -1,37 +1,26 @@ -{literal} - - - -{/literal} - - - -
-
- The following upgrade is available: -
-
- -
- +{literal} + + + +{/literal} + +
+
+ The following upgrade is available: +
+
\ No newline at end of file diff --git a/plugins/ktstandard/AdminVersionPlugin/test/checkVersion.php b/plugins/ktstandard/AdminVersionPlugin/test/checkVersion.php new file mode 100644 index 0000000..74e224c --- /dev/null +++ b/plugins/ktstandard/AdminVersionPlugin/test/checkVersion.php @@ -0,0 +1,50 @@ +. + * + * You can contact KnowledgeTree Inc., PO Box 7775 #87847, San Francisco, + * California 94120-7775, or email info@knowledgetree.com. + * + * The interactive user interfaces in modified source and object code versions + * of this program must display Appropriate Legal Notices, as required under + * Section 5 of the GNU General Public License version 3. + * + * In accordance with Section 7(b) of the GNU General Public License version 3, + * these Appropriate Legal Notices must retain the display of the "Powered by + * KnowledgeTree" logo and retain the original copyright notice. If the display of the + * logo is not reasonably feasible for technical reasons, the Appropriate Legal Notices + * must display the words "Powered by KnowledgeTree" and retain the original + * copyright notice. + * Contributor( s): ______________________________________ + * + */ + +chdir(dirname(__FILE__)); +require_once(realpath('../../../../config/dmsDefaults.php')); +require_once('../AdminVersion.inc.php'); + +$version = AdminVersion::isNewVersionAvailable(); + +if ($version == false) +print 'No new version available.'; +else +print_r($version); + diff --git a/plugins/ktstandard/AdminVersionPlugin/test/latestVersion.php b/plugins/ktstandard/AdminVersionPlugin/test/latestVersion.php new file mode 100644 index 0000000..cbace13 --- /dev/null +++ b/plugins/ktstandard/AdminVersionPlugin/test/latestVersion.php @@ -0,0 +1,48 @@ +. + * + * You can contact KnowledgeTree Inc., PO Box 7775 #87847, San Francisco, + * California 94120-7775, or email info@knowledgetree.com. + * + * The interactive user interfaces in modified source and object code versions + * of this program must display Appropriate Legal Notices, as required under + * Section 5 of the GNU General Public License version 3. + * + * In accordance with Section 7(b) of the GNU General Public License version 3, + * these Appropriate Legal Notices must retain the display of the "Powered by + * KnowledgeTree" logo and retain the original copyright notice. If the display of the + * logo is not reasonably feasible for technical reasons, the Appropriate Legal Notices + * must display the words "Powered by KnowledgeTree" and retain the original + * copyright notice. + * Contributor( s): ______________________________________ + * + */ + +// NOTE: this is a test script. The values are for test purposes only. + +$versions = array( +'Development OSS'=> '3.5' +); + +print json_encode($versions); + +?> \ No newline at end of file diff --git a/preferences.php b/preferences.php index 68c310a..1930447 100644 --- a/preferences.php +++ b/preferences.php @@ -6,31 +6,31 @@ * Document Management Made Simple * Copyright (C) 2008 KnowledgeTree Inc. * Portions copyright The Jam Warehouse Software (Pty) Limited - * + * * This program is free software; you can redistribute it and/or modify it under * the terms of the GNU General Public License version 3 as published by the * Free Software Foundation. - * + * * This program 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 General Public License for more * details. - * + * * You should have received a copy of the GNU General Public License * along with this program. If not, see . - * - * You can contact KnowledgeTree Inc., PO Box 7775 #87847, San Francisco, + * + * You can contact KnowledgeTree Inc., PO Box 7775 #87847, San Francisco, * California 94120-7775, or email info@knowledgetree.com. - * + * * The interactive user interfaces in modified source and object code versions * of this program must display Appropriate Legal Notices, as required under * Section 5 of the GNU General Public License version 3. - * + * * In accordance with Section 7(b) of the GNU General Public License version 3, * these Appropriate Legal Notices must retain the display of the "Powered by - * KnowledgeTree" logo and retain the original copyright notice. If the display of the + * KnowledgeTree" logo and retain the original copyright notice. If the display of the * logo is not reasonably feasible for technical reasons, the Appropriate Legal Notices - * must display the words "Powered by KnowledgeTree" and retain the original + * must display the words "Powered by KnowledgeTree" and retain the original * copyright notice. * Contributor( s): ______________________________________ * @@ -49,17 +49,17 @@ class PreferencesDispatcher extends KTStandardDispatcher { function check() { $oConfig =& KTConfig::getSingleton(); - if ($this->oUser->getId() == -2 || - ($oConfig->get('user_prefs/restrictPreferences', false) && !Permission::userIsSystemAdministrator($this->oUser->getId()))) { - return false; - } - $this->aBreadcrumbs = array(array('action' => 'preferences', 'name' => _kt('Preferences'))); + if ($this->oUser->getId() == -2 || + ($oConfig->get('user_prefs/restrictPreferences', false) && !Permission::userIsSystemAdministrator($this->oUser->getId()))) { + return false; + } + $this->aBreadcrumbs = array(array('action' => 'preferences', 'name' => _kt('Preferences'))); return parent::check(); } - + function form_main() { $oForm = new KTForm; - + $oForm->setOptions(array( 'context' => &$this, 'identifier' => 'ktcore.preferences.main', @@ -68,8 +68,8 @@ class PreferencesDispatcher extends KTStandardDispatcher { 'label' => _kt('Your Details'), 'submit_label' => _kt('Update Preferences'), 'extraargs' => $this->meldPersistQuery("","", true), - )); - + )); + // widgets $oForm->setWidgets(array( array('ktcore.widgets.string', array( @@ -83,37 +83,37 @@ class PreferencesDispatcher extends KTStandardDispatcher { 'label' => _kt('Email Address'), 'description' => _kt('Your email address. Notifications and alerts are mailed to this address if email notifications is set below. e.g. jsmith@acme.com'), 'required' => false, - 'name' => 'email_address', - 'value' => sanitizeForHTML($this->oUser->getEmail()), - 'autocomplete' => false)), + 'name' => 'email_address', + 'value' => sanitizeForHTML($this->oUser->getEmail()), + 'autocomplete' => false)), array('ktcore.widgets.boolean', array( 'label' => _kt('Email Notifications'), 'description' => _kt('If this is specified then the you will receive certain notifications. If it is not set, then you will only see notifications on the Dashboard'), 'required' => false, - 'name' => 'email_notifications', - 'value' => $this->oUser->getEmailNotification(), - 'autocomplete' => false)), + 'name' => 'email_notifications', + 'value' => $this->oUser->getEmailNotification(), + 'autocomplete' => false)), )); - + $oForm->setValidators(array( array('ktcore.validators.string', array( 'test' => 'name', 'output' => 'name')), array('ktcore.validators.emailaddress', array( 'test' => 'email_address', - 'output' => 'email_address')), + 'output' => 'email_address')), array('ktcore.validators.boolean', array( 'test' => 'email_notifications', - 'output' => 'email_notifications')), + 'output' => 'email_notifications')), )); - + return $oForm; - + } - + function form_password() { $oForm = new KTForm; - + $oForm->setOptions(array( 'context' => &$this, 'identifier' => 'ktcore.preferences.password', @@ -123,24 +123,24 @@ class PreferencesDispatcher extends KTStandardDispatcher { 'label' => _kt('Change your password'), 'submit_label' => _kt('Set password'), 'extraargs' => $this->meldPersistQuery("","", true), - )); - + )); + // widgets $oForm->setWidgets(array( array('ktcore.widgets.password', array( 'label' => _kt('Password'), 'description' => _kt('Specify your new password.'), - 'confirm_description' => _kt('Confirm the new password you specified above.'), + 'confirm_description' => _kt('Confirm the new password you specified above.'), 'confirm' => true, 'required' => true, 'name' => 'new_password', 'autocomplete' => false)), )); - - + + $KTConfig =& KTConfig::getSingleton(); $minLength = ((int) $KTConfig->get('user_prefs/passwordLength', 6)); - + $oForm->setValidators(array( array('ktcore.validators.string', array( 'test' => 'new_password', @@ -148,16 +148,16 @@ class PreferencesDispatcher extends KTStandardDispatcher { 'min_length_warning' => sprintf(_kt("Your password is too short - passwords must be at least %d characters long."), $minLength), 'output' => 'password')), )); - + return $oForm; - + } function do_main() { $this->oPage->setBreadcrumbDetails(_kt("Your Preferences")); $this->oPage->title = _kt("Dashboard"); $oUser =& $this->oUser; - + $oForm = $this->form_main(); $oTemplating =& KTTemplating::getSingleton(); @@ -172,22 +172,22 @@ class PreferencesDispatcher extends KTStandardDispatcher { 'edit_form' => $oForm, "show_password" => $bChangePassword, ); - return $oTemplate->render($aTemplateData); + return $oTemplate->render($aTemplateData); } function do_setPassword() { $this->oPage->setBreadcrumbDetails(_kt("Your Password")); $this->oPage->title = _kt("Dashboard"); - + $oForm = $this->form_password(); - + $oTemplating =& KTTemplating::getSingleton(); $oTemplate = $oTemplating->loadTemplate("ktcore/principals/password"); $aTemplateData = array( "context" => $this, 'form' => $oForm, ); - return $oTemplate->render($aTemplateData); + return $oTemplate->render($aTemplateData); } @@ -199,25 +199,25 @@ class PreferencesDispatcher extends KTStandardDispatcher { $oForm->handleError(); } $res = $res['results']; - + $this->startTransaction(); - + $oUser =& $this->oUser; - - - // FIXME this almost certainly has side-effects. do we _really_ want - $oUser->setPassword(md5($res['password'])); // - - $res = $oUser->update(); - - + + + // FIXME this almost certainly has side-effects. do we _really_ want + $oUser->setPassword(md5($res['password'])); // + + $res = $oUser->update(); + + if (PEAR::isError($res) || ($res == false)) { - $this->errorRedirectoToMain(_kt('Failed to update user.')); + $this->errorRedirectToMain(_kt('Failed to update user.')); } - + $this->commitTransaction(); $this->successRedirectToMain(_kt('Your password has been changed.')); - + } @@ -225,36 +225,36 @@ class PreferencesDispatcher extends KTStandardDispatcher { $aErrorOptions = array( 'redirect_to' => array('main'), ); - + $oForm = $this->form_main(); $res = $oForm->validate(); if (!empty($res['errors'])) { $oForm->handleError(); } - + $res = $res['results']; - + $this->startTransaction(); $oUser =& $this->oUser; $oUser->setName($res['name']); $oUser->setEmail($res['email_address']); $oUser->setEmailNotification($res['email_notifications']); - - - + + + // old system used the very evil store.php. // here we need to _force_ a limited update of the object, via a db statement. // - // $res = $oUser->update(); + // $res = $oUser->update(); $res = $oUser->doLimitedUpdate(); // ignores a fix blacklist of items. - + if (PEAR::isError($res) || ($res == false)) { - $this->errorRedirectoToMain(_kt('Failed to update your details.')); + $this->errorRedirectToMain(_kt('Failed to update your details.')); } - + $this->commitTransaction(); $this->successRedirectToMain(_kt('Your details have been updated.')); - + } diff --git a/sql/mysql/install/data.sql b/sql/mysql/install/data.sql index d8f7cab..9d999c3 100644 --- a/sql/mysql/install/data.sql +++ b/sql/mysql/install/data.sql @@ -121,13 +121,114 @@ UNLOCK TABLES; LOCK TABLES `config_settings` WRITE; /*!40000 ALTER TABLE `config_settings` DISABLE KEYS */; -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), -(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), -(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), -(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), -(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), -(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), -(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); +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), +(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), +(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), +(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), +(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), +(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), +(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), +(108,'urls','documentRoot','','default','','${varDirectory}/Documents',0); /*!40000 ALTER TABLE `config_settings` ENABLE KEYS */; UNLOCK TABLES; @@ -830,8 +931,9 @@ INSERT INTO `scheduler_tasks` VALUES (4,'Periodic Document Expunge','bin/expungeall.php','',0,'weekly','2007-10-01',NULL,0,'disabled'), (5,'Database Maintenance','bin/dbmaint.php','optimize',0,'monthly','2007-10-01',NULL,0,'disabled'), (6,'Open Office test','bin/checkopenoffice.php','',0,'1min','2007-10-01',NULL,0,'enabled'), -(7,'Cleanup Temporary Directory','search2/bin/cronCleanup.php','',0,'1min','2007-10-01',NULL,0,'enabled'); - +(7,'Cleanup Temporary Directory','search2/bin/cronCleanup.php','',0,'1min','2007-10-01',NULL,0,'enabled'), +(8,'Disk Usage and Folder Utilisation Statistics','plugins/housekeeper/bin/UpdateStats.php','',0,'5mins','2007-10-01',NULL,0,'enabled'), +(9,'Check Latest Version','plugins/ktstandard/AdminVersionPlugin/bin/UpdateNewVersion.php','',0,'daily','2007-10-01',NULL,0,'enabled'); /*!40000 ALTER TABLE `scheduler_tasks` ENABLE KEYS */; UNLOCK TABLES; @@ -1745,7 +1847,7 @@ UNLOCK TABLES; LOCK TABLES `zseq_scheduler_tasks` WRITE; /*!40000 ALTER TABLE `zseq_scheduler_tasks` DISABLE KEYS */; -INSERT INTO `zseq_scheduler_tasks` VALUES (7); +INSERT INTO `zseq_scheduler_tasks` VALUES (9); /*!40000 ALTER TABLE `zseq_scheduler_tasks` ENABLE KEYS */; UNLOCK TABLES; diff --git a/sql/mysql/upgrade/3.5.2/zdashboard_tasks.sql b/sql/mysql/upgrade/3.5.2/zdashboard_tasks.sql new file mode 100644 index 0000000..4351aec --- /dev/null +++ b/sql/mysql/upgrade/3.5.2/zdashboard_tasks.sql @@ -0,0 +1,7 @@ +select @id:=max(id)+1 from scheduler_tasks; +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'); + +select @id:=max(id)+1 from scheduler_tasks; +INSERT INTO `scheduler_tasks` VALUES (@id,'Check Latest Version','plugins/ktstandard/AdminVersionPlugin/bin/UpdateNewVersion.php','',0,'daily','2007-10-01',NULL,0,'enabled'); + +UPDATE zseq_scheduler_tasks set id=@id; \ No newline at end of file