Commit 65411235b9d48ae3822a60818761c0d7a5ec5c1e

Authored by kevin_fourie
1 parent 441e91e3

Merged in from DEV trunk...

KTS-2525
"Create windows service to wrap around scheduler"
Updated. Fixed issues executing cross platform.

Committed By: Kevin Fourie
Reviewed By: Conrad Vermeulen

KTS-1554
"Implement a Scheduler"
Updated. Made script work cross platform

Committed by: Conrad Vermeulen
Reviewed by: Kevin Fourie

KTS-2571
"Upgrade wizard is not calling ini upgrade function"
Fixed. Added backup before writing config.ini

Committed By: Conrad Vermeulen
Reviewed By: Kevin Fourie

KTS-1554
"Implement a Scheduler"
Updated. add scheduled tasks to clean db

Committed by: Conrad Vermeulen
Reviewed by: Kevin Fourie

git-svn-id: https://kt-dms.svn.sourceforge.net/svnroot/kt-dms/STABLE/trunk@7513 c91229c3-7414-0410-bfa2-8a42b809f60b
bin/scheduler.php
@@ -5,36 +5,36 @@ @@ -5,36 +5,36 @@
5 * KnowledgeTree Open Source Edition 5 * KnowledgeTree Open Source Edition
6 * Document Management Made Simple 6 * Document Management Made Simple
7 * Copyright (C) 2004 - 2007 The Jam Warehouse Software (Pty) Limited 7 * Copyright (C) 2004 - 2007 The Jam Warehouse Software (Pty) Limited
8 - * 8 + *
9 * This program is free software; you can redistribute it and/or modify it under 9 * This program is free software; you can redistribute it and/or modify it under
10 * the terms of the GNU General Public License version 3 as published by the 10 * the terms of the GNU General Public License version 3 as published by the
11 * Free Software Foundation. 11 * Free Software Foundation.
12 - * 12 + *
13 * This program is distributed in the hope that it will be useful, but WITHOUT 13 * This program is distributed in the hope that it will be useful, but WITHOUT
14 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 14 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
15 * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more 15 * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
16 * details. 16 * details.
17 - * 17 + *
18 * You should have received a copy of the GNU General Public License 18 * You should have received a copy of the GNU General Public License
19 * along with this program. If not, see <http://www.gnu.org/licenses/>. 19 * along with this program. If not, see <http://www.gnu.org/licenses/>.
20 - * 20 + *
21 * You can contact The Jam Warehouse Software (Pty) Limited, Unit 1, Tramber Place, 21 * You can contact The Jam Warehouse Software (Pty) Limited, Unit 1, Tramber Place,
22 * Blake Street, Observatory, 7925 South Africa. or email info@knowledgetree.com. 22 * Blake Street, Observatory, 7925 South Africa. or email info@knowledgetree.com.
23 - * 23 + *
24 * The interactive user interfaces in modified source and object code versions 24 * The interactive user interfaces in modified source and object code versions
25 * of this program must display Appropriate Legal Notices, as required under 25 * of this program must display Appropriate Legal Notices, as required under
26 * Section 5 of the GNU General Public License version 3. 26 * Section 5 of the GNU General Public License version 3.
27 - * 27 + *
28 * In accordance with Section 7(b) of the GNU General Public License version 3, 28 * In accordance with Section 7(b) of the GNU General Public License version 3,
29 * these Appropriate Legal Notices must retain the display of the "Powered by 29 * these Appropriate Legal Notices must retain the display of the "Powered by
30 - * KnowledgeTree" logo and retain the original copyright notice. If the display of the 30 + * KnowledgeTree" logo and retain the original copyright notice. If the display of the
31 * logo is not reasonably feasible for technical reasons, the Appropriate Legal Notices 31 * logo is not reasonably feasible for technical reasons, the Appropriate Legal Notices
32 - * must display the words "Powered by KnowledgeTree" and retain the original  
33 - * copyright notice. 32 + * must display the words "Powered by KnowledgeTree" and retain the original
  33 + * copyright notice.
34 * Contributor( s): ______________________________________ 34 * Contributor( s): ______________________________________
35 * 35 *
36 */ 36 */
37 - 37 +
38 require_once('../config/dmsDefaults.php'); 38 require_once('../config/dmsDefaults.php');
39 require_once(KT_LIB_DIR . '/database/dbutil.inc'); 39 require_once(KT_LIB_DIR . '/database/dbutil.inc');
40 40
@@ -73,6 +73,12 @@ function calculateRunTime($sFreq, $iTime) { @@ -73,6 +73,12 @@ function calculateRunTime($sFreq, $iTime) {
73 case '5mins': 73 case '5mins':
74 $iDiff = (60*5); 74 $iDiff = (60*5);
75 break; 75 break;
  76 + case '1min':
  77 + $iDiff = 60;
  78 + break;
  79 + case '30secs':
  80 + $iDiff = 30;
  81 + break;
76 case 'once': 82 case 'once':
77 $iDiff = 0; 83 $iDiff = 0;
78 break; 84 break;
@@ -89,11 +95,11 @@ function updateTask($sTable, $aFieldValues, $iId) { @@ -89,11 +95,11 @@ function updateTask($sTable, $aFieldValues, $iId) {
89 // Get the list of tasks due to be run from the database 95 // Get the list of tasks due to be run from the database
90 function getTaskList($sTable) { 96 function getTaskList($sTable) {
91 $now = date('Y-m-d H:i:s'); //time(); 97 $now = date('Y-m-d H:i:s'); //time();
92 - $query = "SELECT * FROM {$sTable} 98 + $query = "SELECT * FROM {$sTable}
93 WHERE is_complete = 0 AND run_time < '{$now}'"; 99 WHERE is_complete = 0 AND run_time < '{$now}'";
94 - 100 +
95 $result = DBUtil::getResultArray($query); 101 $result = DBUtil::getResultArray($query);
96 - 102 +
97 if (PEAR::isError($result)){ 103 if (PEAR::isError($result)){
98 exit(); 104 exit();
99 } 105 }
@@ -108,21 +114,23 @@ $sTable = &#39;scheduler_tasks&#39;; @@ -108,21 +114,23 @@ $sTable = &#39;scheduler_tasks&#39;;
108 // Get task list 114 // Get task list
109 $aList = getTaskList($sTable); 115 $aList = getTaskList($sTable);
110 116
  117 +global $default;
  118 +
111 // Loop through tasks and run 119 // Loop through tasks and run
112 if(!empty($aList)){ 120 if(!empty($aList)){
113 foreach($aList as $item){ 121 foreach($aList as $item){
114 $aUpdate = array(); 122 $aUpdate = array();
115 $iEnd = 0; $iStart = 0; $iDuration = 0; 123 $iEnd = 0; $iStart = 0; $iDuration = 0;
116 - $sFreq = ''; $sParameters = ''; 124 + $sFreq = ''; $sParameters = '';
117 $retval = TRUE; 125 $retval = TRUE;
118 - 126 +
119 // Set up start variables 127 // Set up start variables
120 $sTask = $item['task']; 128 $sTask = $item['task'];
121 $sTaskUrl = $item['script_url']; 129 $sTaskUrl = $item['script_url'];
122 $iDuration = $item['run_duration']; 130 $iDuration = $item['run_duration'];
123 $sFreq = $item['frequency']; 131 $sFreq = $item['frequency'];
124 $sParameters = $item['script_params']; 132 $sParameters = $item['script_params'];
125 - 133 +
126 // Check if script is windows or *nix compatible 134 // Check if script is windows or *nix compatible
127 $extArr = explode('.', $sTaskUrl); 135 $extArr = explode('.', $sTaskUrl);
128 $ext = array_pop($extArr); 136 $ext = array_pop($extArr);
@@ -162,19 +170,39 @@ if(!empty($aList)){ @@ -162,19 +170,39 @@ if(!empty($aList)){
162 break; 170 break;
163 } 171 }
164 } 172 }
165 - 173 +
166 $iTime = time(); 174 $iTime = time();
167 $iStart = explode(' ', microtime()); 175 $iStart = explode(' ', microtime());
168 - 176 +
169 // Run the script 177 // Run the script
170 - $file = KT_DIR . escapeshellcmd($sTaskUrl);  
171 - system("{$file} {$sParameters} >> /dev/null", $retval);  
172 - 178 + $file =escapeshellcmd($sTaskUrl);
  179 +
  180 + $cmd = "\"$file\" {$sParameters}";
  181 +
  182 + if (OS_WINDOWS)
  183 + {
  184 + $cmd = str_replace( '/','\\',$cmd);
  185 + $res = `"$cmd" 2>&1`;
  186 + }
  187 + else
  188 + {
  189 + $res = shell_exec($cmd." 2>&1");
  190 + }
  191 +
  192 + if (!empty($res))
  193 + {
  194 + $default->log->info("Scheduler - Task: $sTask");
  195 + $default->log->info("Scheduler - Command: $cmd");
  196 + $default->log->info("Scheduler - Output: $res");
  197 + $default->log->info("Scheduler - Background tasks should not produce output. Please review why this is producing output.");
  198 + }
  199 +
  200 +
173 // On completion - reset run time 201 // On completion - reset run time
174 $iEnd = explode(' ', microtime()); 202 $iEnd = explode(' ', microtime());
175 $iDuration = ($iEnd[1] + $iEnd[0]) - ($iStart[1] + $iStart[0]); 203 $iDuration = ($iEnd[1] + $iEnd[0]) - ($iStart[1] + $iStart[0]);
176 $iDuration = round($iDuration, 3); 204 $iDuration = round($iDuration, 3);
177 - 205 +
178 if(($sFreq == 'once' || empty($sFreq)) && $retval !== FALSE){ 206 if(($sFreq == 'once' || empty($sFreq)) && $retval !== FALSE){
179 // Set is_complete to true 207 // Set is_complete to true
180 $aUpdate['is_complete'] = '1'; 208 $aUpdate['is_complete'] = '1';
@@ -184,9 +212,9 @@ if(!empty($aList)){ @@ -184,9 +212,9 @@ if(!empty($aList)){
184 } 212 }
185 $aUpdate['previous_run_time'] = date('Y-m-d H:i:s', $iTime); 213 $aUpdate['previous_run_time'] = date('Y-m-d H:i:s', $iTime);
186 $aUpdate['run_duration'] = $iDuration; 214 $aUpdate['run_duration'] = $iDuration;
187 - 215 +
188 updateTask($sTable, $aUpdate, $item['id']); 216 updateTask($sTable, $aUpdate, $item['id']);
189 - 217 +
190 // clear parameters 218 // clear parameters
191 if(!empty($aParams)){ 219 if(!empty($aParams)){
192 foreach($aParams as $param){ 220 foreach($aParams as $param){
bin/win32/schedulerService.php
@@ -6,6 +6,20 @@ $myservicename = &#39;ktscheduler&#39;; @@ -6,6 +6,20 @@ $myservicename = &#39;ktscheduler&#39;;
6 if (!win32_start_service_ctrl_dispatcher($myservicename)) die('Could not connect to service :'.$myservicename); 6 if (!win32_start_service_ctrl_dispatcher($myservicename)) die('Could not connect to service :'.$myservicename);
7 win32_set_service_status(WIN32_SERVICE_RUNNING); 7 win32_set_service_status(WIN32_SERVICE_RUNNING);
8 8
  9 +require_once('../../config/dmsDefaults.php');
  10 +
  11 +global $default;
  12 +
  13 +$config = KTConfig::getSingleton();
  14 +$schedulerInterval = $config->get('KnowledgeTree/schedulerInterval',10); // interval in seconds
  15 +$phpPath = $config->get('externalBinary/php','php');
  16 +
  17 +if (!is_file($phpPath))
  18 +{
  19 + $default->log->error("Scheduler: php not found: $phpPath");
  20 + exit;
  21 +}
  22 +
9 // Main Scheduler Service Loop 23 // Main Scheduler Service Loop
10 while (1) { 24 while (1) {
11 25
@@ -23,15 +37,20 @@ while (1) { @@ -23,15 +37,20 @@ while (1) {
23 37
24 // Setup php binary path 38 // Setup php binary path
25 $phpPath = realpath('../../php/php.exe'); 39 $phpPath = realpath('../../php/php.exe');
26 - if (!is_file($phpPath))  
27 - {  
28 - die('Cannot find php.exe');  
29 - }  
30 - 40 +
  41 +
31 // Run the scheduler script 42 // Run the scheduler script
32 - system("$phpPath scheduler.php");  
33 43
34 - sleep(10); // Run every 10 seconds 44 + $cmd = "\"$phpPath\" scheduler.php";
  45 +
  46 + $cmd = str_replace( '/','\\',$cmd);
  47 + $res = `"$cmd" 2>&1`;
  48 + if (!empty($res))
  49 + {
  50 + $default->log->error('Scheduler: unexpected output - ' .$res);
  51 + }
  52 +
  53 + sleep($schedulerInterval);
35 54
36 } 55 }
37 win32_set_service_status(WIN32_SERVICE_STOPPED); 56 win32_set_service_status(WIN32_SERVICE_STOPPED);
lib/config/config.inc.php
@@ -5,32 +5,32 @@ @@ -5,32 +5,32 @@
5 * KnowledgeTree Open Source Edition 5 * KnowledgeTree Open Source Edition
6 * Document Management Made Simple 6 * Document Management Made Simple
7 * Copyright (C) 2004 - 2007 The Jam Warehouse Software (Pty) Limited 7 * Copyright (C) 2004 - 2007 The Jam Warehouse Software (Pty) Limited
8 - * 8 + *
9 * This program is free software; you can redistribute it and/or modify it under 9 * This program is free software; you can redistribute it and/or modify it under
10 * the terms of the GNU General Public License version 3 as published by the 10 * the terms of the GNU General Public License version 3 as published by the
11 * Free Software Foundation. 11 * Free Software Foundation.
12 - * 12 + *
13 * This program is distributed in the hope that it will be useful, but WITHOUT 13 * This program is distributed in the hope that it will be useful, but WITHOUT
14 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 14 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
15 * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more 15 * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
16 * details. 16 * details.
17 - * 17 + *
18 * You should have received a copy of the GNU General Public License 18 * You should have received a copy of the GNU General Public License
19 * along with this program. If not, see <http://www.gnu.org/licenses/>. 19 * along with this program. If not, see <http://www.gnu.org/licenses/>.
20 - * 20 + *
21 * You can contact The Jam Warehouse Software (Pty) Limited, Unit 1, Tramber Place, 21 * You can contact The Jam Warehouse Software (Pty) Limited, Unit 1, Tramber Place,
22 * Blake Street, Observatory, 7925 South Africa. or email info@knowledgetree.com. 22 * Blake Street, Observatory, 7925 South Africa. or email info@knowledgetree.com.
23 - * 23 + *
24 * The interactive user interfaces in modified source and object code versions 24 * The interactive user interfaces in modified source and object code versions
25 * of this program must display Appropriate Legal Notices, as required under 25 * of this program must display Appropriate Legal Notices, as required under
26 * Section 5 of the GNU General Public License version 3. 26 * Section 5 of the GNU General Public License version 3.
27 - * 27 + *
28 * In accordance with Section 7(b) of the GNU General Public License version 3, 28 * In accordance with Section 7(b) of the GNU General Public License version 3,
29 * these Appropriate Legal Notices must retain the display of the "Powered by 29 * these Appropriate Legal Notices must retain the display of the "Powered by
30 - * KnowledgeTree" logo and retain the original copyright notice. If the display of the 30 + * KnowledgeTree" logo and retain the original copyright notice. If the display of the
31 * logo is not reasonably feasible for technical reasons, the Appropriate Legal Notices 31 * logo is not reasonably feasible for technical reasons, the Appropriate Legal Notices
32 - * must display the words "Powered by KnowledgeTree" and retain the original  
33 - * copyright notice. 32 + * must display the words "Powered by KnowledgeTree" and retain the original
  33 + * copyright notice.
34 * Contributor( s): ______________________________________ 34 * Contributor( s): ______________________________________
35 * 35 *
36 */ 36 */
@@ -150,6 +150,25 @@ class KTConfig { @@ -150,6 +150,25 @@ class KTConfig {
150 return $oDefault; 150 return $oDefault;
151 } 151 }
152 152
  153 + /**
  154 + * Return the location of the config.ini
  155 + *
  156 + * @return string
  157 + */
  158 + static function getConfigFilename()
  159 + {
  160 + $configPath = file_get_contents(KT_DIR . '/config/config-path');
  161 +
  162 + if (is_file($configPath))
  163 + {
  164 + return $configPath;
  165 + }
  166 + else
  167 + {
  168 + return KT_DIR . '/' . $configPath;
  169 + }
  170 + }
  171 +
153 static function &getSingleton() { 172 static function &getSingleton() {
154 static $singleton = null; 173 static $singleton = null;
155 174
lib/upgrades/Ini.inc.php
@@ -5,32 +5,32 @@ @@ -5,32 +5,32 @@
5 * KnowledgeTree Open Source Edition 5 * KnowledgeTree Open Source Edition
6 * Document Management Made Simple 6 * Document Management Made Simple
7 * Copyright (C) 2004 - 2007 The Jam Warehouse Software (Pty) Limited 7 * Copyright (C) 2004 - 2007 The Jam Warehouse Software (Pty) Limited
8 - * 8 + *
9 * This program is free software; you can redistribute it and/or modify it under 9 * This program is free software; you can redistribute it and/or modify it under
10 * the terms of the GNU General Public License version 3 as published by the 10 * the terms of the GNU General Public License version 3 as published by the
11 * Free Software Foundation. 11 * Free Software Foundation.
12 - * 12 + *
13 * This program is distributed in the hope that it will be useful, but WITHOUT 13 * This program is distributed in the hope that it will be useful, but WITHOUT
14 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 14 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
15 * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more 15 * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
16 * details. 16 * details.
17 - * 17 + *
18 * You should have received a copy of the GNU General Public License 18 * You should have received a copy of the GNU General Public License
19 * along with this program. If not, see <http://www.gnu.org/licenses/>. 19 * along with this program. If not, see <http://www.gnu.org/licenses/>.
20 - * 20 + *
21 * You can contact The Jam Warehouse Software (Pty) Limited, Unit 1, Tramber Place, 21 * You can contact The Jam Warehouse Software (Pty) Limited, Unit 1, Tramber Place,
22 * Blake Street, Observatory, 7925 South Africa. or email info@knowledgetree.com. 22 * Blake Street, Observatory, 7925 South Africa. or email info@knowledgetree.com.
23 - * 23 + *
24 * The interactive user interfaces in modified source and object code versions 24 * The interactive user interfaces in modified source and object code versions
25 * of this program must display Appropriate Legal Notices, as required under 25 * of this program must display Appropriate Legal Notices, as required under
26 * Section 5 of the GNU General Public License version 3. 26 * Section 5 of the GNU General Public License version 3.
27 - * 27 + *
28 * In accordance with Section 7(b) of the GNU General Public License version 3, 28 * In accordance with Section 7(b) of the GNU General Public License version 3,
29 * these Appropriate Legal Notices must retain the display of the "Powered by 29 * these Appropriate Legal Notices must retain the display of the "Powered by
30 - * KnowledgeTree" logo and retain the original copyright notice. If the display of the 30 + * KnowledgeTree" logo and retain the original copyright notice. If the display of the
31 * logo is not reasonably feasible for technical reasons, the Appropriate Legal Notices 31 * logo is not reasonably feasible for technical reasons, the Appropriate Legal Notices
32 - * must display the words "Powered by KnowledgeTree" and retain the original  
33 - * copyright notice. 32 + * must display the words "Powered by KnowledgeTree" and retain the original
  33 + * copyright notice.
34 * Contributor( s): ______________________________________ 34 * Contributor( s): ______________________________________
35 * 35 *
36 */ 36 */
@@ -48,7 +48,27 @@ class Ini { @@ -48,7 +48,27 @@ class Ini {
48 48
49 function Ini($iniFile = '../../config.ini') { 49 function Ini($iniFile = '../../config.ini') {
50 $this->iniFile = $iniFile; 50 $this->iniFile = $iniFile;
51 - $this->read($iniFile); 51 + $this->backupIni($iniFile);
  52 + $this->read($iniFile);
  53 + }
  54 +
  55 + /**
  56 + * Create a backup with the date as an extension in the same location as the original config.ini
  57 + *
  58 + * @param string $iniFile
  59 + * @return boolean
  60 + */
  61 + function backupIni($iniFile)
  62 + {
  63 + $content = file_get_contents($iniFile);
  64 + if ($content === false)
  65 + {
  66 + return false;
  67 + }
  68 + $date = date('YmdHis');
  69 +
  70 + $backupFile = $iniFile . '.' .$date;
  71 + return file_put_contents($backupFile, $content) !== false;
52 } 72 }
53 73
54 function read($iniFile) { 74 function read($iniFile) {
@@ -85,7 +105,7 @@ class Ini { @@ -85,7 +105,7 @@ class Ini {
85 $key = trim(substr($iniLine, 0, $equalsPos)); 105 $key = trim(substr($iniLine, 0, $equalsPos));
86 $value = trim(substr($iniLine, $equalsPos+1)); 106 $value = trim(substr($iniLine, $equalsPos+1));
87 if (substr($value, 1, 1) == '"' && substr( $value, -1, 1) == '"') { 107 if (substr($value, 1, 1) == '"' && substr( $value, -1, 1) == '"') {
88 - $value = substr($value, 1, -1); 108 + $value = substr($value, 1, -1);
89 } 109 }
90 $this->cleanArray[$section][$key] = stripcslashes($value); 110 $this->cleanArray[$section][$key] = stripcslashes($value);
91 } else { 111 } else {
@@ -104,21 +124,21 @@ class Ini { @@ -104,21 +124,21 @@ class Ini {
104 $fileHandle = fopen($iniFile, 'wb'); 124 $fileHandle = fopen($iniFile, 'wb');
105 foreach ($this->cleanArray as $section => $items) { 125 foreach ($this->cleanArray as $section => $items) {
106 if (substr($section, 0, strlen('_blankline_')) === '_blankline_' ) { 126 if (substr($section, 0, strlen('_blankline_')) === '_blankline_' ) {
107 - fwrite ($fileHandle, "\r\n"); 127 + fwrite ($fileHandle, "\r\n");
108 continue; 128 continue;
109 } 129 }
110 if (substr($section, 0, strlen('_comment_')) === '_comment_' ) { 130 if (substr($section, 0, strlen('_comment_')) === '_comment_' ) {
111 - fwrite ($fileHandle, "$items\r\n"); 131 + fwrite ($fileHandle, "$items\r\n");
112 continue; 132 continue;
113 } 133 }
114 fwrite ($fileHandle, "[".$section."]\r\n"); 134 fwrite ($fileHandle, "[".$section."]\r\n");
115 foreach ($items as $key => $value) { 135 foreach ($items as $key => $value) {
116 if (substr($key, 0, strlen('_blankline_')) === '_blankline_' ) { 136 if (substr($key, 0, strlen('_blankline_')) === '_blankline_' ) {
117 - fwrite ($fileHandle, "\r\n"); 137 + fwrite ($fileHandle, "\r\n");
118 continue; 138 continue;
119 } 139 }
120 if (substr($key, 0, strlen('_comment_')) === '_comment_' ) { 140 if (substr($key, 0, strlen('_comment_')) === '_comment_' ) {
121 - fwrite ($fileHandle, "$value\r\n"); 141 + fwrite ($fileHandle, "$value\r\n");
122 continue; 142 continue;
123 } 143 }
124 144
@@ -145,7 +165,7 @@ class Ini { @@ -145,7 +165,7 @@ class Ini {
145 } 165 }
146 return false; 166 return false;
147 } 167 }
148 - 168 +
149 function addItem($addSection, $addItem, $value, $itemComment = '', $sectionComment = '') { 169 function addItem($addSection, $addItem, $value, $itemComment = '', $sectionComment = '') {
150 170
151 if($this->itemExists($addSection, $addItem)) return false; 171 if($this->itemExists($addSection, $addItem)) return false;
lib/upgrades/UpgradeFunctions.inc.php
@@ -5,32 +5,32 @@ @@ -5,32 +5,32 @@
5 * KnowledgeTree Open Source Edition 5 * KnowledgeTree Open Source Edition
6 * Document Management Made Simple 6 * Document Management Made Simple
7 * Copyright (C) 2004 - 2007 The Jam Warehouse Software (Pty) Limited 7 * Copyright (C) 2004 - 2007 The Jam Warehouse Software (Pty) Limited
8 - * 8 + *
9 * This program is free software; you can redistribute it and/or modify it under 9 * This program is free software; you can redistribute it and/or modify it under
10 * the terms of the GNU General Public License version 3 as published by the 10 * the terms of the GNU General Public License version 3 as published by the
11 * Free Software Foundation. 11 * Free Software Foundation.
12 - * 12 + *
13 * This program is distributed in the hope that it will be useful, but WITHOUT 13 * This program is distributed in the hope that it will be useful, but WITHOUT
14 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 14 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
15 * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more 15 * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
16 * details. 16 * details.
17 - * 17 + *
18 * You should have received a copy of the GNU General Public License 18 * You should have received a copy of the GNU General Public License
19 * along with this program. If not, see <http://www.gnu.org/licenses/>. 19 * along with this program. If not, see <http://www.gnu.org/licenses/>.
20 - * 20 + *
21 * You can contact The Jam Warehouse Software (Pty) Limited, Unit 1, Tramber Place, 21 * You can contact The Jam Warehouse Software (Pty) Limited, Unit 1, Tramber Place,
22 * Blake Street, Observatory, 7925 South Africa. or email info@knowledgetree.com. 22 * Blake Street, Observatory, 7925 South Africa. or email info@knowledgetree.com.
23 - * 23 + *
24 * The interactive user interfaces in modified source and object code versions 24 * The interactive user interfaces in modified source and object code versions
25 * of this program must display Appropriate Legal Notices, as required under 25 * of this program must display Appropriate Legal Notices, as required under
26 * Section 5 of the GNU General Public License version 3. 26 * Section 5 of the GNU General Public License version 3.
27 - * 27 + *
28 * In accordance with Section 7(b) of the GNU General Public License version 3, 28 * In accordance with Section 7(b) of the GNU General Public License version 3,
29 * these Appropriate Legal Notices must retain the display of the "Powered by 29 * these Appropriate Legal Notices must retain the display of the "Powered by
30 - * KnowledgeTree" logo and retain the original copyright notice. If the display of the 30 + * KnowledgeTree" logo and retain the original copyright notice. If the display of the
31 * logo is not reasonably feasible for technical reasons, the Appropriate Legal Notices 31 * logo is not reasonably feasible for technical reasons, the Appropriate Legal Notices
32 - * must display the words "Powered by KnowledgeTree" and retain the original  
33 - * copyright notice. 32 + * must display the words "Powered by KnowledgeTree" and retain the original
  33 + * copyright notice.
34 * Contributor( s): ______________________________________ 34 * Contributor( s): ______________________________________
35 * 35 *
36 */ 36 */
@@ -916,9 +916,12 @@ class UpgradeFunctions { @@ -916,9 +916,12 @@ class UpgradeFunctions {
916 // {{{ updateConfigFile35 916 // {{{ updateConfigFile35
917 function updateConfigFile35() 917 function updateConfigFile35()
918 { 918 {
919 - if(file_exists('../../config.ini')) { 919 + $configPath = KTConfig::getConfigFilename();
  920 + $configPath = str_replace(array("\n","\r"), array('',''), $configPath);
  921 +
  922 + if(file_exists($configPath)) {
920 923
921 - $ini = new Ini(); 924 + $ini = new Ini($configPath);
922 925
923 // Webservices Section 926 // Webservices Section
924 $ini->addItem('webservice', 'uploadDirectory', '${varDirectory}/uploads'); 927 $ini->addItem('webservice', 'uploadDirectory', '${varDirectory}/uploads');
@@ -1008,7 +1011,6 @@ class UpgradeFunctions { @@ -1008,7 +1011,6 @@ class UpgradeFunctions {
1008 $ini->addItem('DiskUsage', 'urgentThreshold', '5', "When free space in a mount point is less than this percentage,\r\n; the disk usage dashlet will highlight the mount in RED"); 1011 $ini->addItem('DiskUsage', 'urgentThreshold', '5', "When free space in a mount point is less than this percentage,\r\n; the disk usage dashlet will highlight the mount in RED");
1009 1012
1010 $ini->write(); 1013 $ini->write();
1011 -  
1012 } 1014 }
1013 } 1015 }
1014 // }}} 1016 // }}}
@@ -1031,7 +1033,7 @@ class UpgradeFunctions { @@ -1031,7 +1033,7 @@ class UpgradeFunctions {
1031 1033
1032 $oScheduler = new Scheduler('Indexing'); 1034 $oScheduler = new Scheduler('Indexing');
1033 $oScheduler->setScriptPath(KT_DIR . '/bin/indexingTask.' . $ext); 1035 $oScheduler->setScriptPath(KT_DIR . '/bin/indexingTask.' . $ext);
1034 - $oScheduler->setFrequency('5mins'); 1036 + $oScheduler->setFrequency('1min');
1035 $oScheduler->setFirstRunTime(date('Y-m-d H:i',mktime($hour, $min, 0, $mon, $day, $year))); 1037 $oScheduler->setFirstRunTime(date('Y-m-d H:i',mktime($hour, $min, 0, $mon, $day, $year)));
1036 $oScheduler->registerTask(); 1038 $oScheduler->registerTask();
1037 1039
sql/mysql/install/data.sql
No preview for this file type