Commit 7976385587909cdc1b3152cc4c61dac7c3766531

Authored by kevin_fourie
1 parent de40d512

KTS-2429

"config.ini must be updated during upgrade for new search to work."
In Progress. Added upgrade function. Still needs testing.

Committed By: Kevin Fourie
Reviewed By: Conrad Vermeulen



git-svn-id: https://kt-dms.svn.sourceforge.net/svnroot/kt-dms/trunk@7353 c91229c3-7414-0410-bfa2-8a42b809f60b
lib/upgrades/Ini.inc.php
... ... @@ -40,7 +40,7 @@ class Ini {
40 40 var $lineNum = 0;
41 41 var $exists = '';
42 42  
43   - function Ini($iniFile = '../../../config.ini') {
  43 + function Ini($iniFile = '../../config.ini') {
44 44 $this->iniFile = $iniFile;
45 45 $this->read($iniFile);
46 46 }
... ... @@ -159,7 +159,7 @@ class Ini {
159 159 /*
160 160 // USAGE EXAMPLE
161 161  
162   -if(file_exists('../../../config.ini')) {
  162 +if(file_exists('../../config.ini')) {
163 163  
164 164 $ini = new Ini();
165 165 $ini->addItem('Section1', 'NewItem1', 'Some Text1', 'Item1 Comment', 'Section1 Comment');
... ...
lib/upgrades/UpgradeFunctions.inc.php
... ... @@ -29,6 +29,8 @@
29 29 *
30 30 */
31 31  
  32 +require_once(KT_LIB_DIR . '/upgrades/Ini.inc.php');
  33 +
32 34 class UpgradeFunctions {
33 35 var $upgrades = array(
34 36 '2.0.0' => array('setPermissionFolder'),
... ... @@ -46,7 +48,7 @@ class UpgradeFunctions {
46 48 '3.0.3.7' => array('rebuildAllPermissions'),
47 49 '3.1.5' => array('upgradeSavedSearches'),
48 50 '3.1.6.3' => array('cleanupGroupMembership'),
49   - '3.5.0' => array('cleanupOldKTAdminVersionNotifier', 'registerExtractorMapping'),
  51 + '3.5.0' => array('cleanupOldKTAdminVersionNotifier', 'registerExtractorMapping', 'updateConfigFile35'),
50 52 );
51 53  
52 54 var $descriptions = array(
... ... @@ -67,7 +69,8 @@ class UpgradeFunctions {
67 69 'upgradeSavedSearches' => 'Upgrade saved searches to use namespaces instead of integer ids',
68 70 'cleanupGroupMembership' => 'Cleanup any old references to missing groups, etc.',
69 71 'cleanupOldKTAdminVersionNotifier' => 'Cleanup any old files from the old KTAdminVersionNotifier',
70   - 'registerExtractorMapping' => 'Register document text extractors with the appropriate mime types'
  72 + 'registerExtractorMapping' => 'Register document text extractors with the appropriate mime types',
  73 + 'updateConfigFile35' => 'Update the config.ini file for 3.5',
71 74 );
72 75 var $phases = array(
73 76 "setPermissionFolder" => 1,
... ... @@ -903,12 +906,83 @@ class UpgradeFunctions {
903 906 }
904 907 // }}}
905 908  
  909 + // {{{ registerExtractorMapping
906 910 function registerExtractorMapping()
907 911 {
908 912 $indexer = Indexer::get();
909 913 $indexer->registerTypes();
910 914 }
  915 + // }}}
  916 +
  917 + // {{{ updateConfigFile35
  918 + function updateConfigFile35()
  919 + {
  920 + if(file_exists('../../config.ini')) {
  921 +
  922 + $ini = new Ini();
  923 +
  924 + // Webservices Section
  925 + $ini->addItem('webservice', 'uploadDirectory', '${varDirectory}/uploads');
  926 + $ini->addItem('webservice', 'downloadUrl', '${rootUrl}/ktwebservice/download.php');
  927 + $ini->addItem('webservice', 'uploadExpiry', '30');
  928 + $ini->addItem('webservice', 'downloadExpiry', '30');
  929 + $ini->addItem('webservice', 'randomKeyText', 'bkdfjhg23yskjdhf2iu');
  930 + $ini->addItem('webservice', 'validateSessionCount', 'false');
  931 +
  932 + // externalBinary Section
  933 + $ini->addItem('externalBinary', 'xls2csv', 'xls2csv', '', 'The following are external binaries that may be used by various parts of knowledgeTree.');
  934 + $ini->addItem('externalBinary', 'pdftotext', 'pdftotext');
  935 + $ini->addItem('externalBinary', 'catppt', 'catppt');
  936 + $ini->addItem('externalBinary', 'pstotext', 'pstotext');
  937 + $ini->addItem('externalBinary', 'catdoc', 'catdoc');
  938 + $ini->addItem('externalBinary', 'antiword', 'antiword.exe');
  939 +
  940 + // search Section
  941 + $ini->addItem('search', 'resultsPerPage', 'default', "The number of results per page\r\n; defaults to 25");
  942 + $ini->addItem('search', 'dateFormat', 'default', "The date format used when making queries using widgets\r\n; defaults to Y-m-d");
  943 +
  944 + // indexer Section
  945 + $ini->addItem('indexer', 'coreClass', 'JavaXMLRPCLuceneIndexer', "The core indexing class\r\n;coreClass=PHPLuceneIndexer");
  946 + $ini->addItem('indexer', 'batchDocuments', 'default', "The number of documents to be indexed in a cron session\r\n; defaults to 20");
  947 + $ini->addItem('indexer', 'luceneDirectory', '${varDirectory}/indexes', "The location of the lucene indexes");
  948 +
  949 + // openoffice Section
  950 + $ini->addItem('openoffice', 'host', 'default', "The host on which open office is installed\r\n; defaults to localhost");
  951 + $ini->addItem('openoffice', 'port', 'default', "The port on which open office is listening\r\n; defaults to 8100");
  952 +
  953 + // user_prefs Section
  954 + $ini->addItem('user_prefs', 'passwordLength', '6', "The minimum password length on password-setting\r\n; could be moved into DB-auth-config");
  955 + $ini->addItem('user_prefs', 'restrictAdminPasswords', '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.");
  956 + $ini->addItem('user_prefs', 'restrictPreferences', 'false', "Restrict users from accessing their preferences menus?");
  957 +
  958 + // builtinauth Section
  959 + $ini->addItem('builtinauth', 'password_change_interval', '30', "This would force users that use the built-in authentication provider\r\n; to have to change their passwords every 30 days." ,"This is configuration for the built-in authentication provider");
  960 +
  961 + // cache Section
  962 + $ini->addItem('cache', 'cacheEnabled', 'true', '', "Enable/disable the cache and set the cache location");
  963 + $ini->addItem('cache', 'cacheDirectory', '${varDirectory}/cache');
  964 +
  965 + // KTWebDAVSettings Section
  966 + $ini->addItem('KTWebDAVSettings', 'debug', 'off', '_LOTS_ of debug info will be logged if the following is "on"', 'This section is for KTWebDAV only');
  967 + $ini->addItem('KTWebDAVSettings', 'safemode', 'on', 'To allow write access to WebDAV clients set safe mode to "off" below');
  968 +
  969 + // BaobabSettings Section
  970 + $ini->addItem('BaobabSettings', 'debug', 'off', '_LOTS_ of debug info will be logged if the following is "on"', 'This section is for Boabab only');
  971 + $ini->addItem('BaobabSettings', 'safemode', 'on', 'To allow write access to WebDAV clients set safe mode to "off" below');
  972 +
  973 + // backup Section
  974 + $ini->addItem('backup', '', '', "Identify location of kt-backup for database backups\r\n;backupDirectory=c:/kt-backups\r\n;backupDirectory=/tmp/kt-backups");
  975 + $ini->addItem('backup', '', '', "Identify the location of the mysql.exe and mysqldump.exe\r\n;mysqlDirectory=c:/program files/ktdms/mysql/bin");
  976 +
  977 + // clientToolPolicies Section
  978 + $ini->addItem('clientToolPolicies', 'explorerMetadataCapture', 'true', "These two settings control whether or not the client is prompted for metadata when a\r\n;document is added to knowledgetree via KTtools. They default to true.");
  979 + $ini->addItem('clientToolPolicies', 'officeMetadataCapture', 'true');
  980 +
  981 + $ini->write();
911 982  
  983 + }
  984 + }
  985 + // }}}
912 986 }
913 987  
914 988 ?>
... ...