diff --git a/lib/dashboard/Notification.inc.php b/lib/dashboard/Notification.inc.php index 5fdb893..8644d02 100644 --- a/lib/dashboard/Notification.inc.php +++ b/lib/dashboard/Notification.inc.php @@ -6,31 +6,31 @@ * Document Management Made Simple * Copyright (C) 2008, 2009 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): ______________________________________ * @@ -200,7 +200,10 @@ class KTSubscriptionNotification extends KTNotificationHandler { "ModifyDocument" => 'document', "CheckInDocument" => 'document', "CheckOutDocument" => 'document', - "MovedDocument" => 'document', + "MovedDocument" => 'folder', + "MovedDocument2" => 'document', + "CopiedDocument" => 'folder', + "CopiedDocument2" => 'document', "ArchivedDocument" => 'document', // can go through and request un-archival (?) "RestoredArchivedDocument" => 'document', "DiscussDocument" => 'document', diff --git a/lib/subscriptions/subscriptions.inc.php b/lib/subscriptions/subscriptions.inc.php index 1f24add..3306b35 100644 --- a/lib/subscriptions/subscriptions.inc.php +++ b/lib/subscriptions/subscriptions.inc.php @@ -64,7 +64,9 @@ class SubscriptionEvent { "CheckInDocument", "CheckOutDocument", "MovedDocument", + "MovedDocument2", "CopiedDocument", + "CopiedDocument2", "ArchivedDocument", "RestoredArchivedDocument", "DownloadDocument", @@ -364,15 +366,16 @@ class SubscriptionEvent { } function MoveDocument($oMovedDocument, $oToFolder, $oFromFolder, $moveOrCopy = "MovedDocument") { - $content = new SubscriptionContent(); // needed for i18n - // OK: two actions: document registrants, folder registrants. + $parentId = $oToFolder->getId(); + + // Document registrants $aDocUsers = $this->_getSubscribers($oMovedDocument->getId(), $this->subscriptionTypes["Document"]); + $this->sendNotification($aDocUsers, $moveOrCopy.'2', $oMovedDocument->getName(), $oMovedDocument->getId(), $parentId); + + // Folder registrants $aFromUsers = $this->_getSubscribers($oFromFolder->getId(), $this->subscriptionTypes["Folder"]); $aFolderUsers = $this->_getSubscribers($oToFolder->getId(), $this->subscriptionTypes["Folder"]); - $aUsers = array_merge($aDocUsers, $aFromUsers); - $aUsers = array_merge($aUsers, $aFolderUsers); - - $parentId = $oToFolder->getId(); + $aUsers = array_merge($aFromUsers, $aFolderUsers); $this->sendNotification($aUsers, $moveOrCopy, $oMovedDocument->getName(), $oToFolder->getId(), $parentId); } @@ -542,7 +545,9 @@ class SubscriptionContent { "CheckInDocument" => _kt('Document checked in'), "CheckOutDocument" => _kt('Document checked out'), "MovedDocument" => _kt('Document moved'), + "MovedDocument2" => _kt('Document moved'), "CopiedDocument" => _kt('Document copied'), + "CopiedDocument2" => _kt('Document copied'), "ArchivedDocument" => _kt('Document archived'), // can go through and request un-archival (?) "DownloadDocument" => _kt('Document downloaded'), "RestoredArchivedDocument" => _kt('Document restored'), @@ -660,6 +665,7 @@ class SubscriptionContent { $links .= ' | '._kt('Clear Alert').''; break; case 'MovedDocument': + case 'MovedDocument2': $text = $modifyDocumentText; $url = $rootUrl.'/notify.php?id='.$info['notify_id']; if(!$bulk_action) $links = ''._kt('View New Location').''; @@ -667,6 +673,7 @@ class SubscriptionContent { $links .= ' | '._kt('Clear Alert').''; break; case 'CopiedDocument': + case 'CopiedDocument2': $text = $copiedDocumentText; $url = $rootUrl.'/notify.php?id='.$info['notify_id']; if(!$bulk_action) $links = ''._kt('View Document').''; @@ -770,8 +777,10 @@ class SubscriptionContent { "ModifyDocument" => 'document', "CheckInDocument" => 'document', "CheckOutDocument" => 'document', - "MovedDocument" => 'document', - "CopiedDocument" => 'document', + "MovedDocument" => 'folder', + "MovedDocument2" => 'document', + "CopiedDocument" => 'folder', + "CopiedDocument2" => 'document', "ArchivedDocument" => 'document', // can go through and request un-archival (?) "DownloadDocument" => 'document', "RestoredArchivedDocument" => 'document', diff --git a/setup/wizard/installUtil.php b/setup/wizard/installUtil.php index a3baf8d..eefa6a3 100644 --- a/setup/wizard/installUtil.php +++ b/setup/wizard/installUtil.php @@ -312,6 +312,59 @@ class InstallUtil { return true; } + public function javaBridge() { + try { + $javaSystem = new Java('java.lang.System'); + } catch (JavaException $e) { + return false; + } + return true; + } + + function tryJava1() { + $response = $this->pexec("java -version"); // Java Runtime Check + if(empty($response['out'])) { + return false; + } + + return array('response'=>$response, 'java'=>'java'); + } + + function tryJava2() { + $response = $this->pexec("java"); // Java Runtime Check + if(empty($response['out'])) { + return false; + } + + return array('response'=>$response, 'java'=>'java'); + } + + function tryJava3() { + $response = $this->pexec("whereis java"); // Java Runtime Check + if(empty($response['out'])) { + return false; + } + $broke = explode(' ', $response['out'][0]); + foreach ($broke as $r) { + $match = preg_match('/bin/', $r); + if($match) { + return array('response'=>$response, 'java'=>preg_replace('/java:/', '', $r)); + } + } + } + + function getJava() { + $response = $this->tryJava1(); + if(!is_array($response)) { + $response = $this->tryJava2(); + if(!is_array($response)) { + $response = $this->tryJava3(); + } + } + + return $response; + } + /** * Portably execute a command on any of the supported platforms. * diff --git a/setup/wizard/lib/services/unixLucene.php b/setup/wizard/lib/services/unixLucene.php index 0528897..da84b5c 100644 --- a/setup/wizard/lib/services/unixLucene.php +++ b/setup/wizard/lib/services/unixLucene.php @@ -40,7 +40,8 @@ * @version Version 0.1 */ -class unixLucene extends Service { +class unixLucene extends unixService { + public $util; private $phpDir; private $shutdownScript; private $indexerDir; @@ -53,6 +54,7 @@ class unixLucene extends Service { public function __construct() { $this->name = "KTLuceneTest"; + $this->util = new InstallUtil(); } function load() { @@ -63,7 +65,7 @@ class unixLucene extends Service { $this->setJavaXmx(512); $this->setLuceneSource("ktlucene.jar"); $this->setLuceneSourceLoc("ktlucene.jar"); - $this->setPhpDir(); +// $this->setPhpDir(); $this->setShutdownScript("shutdown.php"); } @@ -170,7 +172,7 @@ class unixLucene extends Service { } public function install() { - + $this->start(); } public function status() { @@ -200,7 +202,7 @@ class unixLucene extends Service { $state = $this->status(); if($state != 'STARTED') { $cmd = "cd ".$this->getLuceneDir()."; "; - $cmd .= "nohup java -jar ".$this->getLuceneSource()." &> ".SYS_LOG_DIR."lucene.log &"; + $cmd .= "nohup java -jar ".$this->getLuceneSource()." > ".SYS_LOG_DIR."lucene.log 2>&1 & echo $!"; $response = $this->util->pexec($cmd); return $response; diff --git a/setup/wizard/lib/services/unixScheduler.php b/setup/wizard/lib/services/unixScheduler.php index 8475051..e1840b0 100644 --- a/setup/wizard/lib/services/unixScheduler.php +++ b/setup/wizard/lib/services/unixScheduler.php @@ -40,9 +40,8 @@ * @version Version 0.1 */ -class unixScheduler extends Service { +class unixScheduler extends unixService { private $phpDir; - private $schedulerPidFile; private $schedulerDir; private $schedulerSource; private $schedulerSourceLoc; @@ -50,6 +49,7 @@ class unixScheduler extends Service { public function __construct() { $this->name = "KTSchedulerTest"; + $this->util = new InstallUtil(); } function load() { @@ -57,15 +57,6 @@ class unixScheduler extends Service { $this->setSchedulerDir(SYSTEM_DIR."bin".DS); $this->setSchedulerSource('schedulerTask.sh'); $this->setSchedulerSourceLoc('schedulerTask.sh'); - $this->setSchedulerPidFile("scheduler_test.pid"); - } - - private function setSchedulerPidFile($schedulerPidFile) { - $this->schedulerPidFile = $schedulerPidFile; - } - - private function getSchedulerPidFile() { - return $this->schedulerPidFile; } function setSystemDir($systemDir) { @@ -109,7 +100,8 @@ class unixScheduler extends Service { $content = "#!/bin/sh\n"; $content .= "cd ".$this->getSchedulerDir()."\n"; $content .= "while true; do\n"; - $content .= "php "."\"{$this->getSchedulerDir()}{$this->getSchedulerSource()}\""; + // TODO : This will not work without CLI + $content .= "php -Cq scheduler.php\n"; $content .= "sleep 30\n"; $content .= "done"; fwrite($fp, $content); @@ -117,7 +109,7 @@ class unixScheduler extends Service { } function install() { - + $this->start(); } function uninstall() { @@ -151,18 +143,22 @@ class unixScheduler extends Service { function start() { $source = $this->getSchedulerSourceLoc(); - if($source) { - $cmd = "nohup ".$source." &> ".SYS_LOG_DIR."dmsctl.log"; + if($source) { // Source + $cmd = "nohup ".$source." > ".SYS_LOG_DIR."scheduler.log 2>&1 & echo $!"; $response = $this->util->pexec($cmd); return $response; } else { // Could be Stack - $source = $this->getSystemDir().$this->schedulerSource; + $source = SYS_BIN_DIR.$this->schedulerSource; if(file_exists($source)) { - $cmd = "nohup ".$source." &> ".SYS_LOG_DIR."dmsctl.log"; + $cmd = "nohup ".$source." > ".SYS_LOG_DIR."scheduler.log 2>&1 & echo $!"; $response = $this->util->pexec($cmd); return $response; + } else { + // Write it + $this->writeSchedulerTask(); } } + return false; } diff --git a/setup/wizard/lib/services/unixService.php b/setup/wizard/lib/services/unixService.php index 98e478e..02ddce4 100644 --- a/setup/wizard/lib/services/unixService.php +++ b/setup/wizard/lib/services/unixService.php @@ -40,7 +40,7 @@ * @version Version 0.1 */ -class windowsService extends Service { +class unixService extends Service { /** * Retrieve Service name * diff --git a/setup/wizard/step.php b/setup/wizard/step.php index a7b23f0..c516647 100644 --- a/setup/wizard/step.php +++ b/setup/wizard/step.php @@ -349,6 +349,18 @@ class Step return ''; } + /** + * Return whether or not to a step has to be in silent mode + * + * @author KnowledgeTree Team + * @param none + * @access public + * @return boolean + */ + public function silentMode() { + return $this->silent; + } + /** * Set step errors * diff --git a/setup/wizard/steps/services.php b/setup/wizard/steps/services.php index 0b58427..dab0535 100644 --- a/setup/wizard/steps/services.php +++ b/setup/wizard/steps/services.php @@ -49,7 +49,7 @@ class services extends Step * @access public * @var array */ - public $error = array(); + protected $error = array(); /** * Flag if step needs to be installed @@ -60,13 +60,13 @@ class services extends Step */ protected $runInstall = true; - protected $services = array('Lucene', 'Scheduler'); + private $services = array('Lucene', 'Scheduler'); protected $java; protected $util; - protected $response; + private $response; private $javaVersion = '1.5'; @@ -79,7 +79,7 @@ class services extends Step */ protected $storeInSession = false; - public $temp_variables; + protected $temp_variables; /** * Constructs services object @@ -91,54 +91,9 @@ class services extends Step public function __construct() { $this->temp_variables = array("step_name"=>"services"); $this->util = new InstallUtil(); - $this->setJava(); } - function tryJava1() { - $response = $this->util->pexec("java -version"); // Java Runtime Check - if(empty($response['out'])) { - return false; - } - $this->java = 'java'; - $this->response = $response; - return true; - } - - function tryJava2() { - $response = $this->util->pexec("java"); // Java Runtime Check - if(empty($response['out'])) { - return false; - } - $this->java = 'java'; - $this->response = $response; - return true; - } - - function tryJava3() { - $response = $this->util->pexec("whereis java"); // Java Runtime Check - if(empty($response['out'])) { - return false; - } - $broke = explode(' ', $response['out'][0]); - foreach ($broke as $r) { - $match = preg_match('/bin/', $r); - if($match) { - $this->java = preg_replace('/java:/', '', $r); - $this->response = $response; - return true; - } - } - } - - function setJava() { - $response = $this->tryJava1(); - if(!$response) { - $response = $this->tryJava2(); - if(!$response) { - $response = $this->tryJava3(); - } - } - } + function getJavaResponse() { return $this->response; @@ -180,8 +135,15 @@ class services extends Step * @return boolean */ private function doRun() { + $javaSettings = $this->util->getJava(); + $this->response = $javaSettings['response']; + $this->java = $javaSettings['java']; if($this->javaChecks()) { $this->installService(); + } else { // Services not installed + foreach ($this->services as $serviceName) { + $this->temp_variables['services'][] = array('class'=>'cross', 'msg'=>$serviceName." Could not be added as a Service"); + } } $errors = $this->getErrors(); if(!empty($errors)) @@ -192,10 +154,12 @@ class services extends Step public function javaChecks() { $java = false; $mods = get_loaded_extensions(); + $mods = array_reverse($mods); foreach ($mods as $k=>$v) { if($v == 'Zend Java Bridge') { $java = true; } + if($java) break; } if($java) { $this->temp_variables['extensions']['class'] = 'tick'; @@ -203,31 +167,35 @@ class services extends Step } else { $this->temp_variables['extensions']['class'] = 'cross'; $this->temp_variables['extensions']['found'] = "Zend Java Bridge Required"; + $this->error[] = "Zend Java Bridge Required"; } if($this->java == '') { $this->temp_variables['version']['class'] = 'cross'; $this->temp_variables['version']['found'] = "Java runtime environment required"; + $this->error[] = "Java runtime environment required"; } else { $this->temp_variables['java']['class'] = 'tick'; $this->temp_variables['java']['found'] = "Java Runtime Installed"; } - if($java) { - $javaSystem = new Java('java.lang.System'); + if($this->util->javaBridge()) { // Check if java bridge is functional + $javaSystem = new Java('java.lang.System'); $version = $javaSystem->getProperty('java.version'); $ver = substr($version, 0, 3); if($ver < $this->javaVersion) { $this->temp_variables['version']['class'] = 'cross'; $this->temp_variables['version']['found'] = "Requires Java 1.5+ to be installed"; + $this->error[] = "Requires Java 1.5+ to be installed"; } else { $this->temp_variables['version']['class'] = 'tick'; $this->temp_variables['version']['found'] = "Java Version 1.5+ Installed"; } } else { - $this->temp_variables['version']['class'] = 'cross'; + $this->temp_variables['version']['class'] = 'cross'; $this->temp_variables['version']['found'] = "Cannot detect Java system settings"; + $this->error[] = "Cannot detect Java system settings"; return false; } - + return true; } /** diff --git a/setup/wizard/templates/services.tpl b/setup/wizard/templates/services.tpl index 7aceeaf..8aadf40 100644 --- a/setup/wizard/templates/services.tpl +++ b/setup/wizard/templates/services.tpl @@ -4,15 +4,6 @@ This checkup ensures that your environment is ready to support KnowledgeTree's background services.

-'; - foreach ($errors as $msg){ - echo $msg . "
\n"; - } - echo ''; -} -?>

Java Version Check

The Java version must be higher than 1.5.