Commit 593039b93f48974bcd6c686176218fbdc5994b80

Authored by Paul Barrett
2 parents 374e34bd 8cca3a4f

Merge branch 'edge' of git@github.com:ktgit/knowledgetree into edge

lib/dashboard/Notification.inc.php
@@ -6,31 +6,31 @@ @@ -6,31 +6,31 @@
6 * Document Management Made Simple 6 * Document Management Made Simple
7 * Copyright (C) 2008, 2009 KnowledgeTree Inc. 7 * Copyright (C) 2008, 2009 KnowledgeTree Inc.
8 * Portions copyright The Jam Warehouse Software (Pty) Limited 8 * Portions copyright The Jam Warehouse Software (Pty) Limited
9 - * 9 + *
10 * This program is free software; you can redistribute it and/or modify it under 10 * This program is free software; you can redistribute it and/or modify it under
11 * the terms of the GNU General Public License version 3 as published by the 11 * the terms of the GNU General Public License version 3 as published by the
12 * Free Software Foundation. 12 * Free Software Foundation.
13 - * 13 + *
14 * This program is distributed in the hope that it will be useful, but WITHOUT 14 * This program is distributed in the hope that it will be useful, but WITHOUT
15 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 15 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
16 * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more 16 * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
17 * details. 17 * details.
18 - * 18 + *
19 * You should have received a copy of the GNU General Public License 19 * You should have received a copy of the GNU General Public License
20 * along with this program. If not, see <http://www.gnu.org/licenses/>. 20 * along with this program. If not, see <http://www.gnu.org/licenses/>.
21 - *  
22 - * You can contact KnowledgeTree Inc., PO Box 7775 #87847, San Francisco, 21 + *
  22 + * You can contact KnowledgeTree Inc., PO Box 7775 #87847, San Francisco,
23 * California 94120-7775, or email info@knowledgetree.com. 23 * California 94120-7775, or email info@knowledgetree.com.
24 - * 24 + *
25 * The interactive user interfaces in modified source and object code versions 25 * The interactive user interfaces in modified source and object code versions
26 * of this program must display Appropriate Legal Notices, as required under 26 * of this program must display Appropriate Legal Notices, as required under
27 * Section 5 of the GNU General Public License version 3. 27 * Section 5 of the GNU General Public License version 3.
28 - * 28 + *
29 * In accordance with Section 7(b) of the GNU General Public License version 3, 29 * In accordance with Section 7(b) of the GNU General Public License version 3,
30 * these Appropriate Legal Notices must retain the display of the "Powered by 30 * these Appropriate Legal Notices must retain the display of the "Powered by
31 - * KnowledgeTree" logo and retain the original copyright notice. If the display of the 31 + * KnowledgeTree" logo and retain the original copyright notice. If the display of the
32 * logo is not reasonably feasible for technical reasons, the Appropriate Legal Notices 32 * logo is not reasonably feasible for technical reasons, the Appropriate Legal Notices
33 - * must display the words "Powered by KnowledgeTree" and retain the original 33 + * must display the words "Powered by KnowledgeTree" and retain the original
34 * copyright notice. 34 * copyright notice.
35 * Contributor( s): ______________________________________ 35 * Contributor( s): ______________________________________
36 * 36 *
@@ -200,7 +200,10 @@ class KTSubscriptionNotification extends KTNotificationHandler { @@ -200,7 +200,10 @@ class KTSubscriptionNotification extends KTNotificationHandler {
200 "ModifyDocument" => 'document', 200 "ModifyDocument" => 'document',
201 "CheckInDocument" => 'document', 201 "CheckInDocument" => 'document',
202 "CheckOutDocument" => 'document', 202 "CheckOutDocument" => 'document',
203 - "MovedDocument" => 'document', 203 + "MovedDocument" => 'folder',
  204 + "MovedDocument2" => 'document',
  205 + "CopiedDocument" => 'folder',
  206 + "CopiedDocument2" => 'document',
204 "ArchivedDocument" => 'document', // can go through and request un-archival (?) 207 "ArchivedDocument" => 'document', // can go through and request un-archival (?)
205 "RestoredArchivedDocument" => 'document', 208 "RestoredArchivedDocument" => 'document',
206 "DiscussDocument" => 'document', 209 "DiscussDocument" => 'document',
lib/subscriptions/subscriptions.inc.php
@@ -64,7 +64,9 @@ class SubscriptionEvent { @@ -64,7 +64,9 @@ class SubscriptionEvent {
64 "CheckInDocument", 64 "CheckInDocument",
65 "CheckOutDocument", 65 "CheckOutDocument",
66 "MovedDocument", 66 "MovedDocument",
  67 + "MovedDocument2",
67 "CopiedDocument", 68 "CopiedDocument",
  69 + "CopiedDocument2",
68 "ArchivedDocument", 70 "ArchivedDocument",
69 "RestoredArchivedDocument", 71 "RestoredArchivedDocument",
70 "DownloadDocument", 72 "DownloadDocument",
@@ -364,15 +366,16 @@ class SubscriptionEvent { @@ -364,15 +366,16 @@ class SubscriptionEvent {
364 } 366 }
365 367
366 function MoveDocument($oMovedDocument, $oToFolder, $oFromFolder, $moveOrCopy = "MovedDocument") { 368 function MoveDocument($oMovedDocument, $oToFolder, $oFromFolder, $moveOrCopy = "MovedDocument") {
367 - $content = new SubscriptionContent(); // needed for i18n  
368 - // OK: two actions: document registrants, folder registrants. 369 + $parentId = $oToFolder->getId();
  370 +
  371 + // Document registrants
369 $aDocUsers = $this->_getSubscribers($oMovedDocument->getId(), $this->subscriptionTypes["Document"]); 372 $aDocUsers = $this->_getSubscribers($oMovedDocument->getId(), $this->subscriptionTypes["Document"]);
  373 + $this->sendNotification($aDocUsers, $moveOrCopy.'2', $oMovedDocument->getName(), $oMovedDocument->getId(), $parentId);
  374 +
  375 + // Folder registrants
370 $aFromUsers = $this->_getSubscribers($oFromFolder->getId(), $this->subscriptionTypes["Folder"]); 376 $aFromUsers = $this->_getSubscribers($oFromFolder->getId(), $this->subscriptionTypes["Folder"]);
371 $aFolderUsers = $this->_getSubscribers($oToFolder->getId(), $this->subscriptionTypes["Folder"]); 377 $aFolderUsers = $this->_getSubscribers($oToFolder->getId(), $this->subscriptionTypes["Folder"]);
372 - $aUsers = array_merge($aDocUsers, $aFromUsers);  
373 - $aUsers = array_merge($aUsers, $aFolderUsers);  
374 -  
375 - $parentId = $oToFolder->getId(); 378 + $aUsers = array_merge($aFromUsers, $aFolderUsers);
376 $this->sendNotification($aUsers, $moveOrCopy, $oMovedDocument->getName(), $oToFolder->getId(), $parentId); 379 $this->sendNotification($aUsers, $moveOrCopy, $oMovedDocument->getName(), $oToFolder->getId(), $parentId);
377 } 380 }
378 381
@@ -542,7 +545,9 @@ class SubscriptionContent { @@ -542,7 +545,9 @@ class SubscriptionContent {
542 "CheckInDocument" => _kt('Document checked in'), 545 "CheckInDocument" => _kt('Document checked in'),
543 "CheckOutDocument" => _kt('Document checked out'), 546 "CheckOutDocument" => _kt('Document checked out'),
544 "MovedDocument" => _kt('Document moved'), 547 "MovedDocument" => _kt('Document moved'),
  548 + "MovedDocument2" => _kt('Document moved'),
545 "CopiedDocument" => _kt('Document copied'), 549 "CopiedDocument" => _kt('Document copied'),
  550 + "CopiedDocument2" => _kt('Document copied'),
546 "ArchivedDocument" => _kt('Document archived'), // can go through and request un-archival (?) 551 "ArchivedDocument" => _kt('Document archived'), // can go through and request un-archival (?)
547 "DownloadDocument" => _kt('Document downloaded'), 552 "DownloadDocument" => _kt('Document downloaded'),
548 "RestoredArchivedDocument" => _kt('Document restored'), 553 "RestoredArchivedDocument" => _kt('Document restored'),
@@ -660,6 +665,7 @@ class SubscriptionContent { @@ -660,6 +665,7 @@ class SubscriptionContent {
660 $links .= '&#160;|&#160;<a href="'.$url.'">'._kt('Clear Alert').'</a>'; 665 $links .= '&#160;|&#160;<a href="'.$url.'">'._kt('Clear Alert').'</a>';
661 break; 666 break;
662 case 'MovedDocument': 667 case 'MovedDocument':
  668 + case 'MovedDocument2':
663 $text = $modifyDocumentText; 669 $text = $modifyDocumentText;
664 $url = $rootUrl.'/notify.php?id='.$info['notify_id']; 670 $url = $rootUrl.'/notify.php?id='.$info['notify_id'];
665 if(!$bulk_action) $links = '<a href="'.$url.'">'._kt('View New Location').'</a>'; 671 if(!$bulk_action) $links = '<a href="'.$url.'">'._kt('View New Location').'</a>';
@@ -667,6 +673,7 @@ class SubscriptionContent { @@ -667,6 +673,7 @@ class SubscriptionContent {
667 $links .= '&#160;|&#160;<a href="'.$url.'">'._kt('Clear Alert').'</a>'; 673 $links .= '&#160;|&#160;<a href="'.$url.'">'._kt('Clear Alert').'</a>';
668 break; 674 break;
669 case 'CopiedDocument': 675 case 'CopiedDocument':
  676 + case 'CopiedDocument2':
670 $text = $copiedDocumentText; 677 $text = $copiedDocumentText;
671 $url = $rootUrl.'/notify.php?id='.$info['notify_id']; 678 $url = $rootUrl.'/notify.php?id='.$info['notify_id'];
672 if(!$bulk_action) $links = '<a href="'.$url.'">'._kt('View Document').'</a>'; 679 if(!$bulk_action) $links = '<a href="'.$url.'">'._kt('View Document').'</a>';
@@ -770,8 +777,10 @@ class SubscriptionContent { @@ -770,8 +777,10 @@ class SubscriptionContent {
770 "ModifyDocument" => 'document', 777 "ModifyDocument" => 'document',
771 "CheckInDocument" => 'document', 778 "CheckInDocument" => 'document',
772 "CheckOutDocument" => 'document', 779 "CheckOutDocument" => 'document',
773 - "MovedDocument" => 'document',  
774 - "CopiedDocument" => 'document', 780 + "MovedDocument" => 'folder',
  781 + "MovedDocument2" => 'document',
  782 + "CopiedDocument" => 'folder',
  783 + "CopiedDocument2" => 'document',
775 "ArchivedDocument" => 'document', // can go through and request un-archival (?) 784 "ArchivedDocument" => 'document', // can go through and request un-archival (?)
776 "DownloadDocument" => 'document', 785 "DownloadDocument" => 'document',
777 "RestoredArchivedDocument" => 'document', 786 "RestoredArchivedDocument" => 'document',
setup/wizard/installUtil.php
@@ -312,6 +312,59 @@ class InstallUtil { @@ -312,6 +312,59 @@ class InstallUtil {
312 return true; 312 return true;
313 } 313 }
314 314
  315 + public function javaBridge() {
  316 + try {
  317 + $javaSystem = new Java('java.lang.System');
  318 + } catch (JavaException $e) {
  319 + return false;
  320 + }
  321 + return true;
  322 + }
  323 +
  324 + function tryJava1() {
  325 + $response = $this->pexec("java -version"); // Java Runtime Check
  326 + if(empty($response['out'])) {
  327 + return false;
  328 + }
  329 +
  330 + return array('response'=>$response, 'java'=>'java');
  331 + }
  332 +
  333 + function tryJava2() {
  334 + $response = $this->pexec("java"); // Java Runtime Check
  335 + if(empty($response['out'])) {
  336 + return false;
  337 + }
  338 +
  339 + return array('response'=>$response, 'java'=>'java');
  340 + }
  341 +
  342 + function tryJava3() {
  343 + $response = $this->pexec("whereis java"); // Java Runtime Check
  344 + if(empty($response['out'])) {
  345 + return false;
  346 + }
  347 + $broke = explode(' ', $response['out'][0]);
  348 + foreach ($broke as $r) {
  349 + $match = preg_match('/bin/', $r);
  350 + if($match) {
  351 + return array('response'=>$response, 'java'=>preg_replace('/java:/', '', $r));
  352 + }
  353 + }
  354 + }
  355 +
  356 + function getJava() {
  357 + $response = $this->tryJava1();
  358 + if(!is_array($response)) {
  359 + $response = $this->tryJava2();
  360 + if(!is_array($response)) {
  361 + $response = $this->tryJava3();
  362 + }
  363 + }
  364 +
  365 + return $response;
  366 + }
  367 +
315 /** 368 /**
316 * Portably execute a command on any of the supported platforms. 369 * Portably execute a command on any of the supported platforms.
317 * 370 *
setup/wizard/lib/services/unixLucene.php
@@ -40,7 +40,8 @@ @@ -40,7 +40,8 @@
40 * @version Version 0.1 40 * @version Version 0.1
41 */ 41 */
42 42
43 -class unixLucene extends Service { 43 +class unixLucene extends unixService {
  44 + public $util;
44 private $phpDir; 45 private $phpDir;
45 private $shutdownScript; 46 private $shutdownScript;
46 private $indexerDir; 47 private $indexerDir;
@@ -53,6 +54,7 @@ class unixLucene extends Service { @@ -53,6 +54,7 @@ class unixLucene extends Service {
53 54
54 public function __construct() { 55 public function __construct() {
55 $this->name = "KTLuceneTest"; 56 $this->name = "KTLuceneTest";
  57 + $this->util = new InstallUtil();
56 } 58 }
57 59
58 function load() { 60 function load() {
@@ -63,7 +65,7 @@ class unixLucene extends Service { @@ -63,7 +65,7 @@ class unixLucene extends Service {
63 $this->setJavaXmx(512); 65 $this->setJavaXmx(512);
64 $this->setLuceneSource("ktlucene.jar"); 66 $this->setLuceneSource("ktlucene.jar");
65 $this->setLuceneSourceLoc("ktlucene.jar"); 67 $this->setLuceneSourceLoc("ktlucene.jar");
66 - $this->setPhpDir(); 68 +// $this->setPhpDir();
67 $this->setShutdownScript("shutdown.php"); 69 $this->setShutdownScript("shutdown.php");
68 } 70 }
69 71
@@ -170,7 +172,7 @@ class unixLucene extends Service { @@ -170,7 +172,7 @@ class unixLucene extends Service {
170 } 172 }
171 173
172 public function install() { 174 public function install() {
173 - 175 + $this->start();
174 } 176 }
175 177
176 public function status() { 178 public function status() {
@@ -200,7 +202,7 @@ class unixLucene extends Service { @@ -200,7 +202,7 @@ class unixLucene extends Service {
200 $state = $this->status(); 202 $state = $this->status();
201 if($state != 'STARTED') { 203 if($state != 'STARTED') {
202 $cmd = "cd ".$this->getLuceneDir()."; "; 204 $cmd = "cd ".$this->getLuceneDir()."; ";
203 - $cmd .= "nohup java -jar ".$this->getLuceneSource()." &> ".SYS_LOG_DIR."lucene.log &"; 205 + $cmd .= "nohup java -jar ".$this->getLuceneSource()." > ".SYS_LOG_DIR."lucene.log 2>&1 & echo $!";
204 $response = $this->util->pexec($cmd); 206 $response = $this->util->pexec($cmd);
205 207
206 return $response; 208 return $response;
setup/wizard/lib/services/unixScheduler.php
@@ -40,9 +40,8 @@ @@ -40,9 +40,8 @@
40 * @version Version 0.1 40 * @version Version 0.1
41 */ 41 */
42 42
43 -class unixScheduler extends Service { 43 +class unixScheduler extends unixService {
44 private $phpDir; 44 private $phpDir;
45 - private $schedulerPidFile;  
46 private $schedulerDir; 45 private $schedulerDir;
47 private $schedulerSource; 46 private $schedulerSource;
48 private $schedulerSourceLoc; 47 private $schedulerSourceLoc;
@@ -50,6 +49,7 @@ class unixScheduler extends Service { @@ -50,6 +49,7 @@ class unixScheduler extends Service {
50 49
51 public function __construct() { 50 public function __construct() {
52 $this->name = "KTSchedulerTest"; 51 $this->name = "KTSchedulerTest";
  52 + $this->util = new InstallUtil();
53 } 53 }
54 54
55 function load() { 55 function load() {
@@ -57,15 +57,6 @@ class unixScheduler extends Service { @@ -57,15 +57,6 @@ class unixScheduler extends Service {
57 $this->setSchedulerDir(SYSTEM_DIR."bin".DS); 57 $this->setSchedulerDir(SYSTEM_DIR."bin".DS);
58 $this->setSchedulerSource('schedulerTask.sh'); 58 $this->setSchedulerSource('schedulerTask.sh');
59 $this->setSchedulerSourceLoc('schedulerTask.sh'); 59 $this->setSchedulerSourceLoc('schedulerTask.sh');
60 - $this->setSchedulerPidFile("scheduler_test.pid");  
61 - }  
62 -  
63 - private function setSchedulerPidFile($schedulerPidFile) {  
64 - $this->schedulerPidFile = $schedulerPidFile;  
65 - }  
66 -  
67 - private function getSchedulerPidFile() {  
68 - return $this->schedulerPidFile;  
69 } 60 }
70 61
71 function setSystemDir($systemDir) { 62 function setSystemDir($systemDir) {
@@ -109,7 +100,8 @@ class unixScheduler extends Service { @@ -109,7 +100,8 @@ class unixScheduler extends Service {
109 $content = "#!/bin/sh\n"; 100 $content = "#!/bin/sh\n";
110 $content .= "cd ".$this->getSchedulerDir()."\n"; 101 $content .= "cd ".$this->getSchedulerDir()."\n";
111 $content .= "while true; do\n"; 102 $content .= "while true; do\n";
112 - $content .= "php "."\"{$this->getSchedulerDir()}{$this->getSchedulerSource()}\""; 103 + // TODO : This will not work without CLI
  104 + $content .= "php -Cq scheduler.php\n";
113 $content .= "sleep 30\n"; 105 $content .= "sleep 30\n";
114 $content .= "done"; 106 $content .= "done";
115 fwrite($fp, $content); 107 fwrite($fp, $content);
@@ -117,7 +109,7 @@ class unixScheduler extends Service { @@ -117,7 +109,7 @@ class unixScheduler extends Service {
117 } 109 }
118 110
119 function install() { 111 function install() {
120 - 112 + $this->start();
121 } 113 }
122 114
123 function uninstall() { 115 function uninstall() {
@@ -151,18 +143,22 @@ class unixScheduler extends Service { @@ -151,18 +143,22 @@ class unixScheduler extends Service {
151 143
152 function start() { 144 function start() {
153 $source = $this->getSchedulerSourceLoc(); 145 $source = $this->getSchedulerSourceLoc();
154 - if($source) {  
155 - $cmd = "nohup ".$source." &> ".SYS_LOG_DIR."dmsctl.log"; 146 + if($source) { // Source
  147 + $cmd = "nohup ".$source." > ".SYS_LOG_DIR."scheduler.log 2>&1 & echo $!";
156 $response = $this->util->pexec($cmd); 148 $response = $this->util->pexec($cmd);
157 return $response; 149 return $response;
158 } else { // Could be Stack 150 } else { // Could be Stack
159 - $source = $this->getSystemDir().$this->schedulerSource; 151 + $source = SYS_BIN_DIR.$this->schedulerSource;
160 if(file_exists($source)) { 152 if(file_exists($source)) {
161 - $cmd = "nohup ".$source." &> ".SYS_LOG_DIR."dmsctl.log"; 153 + $cmd = "nohup ".$source." > ".SYS_LOG_DIR."scheduler.log 2>&1 & echo $!";
162 $response = $this->util->pexec($cmd); 154 $response = $this->util->pexec($cmd);
163 return $response; 155 return $response;
  156 + } else {
  157 + // Write it
  158 + $this->writeSchedulerTask();
164 } 159 }
165 } 160 }
  161 +
166 return false; 162 return false;
167 } 163 }
168 164
setup/wizard/lib/services/unixService.php
@@ -40,7 +40,7 @@ @@ -40,7 +40,7 @@
40 * @version Version 0.1 40 * @version Version 0.1
41 */ 41 */
42 42
43 -class windowsService extends Service { 43 +class unixService extends Service {
44 /** 44 /**
45 * Retrieve Service name 45 * Retrieve Service name
46 * 46 *
setup/wizard/step.php
@@ -349,6 +349,18 @@ class Step @@ -349,6 +349,18 @@ class Step
349 return ''; 349 return '';
350 } 350 }
351 351
  352 + /**
  353 + * Return whether or not to a step has to be in silent mode
  354 + *
  355 + * @author KnowledgeTree Team
  356 + * @param none
  357 + * @access public
  358 + * @return boolean
  359 + */
  360 + public function silentMode() {
  361 + return $this->silent;
  362 + }
  363 +
352 /** 364 /**
353 * Set step errors 365 * Set step errors
354 * 366 *
setup/wizard/steps/services.php
@@ -49,7 +49,7 @@ class services extends Step @@ -49,7 +49,7 @@ class services extends Step
49 * @access public 49 * @access public
50 * @var array 50 * @var array
51 */ 51 */
52 - public $error = array(); 52 + protected $error = array();
53 53
54 /** 54 /**
55 * Flag if step needs to be installed 55 * Flag if step needs to be installed
@@ -60,13 +60,13 @@ class services extends Step @@ -60,13 +60,13 @@ class services extends Step
60 */ 60 */
61 protected $runInstall = true; 61 protected $runInstall = true;
62 62
63 - protected $services = array('Lucene', 'Scheduler'); 63 + private $services = array('Lucene', 'Scheduler');
64 64
65 protected $java; 65 protected $java;
66 66
67 protected $util; 67 protected $util;
68 68
69 - protected $response; 69 + private $response;
70 70
71 private $javaVersion = '1.5'; 71 private $javaVersion = '1.5';
72 72
@@ -79,7 +79,7 @@ class services extends Step @@ -79,7 +79,7 @@ class services extends Step
79 */ 79 */
80 protected $storeInSession = false; 80 protected $storeInSession = false;
81 81
82 - public $temp_variables; 82 + protected $temp_variables;
83 83
84 /** 84 /**
85 * Constructs services object 85 * Constructs services object
@@ -91,54 +91,9 @@ class services extends Step @@ -91,54 +91,9 @@ class services extends Step
91 public function __construct() { 91 public function __construct() {
92 $this->temp_variables = array("step_name"=>"services"); 92 $this->temp_variables = array("step_name"=>"services");
93 $this->util = new InstallUtil(); 93 $this->util = new InstallUtil();
94 - $this->setJava();  
95 } 94 }
96 95
97 - function tryJava1() {  
98 - $response = $this->util->pexec("java -version"); // Java Runtime Check  
99 - if(empty($response['out'])) {  
100 - return false;  
101 - }  
102 - $this->java = 'java';  
103 - $this->response = $response;  
104 - return true;  
105 - }  
106 -  
107 - function tryJava2() {  
108 - $response = $this->util->pexec("java"); // Java Runtime Check  
109 - if(empty($response['out'])) {  
110 - return false;  
111 - }  
112 - $this->java = 'java';  
113 - $this->response = $response;  
114 - return true;  
115 - }  
116 -  
117 - function tryJava3() {  
118 - $response = $this->util->pexec("whereis java"); // Java Runtime Check  
119 - if(empty($response['out'])) {  
120 - return false;  
121 - }  
122 - $broke = explode(' ', $response['out'][0]);  
123 - foreach ($broke as $r) {  
124 - $match = preg_match('/bin/', $r);  
125 - if($match) {  
126 - $this->java = preg_replace('/java:/', '', $r);  
127 - $this->response = $response;  
128 - return true;  
129 - }  
130 - }  
131 - }  
132 -  
133 - function setJava() {  
134 - $response = $this->tryJava1();  
135 - if(!$response) {  
136 - $response = $this->tryJava2();  
137 - if(!$response) {  
138 - $response = $this->tryJava3();  
139 - }  
140 - }  
141 - } 96 +
142 97
143 function getJavaResponse() { 98 function getJavaResponse() {
144 return $this->response; 99 return $this->response;
@@ -180,8 +135,15 @@ class services extends Step @@ -180,8 +135,15 @@ class services extends Step
180 * @return boolean 135 * @return boolean
181 */ 136 */
182 private function doRun() { 137 private function doRun() {
  138 + $javaSettings = $this->util->getJava();
  139 + $this->response = $javaSettings['response'];
  140 + $this->java = $javaSettings['java'];
183 if($this->javaChecks()) { 141 if($this->javaChecks()) {
184 $this->installService(); 142 $this->installService();
  143 + } else { // Services not installed
  144 + foreach ($this->services as $serviceName) {
  145 + $this->temp_variables['services'][] = array('class'=>'cross', 'msg'=>$serviceName." Could not be added as a Service");
  146 + }
185 } 147 }
186 $errors = $this->getErrors(); 148 $errors = $this->getErrors();
187 if(!empty($errors)) 149 if(!empty($errors))
@@ -192,10 +154,12 @@ class services extends Step @@ -192,10 +154,12 @@ class services extends Step
192 public function javaChecks() { 154 public function javaChecks() {
193 $java = false; 155 $java = false;
194 $mods = get_loaded_extensions(); 156 $mods = get_loaded_extensions();
  157 + $mods = array_reverse($mods);
195 foreach ($mods as $k=>$v) { 158 foreach ($mods as $k=>$v) {
196 if($v == 'Zend Java Bridge') { 159 if($v == 'Zend Java Bridge') {
197 $java = true; 160 $java = true;
198 } 161 }
  162 + if($java) break;
199 } 163 }
200 if($java) { 164 if($java) {
201 $this->temp_variables['extensions']['class'] = 'tick'; 165 $this->temp_variables['extensions']['class'] = 'tick';
@@ -203,31 +167,35 @@ class services extends Step @@ -203,31 +167,35 @@ class services extends Step
203 } else { 167 } else {
204 $this->temp_variables['extensions']['class'] = 'cross'; 168 $this->temp_variables['extensions']['class'] = 'cross';
205 $this->temp_variables['extensions']['found'] = "Zend Java Bridge Required"; 169 $this->temp_variables['extensions']['found'] = "Zend Java Bridge Required";
  170 + $this->error[] = "Zend Java Bridge Required";
206 } 171 }
207 if($this->java == '') { 172 if($this->java == '') {
208 $this->temp_variables['version']['class'] = 'cross'; 173 $this->temp_variables['version']['class'] = 'cross';
209 $this->temp_variables['version']['found'] = "Java runtime environment required"; 174 $this->temp_variables['version']['found'] = "Java runtime environment required";
  175 + $this->error[] = "Java runtime environment required";
210 } else { 176 } else {
211 $this->temp_variables['java']['class'] = 'tick'; 177 $this->temp_variables['java']['class'] = 'tick';
212 $this->temp_variables['java']['found'] = "Java Runtime Installed"; 178 $this->temp_variables['java']['found'] = "Java Runtime Installed";
213 } 179 }
214 - if($java) {  
215 - $javaSystem = new Java('java.lang.System'); 180 + if($this->util->javaBridge()) { // Check if java bridge is functional
  181 + $javaSystem = new Java('java.lang.System');
216 $version = $javaSystem->getProperty('java.version'); 182 $version = $javaSystem->getProperty('java.version');
217 $ver = substr($version, 0, 3); 183 $ver = substr($version, 0, 3);
218 if($ver < $this->javaVersion) { 184 if($ver < $this->javaVersion) {
219 $this->temp_variables['version']['class'] = 'cross'; 185 $this->temp_variables['version']['class'] = 'cross';
220 $this->temp_variables['version']['found'] = "Requires Java 1.5+ to be installed"; 186 $this->temp_variables['version']['found'] = "Requires Java 1.5+ to be installed";
  187 + $this->error[] = "Requires Java 1.5+ to be installed";
221 } else { 188 } else {
222 $this->temp_variables['version']['class'] = 'tick'; 189 $this->temp_variables['version']['class'] = 'tick';
223 $this->temp_variables['version']['found'] = "Java Version 1.5+ Installed"; 190 $this->temp_variables['version']['found'] = "Java Version 1.5+ Installed";
224 } 191 }
225 } else { 192 } else {
226 - $this->temp_variables['version']['class'] = 'cross'; 193 + $this->temp_variables['version']['class'] = 'cross';
227 $this->temp_variables['version']['found'] = "Cannot detect Java system settings"; 194 $this->temp_variables['version']['found'] = "Cannot detect Java system settings";
  195 + $this->error[] = "Cannot detect Java system settings";
228 return false; 196 return false;
229 } 197 }
230 - 198 +
231 return true; 199 return true;
232 } 200 }
233 /** 201 /**
setup/wizard/templates/services.tpl
@@ -4,15 +4,6 @@ @@ -4,15 +4,6 @@
4 This checkup ensures that your environment is ready to support KnowledgeTree's background services. 4 This checkup ensures that your environment is ready to support KnowledgeTree's background services.
5 </p> 5 </p>
6 6
7 -<?php  
8 -if($errors){  
9 - echo '<div class="error">';  
10 - foreach ($errors as $msg){  
11 - echo $msg . "<br />\n";  
12 - }  
13 - echo '</div>';  
14 -}  
15 -?>  
16 <h3>Java Version Check</h3> 7 <h3>Java Version Check</h3>
17 <p class="description"> 8 <p class="description">
18 The Java version must be higher than 1.5. 9 The Java version must be higher than 1.5.