Commit 111ecc5689e7d0e98a0b6ae0866cc89df654eb4f
1 parent
4c2facdd
Lock Files moved to central location, Service validation removed, Service auto start removed
Committed by: Jarrett Jordaan Reviewed by: Paul Barrett
Showing
21 changed files
with
444 additions
and
82 deletions
dmsctl.sh
0 → 100755
| 1 | +#!/bin/sh | |
| 2 | + | |
| 3 | +# Boot KnowledgeTree services | |
| 4 | +# chkconfig: 2345 55 25 | |
| 5 | +# description: KnowledgeTree Services | |
| 6 | +# | |
| 7 | +# processname: ktdms | |
| 8 | + | |
| 9 | +HOSTNAME=`hostname` | |
| 10 | +RETVAL=0 | |
| 11 | +PID="" | |
| 12 | +ERROR=0 | |
| 13 | +SERVER=all | |
| 14 | +VDISPLAY="99" | |
| 15 | +INSTALL_PATH=`pwd` | |
| 16 | +JAVABIN=/usr/bin/java | |
| 17 | +ZEND_DIR=/usr/local/zend | |
| 18 | + | |
| 19 | +# OpenOffice | |
| 20 | +SOFFICEFILE=soffice | |
| 21 | +SOFFICE_PIDFILE=$INSTALL_PATH/var/log/soffice.bin.pid | |
| 22 | +SOFFICE_PID="" | |
| 23 | +SOFFICE_PORT="8100" | |
| 24 | +SOFFICEBIN=/usr/bin/soffice | |
| 25 | +SOFFICE="$SOFFICEBIN -nofirststartwizard -nologo -headless -accept=socket,host=127.0.0.1,port=$SOFFICE_PORT;urp;StarOffice.ServiceManager" | |
| 26 | +SOFFICE_STATUS="" | |
| 27 | + | |
| 28 | +# Lucene | |
| 29 | +LUCENE_PIDFILE=$INSTALL_PATH/var/log/lucene.pid | |
| 30 | +LUCENE_PID="" | |
| 31 | +LUCENE="$JAVABIN -Xms512M -Xmx512M -jar ktlucene.jar" | |
| 32 | +LUCENE_STATUS="" | |
| 33 | + | |
| 34 | +# Scheduler | |
| 35 | +SCHEDULER_PATH="$INSTALL_PATH/bin/" | |
| 36 | +SCHEDULER_PIDFILE=$INSTALL_PATH/var/log/scheduler.pid | |
| 37 | +SCHEDULER_PID="" | |
| 38 | +SCHEDULERBIN="$INSTALL_PATH/var/bin/schedulerTask.sh" | |
| 39 | +SCHEDULER="$SCHEDULERBIN" | |
| 40 | +SCHEDULER_STATUS="" | |
| 41 | + | |
| 42 | +get_pid() { | |
| 43 | + PID="" | |
| 44 | + PIDFILE=$1 | |
| 45 | + # check for pidfile | |
| 46 | + if [ -f $PIDFILE ] ; then | |
| 47 | + exec 6<&0 | |
| 48 | + exec < $PIDFILE | |
| 49 | + read pid | |
| 50 | + PID=$pid | |
| 51 | + exec 0<&6 6<&- | |
| 52 | + fi | |
| 53 | +} | |
| 54 | + | |
| 55 | +get_soffice_pid() { | |
| 56 | + get_pid $SOFFICE_PIDFILE | |
| 57 | + if [ ! $PID ]; then | |
| 58 | + return | |
| 59 | + fi | |
| 60 | + if [ $PID -gt 0 ]; then | |
| 61 | + SOFFICE_PID=$PID | |
| 62 | + fi | |
| 63 | +} | |
| 64 | + | |
| 65 | +get_lucene_pid() { | |
| 66 | + get_pid $LUCENE_PIDFILE | |
| 67 | + if [ ! $PID ]; then | |
| 68 | + return | |
| 69 | + fi | |
| 70 | + if [ $PID -gt 0 ]; then | |
| 71 | + LUCENE_PID=$PID | |
| 72 | + fi | |
| 73 | +} | |
| 74 | + | |
| 75 | +get_scheduler_pid() { | |
| 76 | + get_pid $SCHEDULER_PIDFILE | |
| 77 | + if [ ! $PID ]; then | |
| 78 | + return | |
| 79 | + fi | |
| 80 | + if [ $PID -gt 0 ]; then | |
| 81 | + SCHEDULER_PID=$PID | |
| 82 | + fi | |
| 83 | +} | |
| 84 | + | |
| 85 | +is_service_running() { | |
| 86 | + PID=$1 | |
| 87 | + if [ "x$PID" != "x" ] && kill -0 $PID 2>/dev/null ; then | |
| 88 | + RUNNING=1 | |
| 89 | + else | |
| 90 | + RUNNING=0 | |
| 91 | + fi | |
| 92 | + return $RUNNING | |
| 93 | +} | |
| 94 | + | |
| 95 | +is_soffice_running() { | |
| 96 | + get_soffice_pid | |
| 97 | + is_service_running $SOFFICE_PID | |
| 98 | + RUNNING=$? | |
| 99 | + if [ $RUNNING -eq 0 ]; then | |
| 100 | + SOFFICE_STATUS="openoffice not running" | |
| 101 | + else | |
| 102 | + SOFFICE_STATUS="openoffice already running" | |
| 103 | + fi | |
| 104 | + return $RUNNING | |
| 105 | +} | |
| 106 | + | |
| 107 | +is_lucene_running() { | |
| 108 | + get_lucene_pid | |
| 109 | + is_service_running $LUCENE_PID | |
| 110 | + RUNNING=$? | |
| 111 | + if [ $RUNNING -eq 0 ]; then | |
| 112 | + LUCENE_STATUS="lucene not running" | |
| 113 | + else | |
| 114 | + LUCENE_STATUS="lucene already running" | |
| 115 | + fi | |
| 116 | + return $RUNNING | |
| 117 | +} | |
| 118 | + | |
| 119 | +is_scheduler_running() { | |
| 120 | + get_scheduler_pid | |
| 121 | + is_service_running $SCHEDULER_PID | |
| 122 | + RUNNING=$? | |
| 123 | + if [ $RUNNING -eq 0 ]; then | |
| 124 | + SCHEDULER_STATUS="scheduler not running" | |
| 125 | + else | |
| 126 | + SCHEDULER_STATUS="scheduler already running" | |
| 127 | + fi | |
| 128 | + return $RUNNING | |
| 129 | +} | |
| 130 | + | |
| 131 | +start_soffice() { | |
| 132 | + is_soffice_running | |
| 133 | + RUNNING=$? | |
| 134 | + | |
| 135 | + if [ $RUNNING -eq 1 ]; then | |
| 136 | + echo "$0 $ARG: openoffice (pid $SOFFICE_PID) already running" | |
| 137 | + else | |
| 138 | + nohup $SOFFICE &> $INSTALL_PATH/var/log/dmsctl.log & | |
| 139 | + if [ $? -eq 0 ]; then | |
| 140 | + echo "$0 $ARG: openoffice started at port $SOFFICE_PORT" | |
| 141 | + ps ax | grep $SOFFICEBIN | awk {'print $1'} > $SOFFICE_PIDFILE | |
| 142 | + sleep 2 | |
| 143 | + else | |
| 144 | + echo "$0 $ARG: openoffice could not be started" | |
| 145 | + ERROR=3 | |
| 146 | + fi | |
| 147 | +fi | |
| 148 | +} | |
| 149 | + | |
| 150 | +stop_soffice() { | |
| 151 | + NO_EXIT_ON_ERROR=$1 | |
| 152 | + is_soffice_running | |
| 153 | + RUNNING=$? | |
| 154 | + | |
| 155 | + if [ $RUNNING -eq 0 ]; then | |
| 156 | + echo "$0 $ARG: $SOFFICE_STATUS" | |
| 157 | + if [ "x$NO_EXIT_ON_ERROR" != "xno_exit" ]; then | |
| 158 | + exit | |
| 159 | + else | |
| 160 | + return | |
| 161 | + fi | |
| 162 | + fi | |
| 163 | + get_soffice_pid | |
| 164 | + if killall $SOFFICEFILE; then | |
| 165 | + echo "$0 $ARG: openoffice stopped" | |
| 166 | + else | |
| 167 | + echo "$0 $ARG: openoffice could not be stopped" | |
| 168 | + ERROR=4 | |
| 169 | + fi | |
| 170 | +} | |
| 171 | + | |
| 172 | +start_lucene() { | |
| 173 | + is_lucene_running | |
| 174 | + RUNNING=$? | |
| 175 | + | |
| 176 | + if [ $RUNNING -eq 1 ]; then | |
| 177 | + echo "$0 $ARG: lucene (pid $LUCENE_PID) already running" | |
| 178 | + else | |
| 179 | + cd $INSTALL_PATH/bin/luceneserver | |
| 180 | + nohup $LUCENE &> $INSTALL_PATH/var/log/dmsctl.log & | |
| 181 | + if [ $? -eq 0 ]; then | |
| 182 | + echo "$0 $ARG: lucene started" | |
| 183 | + ps ax | grep ktlucene.jar | awk {'print $1'} > $LUCENE_PIDFILE | |
| 184 | + sleep 2 | |
| 185 | + else | |
| 186 | + echo "$0 $ARG: lucene could not be started" | |
| 187 | + ERROR=3 | |
| 188 | + fi | |
| 189 | + cd $INSTALL_PATH | |
| 190 | +fi | |
| 191 | +} | |
| 192 | + | |
| 193 | +stop_lucene() { | |
| 194 | + NO_EXIT_ON_ERROR=$1 | |
| 195 | + is_lucene_running | |
| 196 | + RUNNING=$? | |
| 197 | + | |
| 198 | + if [ $RUNNING -eq 0 ]; then | |
| 199 | + echo "$0 $ARG: $LUCENE_STATUS" | |
| 200 | + if [ "x$NO_EXIT_ON_ERROR" != "xno_exit" ]; then | |
| 201 | + exit | |
| 202 | + else | |
| 203 | + return | |
| 204 | + fi | |
| 205 | + fi | |
| 206 | + get_lucene_pid | |
| 207 | + cd $INSTALL_PATH/search2/indexing/bin | |
| 208 | + $ZEND_DIR/bin/php shutdown.php positive &> $INSTALL_PATH/var/log/dmsctl.log | |
| 209 | + sleep 5 | |
| 210 | + if [ $? -eq 0 ]; then | |
| 211 | + echo "$0 $ARG: lucene stopped" | |
| 212 | + else | |
| 213 | + echo "$0 $ARG: lucene could not be stopped" | |
| 214 | + ERROR=4 | |
| 215 | + fi | |
| 216 | +} | |
| 217 | + | |
| 218 | +start_scheduler() { | |
| 219 | + is_scheduler_running | |
| 220 | + RUNNING=$? | |
| 221 | + | |
| 222 | + if [ $RUNNING -eq 1 ]; then | |
| 223 | + echo "$0 $ARG: scheduler (pid $SCHEDULER_PID) already running" | |
| 224 | + else | |
| 225 | + cd $SCHEDULER_PATH | |
| 226 | + nohup $SCHEDULER &> $INSTALL_PATH/var/log/dmsctl.log & | |
| 227 | + if [ $? -eq 0 ]; then | |
| 228 | + echo "$0 $ARG: scheduler started" | |
| 229 | + ps ax | grep $SCHEDULERBIN | awk {'print $1'} > $SCHEDULER_PIDFILE | |
| 230 | + sleep 2 | |
| 231 | + else | |
| 232 | + echo "$0 $ARG: scheduler could not be started" | |
| 233 | + ERROR=3 | |
| 234 | + fi | |
| 235 | + fi | |
| 236 | +} | |
| 237 | + | |
| 238 | +stop_scheduler() { | |
| 239 | + NO_EXIT_ON_ERROR=$1 | |
| 240 | + is_scheduler_running | |
| 241 | + RUNNING=$? | |
| 242 | + | |
| 243 | + if [ $RUNNING -eq 0 ]; then | |
| 244 | + echo "$0 $ARG: $SCHEDULER_STATUS" | |
| 245 | + if [ "x$NO_EXIT_ON_ERROR" != "xno_exit" ]; then | |
| 246 | + exit | |
| 247 | + else | |
| 248 | + return | |
| 249 | + fi | |
| 250 | + fi | |
| 251 | + get_scheduler_pid | |
| 252 | + if kill $SCHEDULER_PID ; then | |
| 253 | + echo "$0 $ARG: scheduler stopped" | |
| 254 | + else | |
| 255 | + echo "$0 $ARG: scheduler could not be stopped" | |
| 256 | + ERROR=4 | |
| 257 | + fi | |
| 258 | +} | |
| 259 | + | |
| 260 | +help() { | |
| 261 | + echo "usage: $0 help" | |
| 262 | + echo " $0 (start|stop|restart)" | |
| 263 | + echo " $0 (start|stop|restart) scheduler" | |
| 264 | + echo " $0 (start|stop|restart) soffice" | |
| 265 | + echo " $0 (start|stop|restart) lucene" | |
| 266 | + cat <<EOF | |
| 267 | + | |
| 268 | +help - this screen | |
| 269 | +start - start the service(s) | |
| 270 | +stop - stop the service(s) | |
| 271 | +restart - restart or start the service(s) | |
| 272 | + | |
| 273 | +EOF | |
| 274 | +exit 0 | |
| 275 | +} | |
| 276 | + | |
| 277 | +noserver() { | |
| 278 | + echo -e "ERROR: $1 is not a valid server. Please, select 'scheduler', 'soffice' or 'lucene'\n" | |
| 279 | + help | |
| 280 | +} | |
| 281 | + | |
| 282 | +[ $# -lt 1 ] && help | |
| 283 | + | |
| 284 | +if [ ! -z ${2} ]; then | |
| 285 | + [ "${2}" != "mysql" ] && [ "${2}" != "apache" ] && [ "${2}" != "agent" ] && [ "${2}" != "scheduler" ] && [ "${2}" != "soffice" ] && [ "${2}" != "lucene" ] && noserver $2 | |
| 286 | + SERVER=$2 | |
| 287 | +fi | |
| 288 | + | |
| 289 | + | |
| 290 | +if [ "x$3" != "x" ]; then | |
| 291 | + MYSQL_PASSWORD=$3 | |
| 292 | +fi | |
| 293 | + | |
| 294 | + | |
| 295 | +case $1 in | |
| 296 | + help) help | |
| 297 | + ;; | |
| 298 | + start) | |
| 299 | + if [ "${SERVER}" != "all" ]; then | |
| 300 | + start_${2} | |
| 301 | + else | |
| 302 | + start_soffice | |
| 303 | + start_lucene | |
| 304 | + start_scheduler | |
| 305 | + fi | |
| 306 | + ;; | |
| 307 | + stop) if [ "${SERVER}" != "all" ]; then | |
| 308 | + stop_${2} | |
| 309 | + else | |
| 310 | + stop_scheduler "no_exit" | |
| 311 | + stop_lucene "no_exit" | |
| 312 | + stop_soffice "no_exit" | |
| 313 | + fi | |
| 314 | + ;; | |
| 315 | + restart) if [ "${SERVER}" != "all" ]; then | |
| 316 | + stop_${2} "no_exit" | |
| 317 | + sleep 2 | |
| 318 | + start_${2} | |
| 319 | + else | |
| 320 | + stop_scheduler "no_exit" | |
| 321 | + stop_lucene "no_exit" | |
| 322 | + stop_soffice "no_exit" | |
| 323 | + start_soffice | |
| 324 | + start_lucene | |
| 325 | + start_scheduler | |
| 326 | + fi | |
| 327 | + ;; | |
| 328 | +esac | |
| 329 | + | |
| 330 | +exit $ERROR | |
| 0 | 331 | \ No newline at end of file | ... | ... |
setup/migrate/steps/migrateDatabase.php
| ... | ... | @@ -206,7 +206,7 @@ class migrateDatabase extends Step |
| 206 | 206 | * @return void |
| 207 | 207 | */ |
| 208 | 208 | private function createMigrateFile() { |
| 209 | - @touch($this->wizardLocation . DIRECTORY_SEPARATOR . "migrate.lock"); | |
| 209 | + @touch(SYSTEM_DIR.'var'.DS.'bin'.DS."migrate.lock"); | |
| 210 | 210 | } |
| 211 | 211 | |
| 212 | 212 | /** | ... | ... |
setup/upgrade/upgrade.lock deleted
setup/upgrade/upgradeUtil.php
| ... | ... | @@ -52,7 +52,7 @@ class UpgradeUtil extends InstallUtil { |
| 52 | 52 | * @return boolean |
| 53 | 53 | */ |
| 54 | 54 | public function isSystemUpgraded() { |
| 55 | - if (file_exists(dirname(__FILE__)."/upgrade.lock")) { | |
| 55 | + if (file_exists(SYSTEM_DIR.'var'.DS.'bin'.DS."upgrade.lock")) { | |
| 56 | 56 | |
| 57 | 57 | return true; |
| 58 | 58 | } |
| ... | ... | @@ -68,7 +68,7 @@ class UpgradeUtil extends InstallUtil { |
| 68 | 68 | * @return boolean |
| 69 | 69 | */ |
| 70 | 70 | public function isMigration() { |
| 71 | - if(file_exists("../wizard/migrate.lock")) | |
| 71 | + if(file_exists(SYSTEM_DIR.'var'.DS.'bin'.DS."migrate.lock")) | |
| 72 | 72 | return true; |
| 73 | 73 | return false; |
| 74 | 74 | } | ... | ... |
setup/upgrade/upgradeWizard.php
| ... | ... | @@ -155,7 +155,7 @@ class UpgradeWizard { |
| 155 | 155 | * @return void |
| 156 | 156 | */ |
| 157 | 157 | private function createUpgradeFile() { |
| 158 | - @touch("upgrade.lock"); | |
| 158 | + @touch(SYSTEM_DIR.'var'.DS.'bin'.DS."upgrade.lock"); | |
| 159 | 159 | } |
| 160 | 160 | |
| 161 | 161 | /** |
| ... | ... | @@ -167,7 +167,7 @@ class UpgradeWizard { |
| 167 | 167 | * @return void |
| 168 | 168 | */ |
| 169 | 169 | private function removeUpgradeFile() { |
| 170 | - @unlink("upgrade.lock"); | |
| 170 | + @unlink(SYSTEM_DIR.'var'.DS.'bin'.DS."upgrade.lock"); | |
| 171 | 171 | } |
| 172 | 172 | |
| 173 | 173 | /** | ... | ... |
setup/wizard/iniUtilities.php
| ... | ... | @@ -136,14 +136,14 @@ class iniUtilities { |
| 136 | 136 | $fileHandle = fopen($iniFile, 'wb'); |
| 137 | 137 | foreach ($this->cleanArray as $section => $items) { |
| 138 | 138 | if (substr($section, 0, strlen('_blankline_')) === '_blankline_' ) { |
| 139 | - fwrite ($fileHandle, "\r\n"); | |
| 139 | + @fwrite ($fileHandle, "\r\n"); | |
| 140 | 140 | continue; |
| 141 | 141 | } |
| 142 | 142 | if (substr($section, 0, strlen('_comment_')) === '_comment_' ) { |
| 143 | - fwrite ($fileHandle, "$items\r\n"); | |
| 143 | + @fwrite ($fileHandle, "$items\r\n"); | |
| 144 | 144 | continue; |
| 145 | 145 | } |
| 146 | - fwrite ($fileHandle, "[".$section."]\r\n"); | |
| 146 | + @fwrite ($fileHandle, "[".$section."]\r\n"); | |
| 147 | 147 | foreach ($items as $key => $value) { |
| 148 | 148 | if (substr($key, 0, strlen('_blankline_')) === '_blankline_' ) { |
| 149 | 149 | fwrite ($fileHandle, "\r\n"); |
| ... | ... | @@ -156,10 +156,10 @@ class iniUtilities { |
| 156 | 156 | |
| 157 | 157 | $value = addcslashes($value,''); |
| 158 | 158 | //fwrite ($fileHandle, $key.' = "'.$value."\"\r\n"); |
| 159 | - fwrite ($fileHandle, $key.' = '.$value."\r\n"); | |
| 159 | + @fwrite ($fileHandle, $key.' = '.$value."\r\n"); | |
| 160 | 160 | } |
| 161 | 161 | } |
| 162 | - fclose($fileHandle); | |
| 162 | + @fclose($fileHandle); | |
| 163 | 163 | } |
| 164 | 164 | |
| 165 | 165 | function itemExists($checkSection, $checkItem) { |
| ... | ... | @@ -179,7 +179,6 @@ class iniUtilities { |
| 179 | 179 | } |
| 180 | 180 | |
| 181 | 181 | function addItem($addSection, $addItem, $value, $itemComment = '', $sectionComment = '') { |
| 182 | - | |
| 183 | 182 | if($this->itemExists($addSection, $addItem)) { |
| 184 | 183 | $this->delItem($addSection, $addItem); |
| 185 | 184 | } | ... | ... |
setup/wizard/installUtil.php
| ... | ... | @@ -67,7 +67,7 @@ class InstallUtil { |
| 67 | 67 | * @return boolean |
| 68 | 68 | */ |
| 69 | 69 | public function isSystemInstalled() { |
| 70 | - if (file_exists(dirname(__FILE__)."/install.lock")) { | |
| 70 | + if (file_exists(SYSTEM_DIR.'var'.DS.'bin'.DS."install.lock")) { | |
| 71 | 71 | return true; |
| 72 | 72 | } |
| 73 | 73 | return false; |
| ... | ... | @@ -363,13 +363,13 @@ class InstallUtil { |
| 363 | 363 | * @return boolean |
| 364 | 364 | */ |
| 365 | 365 | public function canWriteFile($filename) { |
| 366 | - $fh = fopen($filename, "w+"); | |
| 367 | - $fr = fwrite($fh, 'test'); | |
| 366 | + $fh = @fopen($filename, "w+"); | |
| 367 | + $fr = @fwrite($fh, 'test'); | |
| 368 | 368 | if($fr === false) { |
| 369 | 369 | return false; |
| 370 | 370 | } |
| 371 | 371 | |
| 372 | - fclose($fh); | |
| 372 | + @fclose($fh); | |
| 373 | 373 | return true; |
| 374 | 374 | } |
| 375 | 375 | |
| ... | ... | @@ -714,8 +714,8 @@ class InstallUtil { |
| 714 | 714 | * @return void |
| 715 | 715 | */ |
| 716 | 716 | function deleteMigrateFile() { |
| 717 | - if(file_exists("migrate.lock")) | |
| 718 | - @unlink("migrate.lock"); | |
| 717 | + if(file_exists(SYSTEM_DIR.'var'.DS.'bin'.DS."migrate.lock")) | |
| 718 | + @unlink(SYSTEM_DIR.'var'.DS.'bin'.DS."migrate.lock"); | |
| 719 | 719 | } |
| 720 | 720 | |
| 721 | 721 | /** |
| ... | ... | @@ -726,7 +726,7 @@ class InstallUtil { |
| 726 | 726 | * @return boolean |
| 727 | 727 | */ |
| 728 | 728 | public function isMigration() { |
| 729 | - if(file_exists("migrate.lock")) | |
| 729 | + if(file_exists(SYSTEM_DIR.'var'.DS.'bin'.DS."migrate.lock")) | |
| 730 | 730 | return true; |
| 731 | 731 | return false; |
| 732 | 732 | } | ... | ... |
setup/wizard/installWizard.php
| ... | ... | @@ -203,7 +203,7 @@ class InstallWizard { |
| 203 | 203 | * @return void |
| 204 | 204 | */ |
| 205 | 205 | private function createInstallFile() { |
| 206 | - @touch("install.lock"); | |
| 206 | + @touch(SYSTEM_DIR.'var'.DS.'bin'.DS."install.lock"); | |
| 207 | 207 | } |
| 208 | 208 | |
| 209 | 209 | /** |
| ... | ... | @@ -215,8 +215,8 @@ class InstallWizard { |
| 215 | 215 | * @return void |
| 216 | 216 | */ |
| 217 | 217 | private function removeInstallFile() { |
| 218 | - if(file_exists("install.lock")) | |
| 219 | - unlink("install.lock"); | |
| 218 | + if(file_exists(SYSTEM_DIR.'var'.DS.'bin'.DS."install.lock")) | |
| 219 | + @unlink(SYSTEM_DIR.'var'.DS.'bin'.DS."install.lock"); | |
| 220 | 220 | } |
| 221 | 221 | |
| 222 | 222 | /** | ... | ... |
setup/wizard/installer.php
setup/wizard/lib/services/unixLucene.php
| ... | ... | @@ -210,9 +210,10 @@ class unixLucene extends unixService { |
| 210 | 210 | echo "$cmd<br/>"; |
| 211 | 211 | return false; |
| 212 | 212 | } |
| 213 | - $response = $this->util->pexec($cmd); | |
| 213 | + //$response = $this->util->pexec($cmd); | |
| 214 | 214 | |
| 215 | - return $response; | |
| 215 | +// return $response; | |
| 216 | + return false; | |
| 216 | 217 | } |
| 217 | 218 | |
| 218 | 219 | return true; | ... | ... |
setup/wizard/lib/services/unixOpenOffice.php
setup/wizard/lib/services/unixScheduler.php
| ... | ... | @@ -181,7 +181,6 @@ class unixScheduler extends unixService { |
| 181 | 181 | // TODO : Write sh on the fly? Not sure the reasoning here |
| 182 | 182 | $source = $this->getSchedulerSourceLoc(); |
| 183 | 183 | $this->writeSchedulerTask(); |
| 184 | -// $logFile = $this->outputDir."scheduler.log"; | |
| 185 | 184 | $logFile = "/dev/null"; |
| 186 | 185 | @unlink($logFile); |
| 187 | 186 | if($source) { // Source |
| ... | ... | @@ -194,9 +193,10 @@ class unixScheduler extends unixService { |
| 194 | 193 | echo "$cmd<br/>"; |
| 195 | 194 | return ; |
| 196 | 195 | } |
| 197 | - $response = $this->util->pexec($cmd); | |
| 196 | + //$response = $this->util->pexec($cmd); | |
| 198 | 197 | |
| 199 | - return $response; | |
| 198 | +// return $response; | |
| 199 | + return false; | |
| 200 | 200 | } |
| 201 | 201 | |
| 202 | 202 | public function getName() { | ... | ... |
setup/wizard/lib/services/windowsScheduler.php
| ... | ... | @@ -249,11 +249,11 @@ class windowsScheduler extends windowsService { |
| 249 | 249 | echo "Attempt to Create {$this->getSchedulerDir()}\\taskrunner.bat<br>"; |
| 250 | 250 | } |
| 251 | 251 | if(is_readable($this->varDir."bin") && is_writable($this->varDir."bin")) { |
| 252 | - $fp = fopen($this->getSchedulerDir().""."\taskrunner.bat", "w+"); | |
| 252 | + $fp = @fopen($this->getSchedulerDir().""."\taskrunner.bat", "w+"); | |
| 253 | 253 | $content = "@echo off \n"; |
| 254 | 254 | $content .= "\"".$this->util->useZendPhp()."php.exe\" "."\"{$this->getSchedulerSource()}\""; |
| 255 | - fwrite($fp, $content); | |
| 256 | - fclose($fp); | |
| 255 | + @fwrite($fp, $content); | |
| 256 | + @fclose($fp); | |
| 257 | 257 | } else { |
| 258 | 258 | echo 'Could not write task runner<br>'; // TODO: Should not reach this point |
| 259 | 259 | } | ... | ... |
setup/wizard/lib/validation/luceneValidation.php
| ... | ... | @@ -114,10 +114,15 @@ class luceneValidation extends serviceValidation { |
| 114 | 114 | private $javaExtCheck = 'cross_orange'; |
| 115 | 115 | |
| 116 | 116 | public function preset() { |
| 117 | - $this->zendBridgeNotInstalled(); // Set bridge not installed | |
| 118 | - $this->javaVersionInCorrect(); // Set version to incorrect | |
| 119 | - $this->javaNotInstalled(); // Set java to not installed | |
| 120 | - $this->setJava(); // Check if java has been auto detected | |
| 117 | + /* Rely on Script */ | |
| 118 | + $this->zendBridgeInstalled(); | |
| 119 | + $this->javaVersionCorrect(); | |
| 120 | + $this->javaInstalled(); | |
| 121 | + $this->installed(); | |
| 122 | +// $this->zendBridgeNotInstalled(); // Set bridge not installed | |
| 123 | +// $this->javaVersionInCorrect(); // Set version to incorrect | |
| 124 | +// $this->javaNotInstalled(); // Set java to not installed | |
| 125 | +// $this->setJava(); // Check if java has been auto detected | |
| 121 | 126 | } |
| 122 | 127 | |
| 123 | 128 | /** | ... | ... |
setup/wizard/steps/configuration.php
| ... | ... | @@ -668,16 +668,16 @@ class configuration extends Step |
| 668 | 668 | * @return boolean |
| 669 | 669 | */ |
| 670 | 670 | private function writeConfigPath($configPath, $configContent) { |
| 671 | - $fp = fopen($configPath, 'w+'); | |
| 672 | - if(fwrite($fp, $configContent)) | |
| 671 | + $fp = @fopen($configPath, 'w+'); | |
| 672 | + if(@fwrite($fp, $configContent)) | |
| 673 | 673 | return true; |
| 674 | 674 | return false; |
| 675 | 675 | } |
| 676 | 676 | |
| 677 | 677 | private function writeCachePath($cachePath, $cacheContent) { |
| 678 | - $fp = fopen($cachePath, 'w+'); | |
| 678 | + $fp = @fopen($cachePath, 'w+'); | |
| 679 | 679 | if($cacheContent != '') { |
| 680 | - if(fwrite($fp, $cacheContent)) | |
| 680 | + if(@fwrite($fp, $cacheContent)) | |
| 681 | 681 | return true; |
| 682 | 682 | } |
| 683 | 683 | return false; | ... | ... |
setup/wizard/steps/database.php
| ... | ... | @@ -734,7 +734,7 @@ class database extends Step |
| 734 | 734 | } |
| 735 | 735 | |
| 736 | 736 | private function parse_mysql_dump($url) { |
| 737 | - $handle = fopen($url, "r"); | |
| 737 | + $handle = @fopen($url, "r"); | |
| 738 | 738 | $query = ""; |
| 739 | 739 | if ($handle) { |
| 740 | 740 | while (!feof($handle)) { |
| ... | ... | @@ -744,7 +744,7 @@ class database extends Step |
| 744 | 744 | $query = ''; |
| 745 | 745 | } |
| 746 | 746 | } |
| 747 | - fclose($handle); | |
| 747 | + @fclose($handle); | |
| 748 | 748 | } |
| 749 | 749 | |
| 750 | 750 | return true; |
| ... | ... | @@ -778,11 +778,13 @@ class database extends Step |
| 778 | 778 | private function writeBinaries() { |
| 779 | 779 | $services = $this->util->getDataFromSession('services'); |
| 780 | 780 | $binaries = $services['binaries']; |
| 781 | - foreach ($binaries as $k=>$bin) { | |
| 782 | - if($k != 1) { | |
| 783 | - $updateBin = 'UPDATE config_settings c SET c.value = "'.$bin.'" where c.group_name = "externalBinary" and c.display_name = "'.$k.'";'; | |
| 784 | - $this->util->dbUtilities->query($updateBin); | |
| 785 | - } | |
| 781 | + if($binaries) { | |
| 782 | + foreach ($binaries as $k=>$bin) { | |
| 783 | + if($k != 1) { | |
| 784 | + $updateBin = 'UPDATE config_settings c SET c.value = "'.$bin.'" where c.group_name = "externalBinary" and c.display_name = "'.$k.'";'; | |
| 785 | + $this->util->dbUtilities->query($updateBin); | |
| 786 | + } | |
| 787 | + } | |
| 786 | 788 | } |
| 787 | 789 | |
| 788 | 790 | // if Windows, hard code (relative to SYSTEM_ROOT) where we expect the Zend MSI installer to have placed them | ... | ... |
setup/wizard/steps/dependencies.php
| ... | ... | @@ -333,7 +333,7 @@ class dependencies extends Step |
| 333 | 333 | */ |
| 334 | 334 | private function getRequiredExtensions() { |
| 335 | 335 | $ext = array( |
| 336 | - array('extension' => 'fileinfo', 'required' => 'no', 'name' => 'Fileinfo', 'details' => 'Provides better file identification support - not necessary if you use file extensions.'), | |
| 336 | +// array('extension' => 'fileinfo', 'required' => 'no', 'name' => 'Fileinfo', 'details' => 'Provides better file identification support - not necessary if you use file extensions.'), | |
| 337 | 337 | array('extension' => 'iconv', 'required' => 'no', 'name' => 'IconV', 'details' => 'Used for conversion between character sets.'), |
| 338 | 338 | array('extension' => 'mysql', 'required' => 'yes', 'name' => 'MySQL', 'details' => 'Used for accessing a MySQL database.'), |
| 339 | 339 | array('extension' => 'curl', 'required' => 'yes', 'name' => 'cURL', 'details' => 'Allows the connection and communication between different servers types using various protocols.'), | ... | ... |
setup/wizard/steps/registration.php
| ... | ... | @@ -183,7 +183,7 @@ class registration extends Step |
| 183 | 183 | $params['http']['header'] = $optional_headers; |
| 184 | 184 | } |
| 185 | 185 | $ctx = stream_context_create($params); |
| 186 | - $fp = fopen($url, 'r', false, $ctx); | |
| 186 | + $fp = @fopen($url, 'r', false, $ctx); | |
| 187 | 187 | if (!$fp) { |
| 188 | 188 | throw new Exception("Problem with $url, $php_errormsg"); |
| 189 | 189 | } |
| ... | ... | @@ -192,7 +192,7 @@ class registration extends Step |
| 192 | 192 | fclose($fp); |
| 193 | 193 | throw new Exception("Problem reading data from $url, $php_errormsg"); |
| 194 | 194 | } |
| 195 | - fclose($fp); | |
| 195 | + @fclose($fp); | |
| 196 | 196 | return $response; |
| 197 | 197 | } |
| 198 | 198 | ... | ... |
setup/wizard/steps/services.php
| ... | ... | @@ -143,8 +143,27 @@ class services extends Step |
| 143 | 143 | * @return object |
| 144 | 144 | */ |
| 145 | 145 | public $schedulerValidation; |
| 146 | - | |
| 146 | + | |
| 147 | + /** | |
| 148 | + * List of binaries needed to start service | |
| 149 | + * | |
| 150 | + * @author KnowledgeTree Team | |
| 151 | + * @access public | |
| 152 | + * @param none | |
| 153 | + * @return object | |
| 154 | + */ | |
| 147 | 155 | public $binaries = array(); |
| 156 | + | |
| 157 | + /** | |
| 158 | + * List of binaries needed to start service | |
| 159 | + * | |
| 160 | + * @author KnowledgeTree Team | |
| 161 | + * @access public | |
| 162 | + * @param none | |
| 163 | + * @return object | |
| 164 | + */ | |
| 165 | + public $validation = false; | |
| 166 | + | |
| 148 | 167 | /** |
| 149 | 168 | * Main control of services setup |
| 150 | 169 | * |
| ... | ... | @@ -203,6 +222,8 @@ class services extends Step |
| 203 | 222 | $this->alreadyInstalled = true; |
| 204 | 223 | $this->serviceCheck = 'tick'; |
| 205 | 224 | } else { |
| 225 | +// $cmd = SYSTEM_DIR."dmsctl.sh start > /dev/null 2>&1 & echo $!"; | |
| 226 | +// $this->util->pexec($cmd); // First Attempt to start all using bash script | |
| 206 | 227 | foreach ($this->getServices() as $bin=>$service) { |
| 207 | 228 | $class = strtolower($service)."Validation"; |
| 208 | 229 | $this->$class->preset(); // Sets defaults |
| ... | ... | @@ -523,6 +544,7 @@ class services extends Step |
| 523 | 544 | $this->temp_variables['alreadyInstalled'] = $this->alreadyInstalled; |
| 524 | 545 | $this->temp_variables['serviceCheck'] = $this->serviceCheck; |
| 525 | 546 | $this->temp_variables['binaries'] = $this->binaries; |
| 547 | + $this->temp_variables['validation'] = $this->validation; | |
| 526 | 548 | } |
| 527 | 549 | |
| 528 | 550 | ... | ... |
setup/wizard/templates/installtype.tpl
| ... | ... | @@ -9,14 +9,14 @@ |
| 9 | 9 | <td> <input type="radio" name="installtype" value="Clean Install" checked id="clean" /> </td> |
| 10 | 10 | <td> <label for="clean"><b>Default Install</b> <br/>Install a new copy of KnowledgeTree</label> </td> |
| 11 | 11 | </tr> |
| 12 | - <tr> | |
| 12 | +<!-- <tr> | |
| 13 | 13 | <td> <input type="radio" name="installtype" value="Upgrade Installation" id="migrate" /> </td> |
| 14 | 14 | <td> <label for="migrate"><b>Upgrade - KnowledgeTree Stack</b> <br/> Upgrade from a previous version of the KnowledgeTree Stack</label></td> |
| 15 | 15 | </tr> |
| 16 | 16 | <tr> |
| 17 | 17 | <td> <input type="radio" name="installtype" value="Upgrade Only" id="upgrade" /> </td> |
| 18 | 18 | <td> <label for="upgrade"><b>Upgrade - Source Only</b> <br/> Upgrade from a Source Only Installation of KnowledgeTree</label></td> |
| 19 | - </tr> | |
| 19 | + </tr>--> | |
| 20 | 20 | </table> |
| 21 | 21 | </div> |
| 22 | 22 | <input type="submit" name="Previous" value="Previous" class="button_previous"/> | ... | ... |
setup/wizard/templates/services.tpl
| ... | ... | @@ -40,37 +40,38 @@ |
| 40 | 40 | <!--Content--> |
| 41 | 41 | <div id="step_content_configuration" class="step"> |
| 42 | 42 | <?php if(!$alreadyInstalled) { ?> |
| 43 | - <?php if($javaExeError) { ?> | |
| 44 | - Specify the location of your Java executable | |
| 45 | - | |
| 46 | - <input name='java' id='port' size='25' value='<?php echo $java['location']; ?>' style="float:none;"/> | |
| 47 | - | |
| 48 | - <a href="javascript:{w.sendJavaLocation();}" class="specify">Submit</a> | |
| 49 | - <br/> | |
| 50 | - <?php if($javaExeError != '') { ?><span class="error"><?php echo $javaExeMessage; ?></span><?php } ?> | |
| 51 | - <br/> | |
| 52 | - <?php } ?> | |
| 53 | - <?php if($phpExeError != '') { ?> | |
| 54 | - <br /> | |
| 55 | - Specify the location of your PHP executable | |
| 56 | - <br /> | |
| 57 | - <?php if($php['location'] == '') { ?> | |
| 58 | - <input name='php' id='port' size='25' value='<?php echo $php['location']; ?>'/> | |
| 59 | - <?php } else { ?> | |
| 60 | - <input type="hidden" name='php' id='port' size='25' value='<?php echo $php['location']; ?>'/> | |
| 43 | + <?php if($validation) { ?> | |
| 44 | + <?php if($javaExeError) { ?> | |
| 45 | + Specify the location of your Java executable | |
| 46 | + | |
| 47 | + <input name='java' id='port' size='25' value='<?php echo $java['location']; ?>' style="float:none;"/> | |
| 48 | + | |
| 49 | + <a href="javascript:{w.sendJavaLocation();}" class="specify">Submit</a> | |
| 50 | + <br/> | |
| 51 | + <?php if($javaExeError != '') { ?><span class="error"><?php echo $javaExeMessage; ?></span><?php } ?> | |
| 52 | + <br/> | |
| 53 | + <?php } ?> | |
| 54 | + <?php if($phpExeError != '') { ?> | |
| 55 | + <br /> | |
| 56 | + Specify the location of your PHP executable | |
| 57 | + <br /> | |
| 58 | + <?php if($php['location'] == '') { ?> | |
| 59 | + <input name='php' id='port' size='25' value='<?php echo $php['location']; ?>'/> | |
| 60 | + <?php } else { ?> | |
| 61 | + <input type="hidden" name='php' id='port' size='25' value='<?php echo $php['location']; ?>'/> | |
| 62 | + <?php } ?> | |
| 63 | + | |
| 64 | + <?php if($phpExeError != true) { ?><span class="error"><?php echo $phpExeError; ?></span><?php } ?> | |
| 65 | + <?php } ?> | |
| 66 | + <?php if($openOfficeExeError) { ?> | |
| 67 | + Specify the location of your Open Office executable | |
| 68 | + | |
| 69 | + <input name='soffice' id='port' size='25' value='<?php if(isset($soffice['location'])) echo $soffice['location']; ?>' style="float:none;"/> | |
| 70 | + | |
| 71 | + <a href="javascript:{w.sendJavaLocation();}" class="specify">Submit</a> | |
| 72 | + <br/> | |
| 73 | + <?php if($openOfficeExeError != '') { ?><span class="error"><?php echo $openOfficeExeMessage; ?></span><?php } ?> | |
| 61 | 74 | <?php } ?> |
| 62 | - | |
| 63 | - <?php if($phpExeError != true) { ?><span class="error"><?php echo $phpExeError; ?></span><?php } ?> | |
| 64 | - <?php } ?> | |
| 65 | - <?php if($openOfficeExeError) { ?> | |
| 66 | - Specify the location of your Open Office executable | |
| 67 | - | |
| 68 | - <input name='soffice' id='port' size='25' value='<?php if(isset($soffice['location'])) echo $soffice['location']; ?>' style="float:none;"/> | |
| 69 | - | |
| 70 | - <a href="javascript:{w.sendJavaLocation();}" class="specify">Submit</a> | |
| 71 | - <br/> | |
| 72 | - <?php if($openOfficeExeError != '') { ?><span class="error"><?php echo $openOfficeExeMessage; ?></span><?php } ?> | |
| 73 | - <?php } ?> | |
| 74 | 75 | <h3><?php echo "<span class='{$javaCheck}'> </span>"; ?>Java Check</h3> |
| 75 | 76 | <?php if($silent) { ?> |
| 76 | 77 | <?php if($javaExeError) { |
| ... | ... | @@ -163,6 +164,7 @@ |
| 163 | 164 | </div> |
| 164 | 165 | <?php } ?> |
| 165 | 166 | <?php } ?> |
| 167 | + <?php } ?> | |
| 166 | 168 | <?php } else { ?> |
| 167 | 169 | <!-- <p class="description">--> |
| 168 | 170 | All services are already installed. | ... | ... |