Commit dd74862847eb33bd19f496ac75c98baf77554a76
Merge branch 'edge' of git@github.com:ktgit/knowledgetree into edge
Showing
8 changed files
with
446 additions
and
124 deletions
dmsctl.sh
| @@ -16,20 +16,37 @@ INSTALL_PATH=`pwd` | @@ -16,20 +16,37 @@ INSTALL_PATH=`pwd` | ||
| 16 | JAVABIN=/usr/bin/java | 16 | JAVABIN=/usr/bin/java |
| 17 | ZEND_DIR=/usr/local/zend | 17 | ZEND_DIR=/usr/local/zend |
| 18 | 18 | ||
| 19 | +# exits if the UID is not 0 [root] | ||
| 20 | +check_root_privileges() | ||
| 21 | +{ | ||
| 22 | + ID="id -u" | ||
| 23 | + MYUID=`$ID 2> /dev/null` | ||
| 24 | + if [ ! -z "$MYUID" ]; then | ||
| 25 | + if [ $MYUID != 0 ]; then | ||
| 26 | + echo "You need root privileges to run this script!"; | ||
| 27 | + exit 1 | ||
| 28 | + fi | ||
| 29 | + else | ||
| 30 | + echo "Could not detect UID"; | ||
| 31 | + exit 1 | ||
| 32 | + fi | ||
| 33 | +} | ||
| 34 | + | ||
| 35 | + | ||
| 19 | if [ -f /etc/zce.rc ];then | 36 | if [ -f /etc/zce.rc ];then |
| 20 | . /etc/zce.rc | 37 | . /etc/zce.rc |
| 21 | else | 38 | else |
| 22 | echo "/etc/zce.rc doesn't exist!" | 39 | echo "/etc/zce.rc doesn't exist!" |
| 23 | exit 1; | 40 | exit 1; |
| 24 | fi | 41 | fi |
| 25 | - | 42 | +check_root_privileges |
| 26 | 43 | ||
| 27 | # OpenOffice | 44 | # OpenOffice |
| 28 | SOFFICEFILE=soffice | 45 | SOFFICEFILE=soffice |
| 29 | SOFFICE_PIDFILE=$INSTALL_PATH/var/log/soffice.bin.pid | 46 | SOFFICE_PIDFILE=$INSTALL_PATH/var/log/soffice.bin.pid |
| 30 | SOFFICE_PID="" | 47 | SOFFICE_PID="" |
| 31 | SOFFICE_PORT="8100" | 48 | SOFFICE_PORT="8100" |
| 32 | -SOFFICEBIN=/usr/share/ktdms-office/ktdms-office/openoffice/program/soffice | 49 | +SOFFICEBIN="/usr/share/ktdms-office/ktdms-office/openoffice/program/soffice" |
| 33 | SOFFICE="$SOFFICEBIN -nofirststartwizard -nologo -headless -accept=socket,host=127.0.0.1,port=$SOFFICE_PORT;urp;StarOffice.ServiceManager" | 50 | SOFFICE="$SOFFICEBIN -nofirststartwizard -nologo -headless -accept=socket,host=127.0.0.1,port=$SOFFICE_PORT;urp;StarOffice.ServiceManager" |
| 34 | SOFFICE_STATUS="" | 51 | SOFFICE_STATUS="" |
| 35 | 52 | ||
| @@ -394,7 +411,38 @@ if [ "x$3" != "x" ]; then | @@ -394,7 +411,38 @@ if [ "x$3" != "x" ]; then | ||
| 394 | fi | 411 | fi |
| 395 | 412 | ||
| 396 | # Are we running for first time | 413 | # Are we running for first time |
| 397 | -[[ -e $INSTALL_PATH/var/bin/dmsinit.lock ]] || firstrun | 414 | +if [ -e "/usr/share/knowledgetree/var/bin/dmsinit.lock" ] |
| 415 | +then | ||
| 416 | +echo ""; | ||
| 417 | +else | ||
| 418 | + if grep --quiet LD_LIBRARAY_PATH /etc/zce.rc ; then | ||
| 419 | + echo "Nothing to be done ... maybe" | ||
| 420 | + else | ||
| 421 | + echo "PATH=/usr/local/zend/bin:$PATH" >> /etc/zce.rc | ||
| 422 | + if [ -z $LD_LIBRARY_PATH ] ; then | ||
| 423 | + echo "LD_LIBRARY_PATH=$ZEND_DIR/lib" >> /etc/zce.rc | ||
| 424 | + else | ||
| 425 | + echo "LD_LIBRARY_PATH=$ZEND_DIR/lib:$LD_LIBRARY_PATH" >> /etc/zce.rc | ||
| 426 | + fi | ||
| 427 | + fi | ||
| 428 | + touch $INSTALL_PATH/var/bin/dmsinit.lock | ||
| 429 | + $ZEND_DIR/bin/zendctl.sh restart | ||
| 430 | +fi | ||
| 431 | + | ||
| 432 | +#if [ "ls /usr/share/knowledgetree/var/bin/dmsinit.lock" != "" ] ; then | ||
| 433 | +# echo "No lock" | ||
| 434 | +#e#lse | ||
| 435 | +# echo "lock" | ||
| 436 | +#f#i | ||
| 437 | + | ||
| 438 | +#if [ -f "/usr/share/knowledgetree/var/bin/dmsinit.lock"] ; then | ||
| 439 | +# firstrun | ||
| 440 | +#else | ||
| 441 | +# echo 'safd'; | ||
| 442 | +# exit 1; | ||
| 443 | +#fi | ||
| 444 | + | ||
| 445 | +#[[ -e $INSTALL_PATH/var/bin/dmsinit.lock ]] || firstrun | ||
| 398 | 446 | ||
| 399 | case $1 in | 447 | case $1 in |
| 400 | help) help | 448 | help) help |
dmsctl.vbs
| @@ -5,7 +5,7 @@ | @@ -5,7 +5,7 @@ | ||
| 5 | ' | 5 | ' |
| 6 | 6 | ||
| 7 | ' Service Name Consts | 7 | ' Service Name Consts |
| 8 | -Const KTOFFICE = "KTOpenOffice" | 8 | +Const KTOFFICE = "KTOpenoffice" |
| 9 | Const KTSCHEDULER = "KTScheduler" | 9 | Const KTSCHEDULER = "KTScheduler" |
| 10 | Const KTLUCENE = "KTLucene" | 10 | Const KTLUCENE = "KTLucene" |
| 11 | 11 | ||
| @@ -36,13 +36,17 @@ Const SVC_INVALID_SERVICES_ACCOUNT = 22 ' Status Invalid Service Account | @@ -36,13 +36,17 @@ Const SVC_INVALID_SERVICES_ACCOUNT = 22 ' Status Invalid Service Account | ||
| 36 | Const SVC_STATUS_SERVICE_EXISTS = 23 ' Status Service Exists | 36 | Const SVC_STATUS_SERVICE_EXISTS = 23 ' Status Service Exists |
| 37 | Const SVC_SERVICE_ALREADY_PAUSED = 24 ' Service Already Paused | 37 | Const SVC_SERVICE_ALREADY_PAUSED = 24 ' Service Already Paused |
| 38 | 38 | ||
| 39 | -'Detecting current OS | ||
| 40 | -Dim strComputer, currOS, doRunAs | 39 | +Dim strComputer, currOS, currDir, doRunAs, lastErrorCode |
| 40 | + | ||
| 41 | +' Detecting the current directory | ||
| 42 | +Set oFso = CreateObject("Scripting.FileSystemObject") | ||
| 43 | +currDir = oFso.GetParentFolderName(Wscript.ScriptFullName) | ||
| 41 | 44 | ||
| 42 | strComputer = "." | 45 | strComputer = "." |
| 43 | currOS = "" | 46 | currOS = "" |
| 44 | doRunAs = false | 47 | doRunAs = false |
| 45 | 48 | ||
| 49 | +' Detecting the current OS | ||
| 46 | Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2") | 50 | Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2") |
| 47 | Set colOperatingSystems = objWMIService.ExecQuery ("Select * from Win32_OperatingSystem") | 51 | Set colOperatingSystems = objWMIService.ExecQuery ("Select * from Win32_OperatingSystem") |
| 48 | 52 | ||
| @@ -52,28 +56,28 @@ For Each objOperatingSystem in colOperatingSystems | @@ -52,28 +56,28 @@ For Each objOperatingSystem in colOperatingSystems | ||
| 52 | Next | 56 | Next |
| 53 | 57 | ||
| 54 | Public Function isWindowsVista() | 58 | Public Function isWindowsVista() |
| 55 | - isWindows7 = false | 59 | + isWindowsVista = false |
| 56 | If left(currOS, 19) = "Microsoft Windows Vista" Then | 60 | If left(currOS, 19) = "Microsoft Windows Vista" Then |
| 57 | - isWindows7 = true | 61 | + isWindowsVista = TRUE |
| 58 | End If | 62 | End If |
| 59 | End Function | 63 | End Function |
| 60 | 64 | ||
| 61 | Public Function isWindows7() | 65 | Public Function isWindows7() |
| 62 | isWindows7 = false | 66 | isWindows7 = false |
| 63 | If left(currOS, 19) = "Microsoft Windows 7" Then | 67 | If left(currOS, 19) = "Microsoft Windows 7" Then |
| 64 | - isWindows7 = true | 68 | + isWindows7 = TRUE |
| 65 | End If | 69 | End If |
| 66 | End Function | 70 | End Function |
| 67 | 71 | ||
| 68 | Public Function isWindows2008() | 72 | Public Function isWindows2008() |
| 69 | - isWindows7 = false | ||
| 70 | - If left(currOS, 19) = "Microsoft Windows 2008" Then | ||
| 71 | - isWindows7 = true | 73 | + isWindows2008 = false |
| 74 | + If mid(currOS, 27, 42) = "2008 Enterprise" Then | ||
| 75 | + isWindows2008 = TRUE | ||
| 72 | End If | 76 | End If |
| 73 | End Function | 77 | End Function |
| 74 | 78 | ||
| 75 | ' Will call this further down when the individual services need starting | 79 | ' Will call this further down when the individual services need starting |
| 76 | -If doRunAs = true Then | 80 | +If doRunAs = TRUE Then |
| 77 | 'runAs "C:\Program Files (x86)\Zend\ktdms\knowledgetree", "dmsctl_install.bat" | 81 | 'runAs "C:\Program Files (x86)\Zend\ktdms\knowledgetree", "dmsctl_install.bat" |
| 78 | End If | 82 | End If |
| 79 | 83 | ||
| @@ -87,7 +91,7 @@ End Sub | @@ -87,7 +91,7 @@ End Sub | ||
| 87 | dim objArgs, errMsg, result, strUsage, isSuccess | 91 | dim objArgs, errMsg, result, strUsage, isSuccess |
| 88 | 92 | ||
| 89 | strUsage = "USAGE:" &_ | 93 | strUsage = "USAGE:" &_ |
| 90 | -"dmsctl.bat <start|stop|restart|install|uninstall> [servicename]" & vbNewLine &_ | 94 | +"dmsctl.vbs <start|stop|restart|install|uninstall> [servicename]" & vbNewLine &_ |
| 91 | vbNewLine &_ | 95 | vbNewLine &_ |
| 92 | "help - this screen " & vbNewLine &_ | 96 | "help - this screen " & vbNewLine &_ |
| 93 | "start - start the services" & vbNewLine &_ | 97 | "start - start the services" & vbNewLine &_ |
| @@ -100,38 +104,44 @@ vbNewLine &_ | @@ -100,38 +104,44 @@ vbNewLine &_ | ||
| 100 | " only mysql is supported for individual control at this time." | 104 | " only mysql is supported for individual control at this time." |
| 101 | 105 | ||
| 102 | Set objArgs = WScript.Arguments | 106 | Set objArgs = WScript.Arguments |
| 103 | -If objArgs.count < 1 Then | 107 | +If (objArgs.count < 1) Then |
| 104 | Wscript.Echo strUsage | 108 | Wscript.Echo strUsage |
| 105 | Else | 109 | Else |
| 106 | Select Case objArgs.Item(0) | 110 | Select Case objArgs.Item(0) |
| 107 | Case "install" | 111 | Case "install" |
| 108 | - isSuccess = true ' Track if anything went wrong | 112 | + isSuccess = TRUE ' Track if anything went wrong |
| 109 | 113 | ||
| 110 | ' Installing KTOffice | 114 | ' Installing KTOffice |
| 111 | - result = exec("C:\Program Files\Zend\ktdms\knowledgetree\var\bin\officeinstall.bat") | 115 | + result = exec(currDir & "\var\bin\officeinstall.bat") |
| 112 | 116 | ||
| 113 | 'Install Failed | 117 | 'Install Failed |
| 114 | If result = 0 Then | 118 | If result = 0 Then |
| 115 | isSuccess = false | 119 | isSuccess = false |
| 116 | - logEvent "The KnowledgeTree KTOffice service could not be installed" | 120 | + writeLog "The " & KTOFFICE & " KnowledgeTree service could not be installed." |
| 121 | + Else | ||
| 122 | + writeLog "The " & KTOFFICE & " KnowledgeTree service was successfully installed." | ||
| 117 | End If | 123 | End If |
| 118 | 124 | ||
| 119 | ' Installing KTScheduler | 125 | ' Installing KTScheduler |
| 120 | - result = exec("C:\Program Files\Zend\ktdms\knowledgetree\var\bin\schedulerinstall.bat") | 126 | + result = exec(currDir & "\var\bin\schedulerinstall.bat") |
| 121 | 127 | ||
| 122 | 'Install Failed | 128 | 'Install Failed |
| 123 | If result = 0 Then | 129 | If result = 0 Then |
| 124 | isSuccess = false | 130 | isSuccess = false |
| 125 | - logEvent "The KnowledgeTree KTScheduler service could not be installed" | 131 | + writeLog "The " & KTSCHEDULER & " KnowledgeTree service could not be installed." |
| 132 | + Else | ||
| 133 | + writeLog "The " & KTSCHEDULER & " KnowledgeTree service was successfully installed." | ||
| 126 | End If | 134 | End If |
| 127 | 135 | ||
| 128 | ' Installing KTLucene | 136 | ' Installing KTLucene |
| 129 | - result = exec("C:\Program Files\Zend\ktdms\knowledgetree\var\bin\luceneinstall.bat") | 137 | + result = exec(currDir & "\var\bin\luceneinstall.bat") |
| 130 | 138 | ||
| 131 | 'Install Failed | 139 | 'Install Failed |
| 132 | If result = 0 Then | 140 | If result = 0 Then |
| 133 | isSuccess = false | 141 | isSuccess = false |
| 134 | - logEvent "The KnowledgeTree KTLucene service could not be installed" | 142 | + writeLog "The " & KTLUCENE & " KnowledgeTree service could not be installed." |
| 143 | + Else | ||
| 144 | + writeLog "The " & KTLUCENE & " KnowledgeTree service was successfully installed." | ||
| 135 | End If | 145 | End If |
| 136 | 146 | ||
| 137 | If (isSuccess) Then | 147 | If (isSuccess) Then |
| @@ -141,69 +151,254 @@ Else | @@ -141,69 +151,254 @@ Else | ||
| 141 | End If | 151 | End If |
| 142 | 152 | ||
| 143 | Case "start" | 153 | Case "start" |
| 144 | - isSuccess = true | ||
| 145 | - | ||
| 146 | - svcName = KTOFFICE | ||
| 147 | - If (NOT isServiceStarted(svcName)) Then | ||
| 148 | - If (NOT startService(svcName)) Then | ||
| 149 | - isSuccess = false | 154 | + If (objArgs.count > 1) Then |
| 155 | + Select Case objArgs.Item(1) | ||
| 156 | + Case "soffice" | ||
| 157 | + isSuccess = TRUE | ||
| 158 | + svcName = KTOFFICE | ||
| 159 | + If (NOT isServiceStarted(svcName)) Then | ||
| 160 | + If (NOT startService(svcName)) Then | ||
| 161 | + isSuccess = FALSE | ||
| 162 | + writeLog "The " & KTOFFICE & " KnowledgeTree service could not be started. Result Code: " & lastErrorCode | ||
| 163 | + Else | ||
| 164 | + writeLog "The " & KTOFFICE & " KnowledgeTree service was successfully started" | ||
| 165 | + End If | ||
| 166 | + | ||
| 167 | + writeLog "Successfully started " & KTOFFICE | ||
| 168 | + Else | ||
| 169 | + writeLog KTOFFICE & " already started. Result Code: " & lastErrorCode | ||
| 170 | + End If | ||
| 171 | + | ||
| 172 | + If (isSuccess) Then | ||
| 173 | + Wscript.Echo "The " & KTOFFICE & " KnowledgeTree service was successfully started" | ||
| 174 | + Else | ||
| 175 | + Wscript.Echo "The " & KTOFFICE & " KnowledgeTree service could not be started. Result Code: " & lastErrorCode | ||
| 176 | + End If | ||
| 177 | + | ||
| 178 | + Case "scheduler" | ||
| 179 | + isSuccess = TRUE | ||
| 180 | + svcName = KTSCHEDULER | ||
| 181 | + If (NOT isServiceStarted(svcName)) Then | ||
| 182 | + If (NOT startService(svcName)) Then | ||
| 183 | + isSuccess = FALSE | ||
| 184 | + writeLog "The " & KTSCHEDULER & " KnowledgeTree service could not be started. Result Code: " & lastErrorCode | ||
| 185 | + Else | ||
| 186 | + writeLog "The " & KTSCHEDULER & " KnowledgeTree service was successfully started" | ||
| 187 | + End If | ||
| 188 | + | ||
| 189 | + writeLog "Successfully started " & KTSCHEDULER | ||
| 190 | + Else | ||
| 191 | + writeLog KTSCHEDULER & " already started. Result Code: " & lastErrorCode | ||
| 192 | + End If | ||
| 193 | + | ||
| 194 | + If (isSuccess) Then | ||
| 195 | + Wscript.Echo "The " & KTSCHEDULER & " KnowledgeTree service was successfully started" | ||
| 196 | + Else | ||
| 197 | + Wscript.Echo "The " & KTSCHEDULER & " KnowledgeTree service could not be started. Result Code: " & lastErrorCode | ||
| 198 | + End If | ||
| 199 | + | ||
| 200 | + Case "lucene" | ||
| 201 | + isSuccess = TRUE | ||
| 202 | + svcName = KTLUCENE | ||
| 203 | + If (NOT isServiceStarted(svcName)) Then | ||
| 204 | + If (NOT startService(svcName)) Then | ||
| 205 | + isSuccess = false | ||
| 206 | + writeLog "The " & KTLUCENE & " KnowledgeTree service could not be started. Result Code: " & lastErrorCode | ||
| 207 | + Else | ||
| 208 | + writeLog "The " & KTLUCENE & " KnowledgeTree service was successfully started" | ||
| 209 | + End If | ||
| 210 | + | ||
| 211 | + writeLog "Successfully started " & KTLUCENE | ||
| 212 | + Else | ||
| 213 | + writeLog KTLUCENE & " already started. Result Code: " & lastErrorCode | ||
| 214 | + End If | ||
| 215 | + | ||
| 216 | + If (isSuccess) Then | ||
| 217 | + Wscript.Echo "The " & KTLUCENE & " KnowledgeTree service was successfully started" | ||
| 218 | + Else | ||
| 219 | + Wscript.Echo "The " & KTLUCENE & " KnowledgeTree service could not be started. Result Code: " & lastErrorCode | ||
| 220 | + End If | ||
| 221 | + End Select | ||
| 222 | + Else | ||
| 223 | + isSuccess = TRUE | ||
| 224 | + | ||
| 225 | + svcName = KTOFFICE | ||
| 226 | + If (NOT isServiceStarted(svcName)) Then | ||
| 227 | + If (NOT startService(svcName)) Then | ||
| 228 | + isSuccess = false | ||
| 229 | + End If | ||
| 230 | + writeLog "Successfully started " & KTOFFICE | ||
| 231 | + Else | ||
| 232 | + writeLog KTOFFICE & " already started. Result Code: " & lastErrorCode | ||
| 150 | End If | 233 | End If |
| 151 | - End If | ||
| 152 | 234 | ||
| 153 | - svcName = KTSCHEDULER | ||
| 154 | - If (NOT isServiceStarted(svcName)) Then | ||
| 155 | - If (NOT startService(svcName)) Then | ||
| 156 | - isSuccess = false | 235 | + svcName = KTSCHEDULER |
| 236 | + If (NOT isServiceStarted(svcName)) Then | ||
| 237 | + If (NOT startService(svcName)) Then | ||
| 238 | + isSuccess = false | ||
| 239 | + End If | ||
| 240 | + writeLog "Successfully started " & KTSCHEDULER | ||
| 241 | + Else | ||
| 242 | + writeLog KTSCHEDULER & " already started. Result Code: " & lastErrorCode | ||
| 157 | End If | 243 | End If |
| 158 | - End If | ||
| 159 | 244 | ||
| 160 | - svcName = KTLUCENE | ||
| 161 | - If (NOT isServiceStarted(svcName)) Then | ||
| 162 | - If (NOT startService(svcName)) Then | ||
| 163 | - isSuccess = false | 245 | + svcName = KTLUCENE |
| 246 | + If (NOT isServiceStarted(svcName)) Then | ||
| 247 | + If (NOT startService(svcName)) Then | ||
| 248 | + isSuccess = false | ||
| 249 | + End If | ||
| 250 | + writeLog "Successfully started " & KTLUCENE | ||
| 251 | + Else | ||
| 252 | + writeLog KTLUCENE & " already started. Result Code: " & lastErrorCode | ||
| 164 | End If | 253 | End If |
| 165 | - End If | ||
| 166 | 254 | ||
| 167 | - If (isSuccess) Then | ||
| 168 | - Wscript.Echo "The KnowledgeTree services were successfully started" | ||
| 169 | - Else | ||
| 170 | - Wscript.Echo "There were errors starting the KnowledgeTree services please see the log for details ('knowledgetree/var/log/dmsctl.log')" | 255 | + If (isSuccess) Then |
| 256 | + Wscript.Echo "The KnowledgeTree services were successfully started" | ||
| 257 | + Else | ||
| 258 | + Wscript.Echo "There were errors starting the KnowledgeTree services please see the log for details ('knowledgetree/var/log/dmsctl.log')" | ||
| 259 | + End If | ||
| 171 | End If | 260 | End If |
| 172 | - | ||
| 173 | Case "stop" | 261 | Case "stop" |
| 174 | - isSuccess = true | 262 | + If (objArgs.count > 1) Then |
| 263 | + Select Case objArgs.Item(1) | ||
| 264 | + Case "soffice" | ||
| 265 | + isSuccess = TRUE | ||
| 266 | + svcName = KTOFFICE | ||
| 267 | + If (isServiceStarted(svcName)) Then | ||
| 268 | + If (NOT stopService(svcName)) Then | ||
| 269 | + isSuccess = false | ||
| 270 | + writeLog "The " & KTOFFICE & " KnowledgeTree service could not be stopped. Result Code: " & lastErrorCode | ||
| 271 | + Else | ||
| 272 | + writeLog "The " & KTOFFICE & " KnowledgeTree service was successfully stopped" | ||
| 273 | + End If | ||
| 274 | + | ||
| 275 | + writeLog "Successfully stopped " & KTOFFICE | ||
| 276 | + Else | ||
| 277 | + writeLog KTOFFICE & " already stopped. Result Code: " & lastErrorCode | ||
| 278 | + End If | ||
| 279 | + | ||
| 280 | + If (isSuccess) Then | ||
| 281 | + Wscript.Echo "The " & KTOFFICE & " KnowledgeTree service was successfully stopped" | ||
| 282 | + Else | ||
| 283 | + Wscript.Echo "The " & KTOFFICE & " KnowledgeTree service could not be stopped. Result Code: " & lastErrorCode | ||
| 284 | + End If | ||
| 285 | + | ||
| 286 | + Case "scheduler" | ||
| 287 | + isSuccess = TRUE | ||
| 288 | + svcName = KTSCHEDULER | ||
| 289 | + If (isServiceStarted(svcName)) Then | ||
| 290 | + If (NOT stopService(svcName)) Then | ||
| 291 | + isSuccess = false | ||
| 292 | + writeLog "The " & KTSCHEDULER & " KnowledgeTree service could not be stopped. Result Code: " & lastErrorCode | ||
| 293 | + Else | ||
| 294 | + writeLog "The " & KTSCHEDULER & " KnowledgeTree service was successfully stopped" | ||
| 295 | + End If | ||
| 296 | + | ||
| 297 | + writeLog "Successfully stopped " & KTSCHEDULER | ||
| 298 | + Else | ||
| 299 | + writeLog KTSCHEDULER & " already stopped. Result Code: " & lastErrorCode | ||
| 300 | + End If | ||
| 301 | + | ||
| 302 | + If (isSuccess) Then | ||
| 303 | + Wscript.Echo "The " & KTSCHEDULER & " KnowledgeTree service was successfully stopped" | ||
| 304 | + Else | ||
| 305 | + Wscript.Echo "The " & KTSCHEDULER & " KnowledgeTree service could not be stopped. Result Code: " & lastErrorCode | ||
| 306 | + End If | ||
| 307 | + | ||
| 308 | + Case "lucene" | ||
| 309 | + isSuccess = TRUE | ||
| 310 | + svcName = KTLUCENE | ||
| 311 | + If (isServiceStarted(svcName)) Then | ||
| 312 | + If (NOT stopService(svcName)) Then | ||
| 313 | + isSuccess = false | ||
| 314 | + writeLog "The " & KTLUCENE & " KnowledgeTree service could not be stopped. Result Code: " & lastErrorCode | ||
| 315 | + Else | ||
| 316 | + writeLog "The " & KTLUCENE & " KnowledgeTree service was successfully stopped" | ||
| 317 | + End If | ||
| 318 | + | ||
| 319 | + writeLog "Successfully stopped " & KTLUCENE | ||
| 320 | + Else | ||
| 321 | + writeLog KTLUCENE & " already stopped. Result Code: " & lastErrorCode | ||
| 322 | + End If | ||
| 323 | + | ||
| 324 | + If (isSuccess) Then | ||
| 325 | + Wscript.Echo "The " & KTLUCENE & " KnowledgeTree service was successfully stopped" | ||
| 326 | + Else | ||
| 327 | + Wscript.Echo "The " & KTLUCENE & " KnowledgeTree service could not be stopped. Result Code: " & lastErrorCode | ||
| 328 | + End If | ||
| 329 | + End Select | ||
| 330 | + Else | ||
| 331 | + 'Stopping all the services | ||
| 332 | + isSuccess = TRUE | ||
| 333 | + | ||
| 334 | + svcName = KTOFFICE | ||
| 335 | + If (isServiceStarted(svcName)) Then | ||
| 336 | + If (NOT stopService(svcName)) Then | ||
| 337 | + isSuccess = false | ||
| 338 | + End If | ||
| 339 | + writeLog "Successfully stopped " & KTOFFICE | ||
| 340 | + Else | ||
| 341 | + writeLog KTOFFICE & " already stopped. Result Code: " & lastErrorCode | ||
| 342 | + End If | ||
| 343 | + | ||
| 344 | + svcName = KTSCHEDULER | ||
| 345 | + If (isServiceStarted(svcName)) Then | ||
| 346 | + If (NOT stopService(svcName)) Then | ||
| 347 | + isSuccess = false | ||
| 348 | + End If | ||
| 349 | + writeLog "Successfully stopped " & KTSCHEDULER | ||
| 350 | + Else | ||
| 351 | + writeLog KTSCHEDULER & " already stopped. Result Code: " & lastErrorCode | ||
| 352 | + End If | ||
| 353 | + | ||
| 354 | + svcName = KTLUCENE | ||
| 355 | + If (isServiceStarted(svcName)) Then | ||
| 356 | + If (NOT stopService(svcName)) Then | ||
| 357 | + isSuccess = false | ||
| 358 | + End If | ||
| 359 | + writeLog "Successfully stopped " & KTLUCENE | ||
| 360 | + Else | ||
| 361 | + writeLog KTLUCENE & " already stopped. Result Code: " & lastErrorCode | ||
| 362 | + End If | ||
| 363 | + | ||
| 364 | + If (isSuccess) Then | ||
| 365 | + Wscript.Echo "The KnowledgeTree services were successfully stopped" | ||
| 366 | + Else | ||
| 367 | + Wscript.Echo "There were errors sopping the KnowledgeTree services please see the log for details ('knowledgetree/var/log/dmsctl.log')" | ||
| 368 | + End If | ||
| 369 | + End If | ||
| 370 | + | ||
| 371 | + Case "uninstall" | ||
| 372 | + isSuccess = TRUE | ||
| 175 | 373 | ||
| 176 | svcName = KTOFFICE | 374 | svcName = KTOFFICE |
| 177 | - If (isServiceStarted(svcName)) Then | ||
| 178 | - If (NOT stopService(svcName)) Then | ||
| 179 | - isSuccess = false | ||
| 180 | - End If | 375 | + If (NOT uninstallService(svcName)) Then |
| 376 | + isSuccess = false | ||
| 377 | + writeLog "The KnowledgeTree KTOffice service could not be uninstalled" | ||
| 181 | End If | 378 | End If |
| 182 | 379 | ||
| 183 | svcName = KTSCHEDULER | 380 | svcName = KTSCHEDULER |
| 184 | - If (isServiceStarted(svcName)) Then | ||
| 185 | - If (NOT stopService(svcName)) Then | ||
| 186 | - isSuccess = false | ||
| 187 | - End If | 381 | + If (NOT uninstallService(svcName)) Then |
| 382 | + isSuccess = false | ||
| 383 | + writeLog "The KnowledgeTree KTScheduler service could not be uninstalled" | ||
| 188 | End If | 384 | End If |
| 189 | 385 | ||
| 190 | svcName = KTLUCENE | 386 | svcName = KTLUCENE |
| 191 | - If (isServiceStarted(svcName)) Then | ||
| 192 | - If (NOT stopService(svcName)) Then | ||
| 193 | - isSuccess = false | ||
| 194 | - End If | 387 | + If (NOT uninstallService(svcName)) Then |
| 388 | + isSuccess = false | ||
| 389 | + writeLog "The KnowledgeTree KTLucene service could not be uninstalled" | ||
| 195 | End If | 390 | End If |
| 196 | 391 | ||
| 197 | If (isSuccess) Then | 392 | If (isSuccess) Then |
| 198 | - Wscript.Echo "The KnowledgeTree services were successfully stopped" | 393 | + Wscript.Echo "The KnowledgeTree services were uninstalled" |
| 199 | Else | 394 | Else |
| 200 | - Wscript.Echo "There were errors sopping the KnowledgeTree services please see the log for details ('knowledgetree/var/log/dmsctl.log')" | 395 | + Wscript.Echo "There were errors uninstalling the KnowledgeTree services please see the log for details ('knowledgetree/var/log/dmsctl.log')" |
| 201 | End If | 396 | End If |
| 202 | 397 | ||
| 203 | - Case "uninstall" | ||
| 204 | - isSuccess = true ' Track if anything went wrong | 398 | + Case "uninstall_old" 'Depricated : This method prevents verbose error logging, using WMI to uninstall instead |
| 399 | + isSuccess = TRUE ' Track if anything went wrong | ||
| 205 | 400 | ||
| 206 | - ' Stopping Then Uninstalling | 401 | + ' Stopping Then FALSE |
| 207 | 'svcName = KTOFFICE | 402 | 'svcName = KTOFFICE |
| 208 | 'If (isServiceStarted(svcName)) Then | 403 | 'If (isServiceStarted(svcName)) Then |
| 209 | ' If (NOT stopService(svcName)) Then | 404 | ' If (NOT stopService(svcName)) Then |
| @@ -211,16 +406,16 @@ Else | @@ -211,16 +406,16 @@ Else | ||
| 211 | ' End If | 406 | ' End If |
| 212 | 'End If | 407 | 'End If |
| 213 | 408 | ||
| 214 | - ' Uninstalling KTOffice | 409 | + ' FALSE KTOffice |
| 215 | result = exec("sc delete " & KTOFFICE) | 410 | result = exec("sc delete " & KTOFFICE) |
| 216 | 411 | ||
| 217 | 'Uninstall Failed | 412 | 'Uninstall Failed |
| 218 | If result = 0 Then | 413 | If result = 0 Then |
| 219 | isSuccess = false | 414 | isSuccess = false |
| 220 | - logEvent "The KnowledgeTree KTOffice service could not be uninstalled" | 415 | + writeLog "The KnowledgeTree KTOffice service could not be uninstalled" |
| 221 | End If | 416 | End If |
| 222 | 417 | ||
| 223 | - ' Stopping Then Uninstalling | 418 | + ' Stopping Then FALSE |
| 224 | 'svcName = KTSCHEDULER | 419 | 'svcName = KTSCHEDULER |
| 225 | 'If (isServiceStarted(svcName)) Then | 420 | 'If (isServiceStarted(svcName)) Then |
| 226 | ' If (NOT stopService(svcName)) Then | 421 | ' If (NOT stopService(svcName)) Then |
| @@ -228,32 +423,30 @@ Else | @@ -228,32 +423,30 @@ Else | ||
| 228 | ' End If | 423 | ' End If |
| 229 | 'End If | 424 | 'End If |
| 230 | 425 | ||
| 231 | - ' Uninstalling KTScheduler | 426 | + ' FALSE KTScheduler |
| 232 | result = exec("sc delete " & KTSCHEDULER) | 427 | result = exec("sc delete " & KTSCHEDULER) |
| 233 | 428 | ||
| 234 | 'Uninstall Failed | 429 | 'Uninstall Failed |
| 235 | If result = 0 Then | 430 | If result = 0 Then |
| 236 | isSuccess = false | 431 | isSuccess = false |
| 237 | - logEvent "The KnowledgeTree KTScheduler service could not be uninstalled" | 432 | + writeLog "The KnowledgeTree KTScheduler service could not be uninstalled" |
| 238 | End If | 433 | End If |
| 239 | - | ||
| 240 | - | ||
| 241 | 434 | ||
| 242 | - ' Stopping Then Uninstalling | 435 | + ' Stopping Then FALSE |
| 243 | 'svcName = KTLUCENE | 436 | 'svcName = KTLUCENE |
| 244 | 'If (isServiceStarted(svcName)) Then | 437 | 'If (isServiceStarted(svcName)) Then |
| 245 | ' If (NOT stopService(svcName)) Then | 438 | ' If (NOT stopService(svcName)) Then |
| 246 | - ' isSuccess = false | 439 | + ' isSuccess = FALSE |
| 247 | ' End If | 440 | ' End If |
| 248 | 'End If | 441 | 'End If |
| 249 | 442 | ||
| 250 | - ' Uninstalling KTLucene | 443 | + ' FALSE KTLucene |
| 251 | result = exec("sc delete " & KTLUCENE) | 444 | result = exec("sc delete " & KTLUCENE) |
| 252 | 445 | ||
| 253 | 'Uninstall Failed | 446 | 'Uninstall Failed |
| 254 | If result = 0 Then | 447 | If result = 0 Then |
| 255 | - isSuccess = false | ||
| 256 | - logEvent "The KnowledgeTree KTLucene service could not be uninstalled" | 448 | + isSuccess = FALSE |
| 449 | + writeLog "The KnowledgeTree KTLucene service could not be uninstalled" | ||
| 257 | End If | 450 | End If |
| 258 | 451 | ||
| 259 | If (isSuccess) Then | 452 | If (isSuccess) Then |
| @@ -261,21 +454,56 @@ Else | @@ -261,21 +454,56 @@ Else | ||
| 261 | Else | 454 | Else |
| 262 | Wscript.Echo "There were errors uninstalling the KnowledgeTree services please see the log for details ('knowledgetree/var/log/dmsctl.log')" | 455 | Wscript.Echo "There were errors uninstalling the KnowledgeTree services please see the log for details ('knowledgetree/var/log/dmsctl.log')" |
| 263 | End If | 456 | End If |
| 457 | + | ||
| 264 | 458 | ||
| 265 | Case Else | 459 | Case Else |
| 266 | Wscript.Echo strUsage | 460 | Wscript.Echo strUsage |
| 267 | End Select | 461 | End Select |
| 268 | 462 | ||
| 269 | End If | 463 | End If |
| 464 | + | ||
| 465 | +' Method to check if a service is installed | ||
| 466 | +Public Function isServiceInstalled(ByVal svcName) | ||
| 467 | + strComputer = "." | ||
| 468 | + Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\CIMV2") | ||
| 469 | + | ||
| 470 | + ' Obtain an instance of the the class | ||
| 471 | + ' using a key property value. | ||
| 270 | 472 | ||
| 473 | + isServiceInstalled = FALSE | ||
| 474 | + | ||
| 475 | + svcQry = "SELECT * from Win32_Service" | ||
| 476 | + Set objOutParams = objWMIService.ExecQuery(svcQry) | ||
| 477 | + | ||
| 478 | + For Each objSvc in objOutParams | ||
| 479 | + | ||
| 480 | + Select Case objSvc.Name | ||
| 481 | + Case svcName | ||
| 482 | + isServiceInstalled = TRUE | ||
| 483 | + End Select | ||
| 484 | + | ||
| 485 | + Next | ||
| 486 | + | ||
| 487 | + If (Not isServiceInstalled) Then | ||
| 488 | + lastErrorCode = SVC_INVALID_NAME | ||
| 489 | + End If | ||
| 490 | + | ||
| 491 | +End Function | ||
| 492 | + | ||
| 271 | ' Method to interrogate a service | 493 | ' Method to interrogate a service |
| 272 | Public Function isServiceStarted(ByVal svcName) | 494 | Public Function isServiceStarted(ByVal svcName) |
| 495 | + If (NOT isServiceInstalled( svcName )) Then | ||
| 496 | + isServiceStarted = FALSE | ||
| 497 | + Exit Function | ||
| 498 | + End If | ||
| 499 | + | ||
| 273 | strComputer = "." | 500 | strComputer = "." |
| 274 | Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\CIMV2") | 501 | Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\CIMV2") |
| 502 | + | ||
| 275 | ' Obtain an instance of the the class | 503 | ' Obtain an instance of the the class |
| 276 | ' using a key property value. | 504 | ' using a key property value. |
| 277 | Set objShare = objWMIService.Get("Win32_Service.Name='" & svcName & "'") | 505 | Set objShare = objWMIService.Get("Win32_Service.Name='" & svcName & "'") |
| 278 | - | 506 | + |
| 279 | ' no InParameters to define | 507 | ' no InParameters to define |
| 280 | 508 | ||
| 281 | ' Execute the method and obtain the return status. | 509 | ' Execute the method and obtain the return status. |
| @@ -283,16 +511,24 @@ Public Function isServiceStarted(ByVal svcName) | @@ -283,16 +511,24 @@ Public Function isServiceStarted(ByVal svcName) | ||
| 283 | ' is created by the provider. | 511 | ' is created by the provider. |
| 284 | Set objOutParams = objWMIService.ExecMethod("Win32_Service.Name='" & svcName & "'", "InterrogateService") | 512 | Set objOutParams = objWMIService.ExecMethod("Win32_Service.Name='" & svcName & "'", "InterrogateService") |
| 285 | 513 | ||
| 514 | + lastErrorCode = objOutParams.ReturnValue | ||
| 515 | + | ||
| 286 | If (objOutParams.ReturnValue = SVC_SERVICE_NOT_ACTIVE) Then | 516 | If (objOutParams.ReturnValue = SVC_SERVICE_NOT_ACTIVE) Then |
| 287 | isServiceStarted = FALSE | 517 | isServiceStarted = FALSE |
| 288 | Else | 518 | Else |
| 289 | isServiceStarted = TRUE | 519 | isServiceStarted = TRUE |
| 290 | End If | 520 | End If |
| 291 | - | 521 | + |
| 292 | end Function | 522 | end Function |
| 293 | 523 | ||
| 294 | ' Method to start a service | 524 | ' Method to start a service |
| 295 | Public Function startService(ByVal svcName) | 525 | Public Function startService(ByVal svcName) |
| 526 | + If (NOT isServiceInstalled( svcName )) Then | ||
| 527 | + writeLog "The KnowledgeTree " & svcName & " service could not be started because it isn't installed. Run 'dmsctl.vbs install' to correct." | ||
| 528 | + startService = FALSE | ||
| 529 | + Exit Function | ||
| 530 | + End If | ||
| 531 | + | ||
| 296 | strComputer = "." | 532 | strComputer = "." |
| 297 | Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\CIMV2") | 533 | Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\CIMV2") |
| 298 | ' Obtain an instance of the the class | 534 | ' Obtain an instance of the the class |
| @@ -306,6 +542,8 @@ Public Function startService(ByVal svcName) | @@ -306,6 +542,8 @@ Public Function startService(ByVal svcName) | ||
| 306 | ' is created by the provider. | 542 | ' is created by the provider. |
| 307 | Set objOutParams = objWMIService.ExecMethod("Win32_Service.Name='" & svcName & "'", "StartService") | 543 | Set objOutParams = objWMIService.ExecMethod("Win32_Service.Name='" & svcName & "'", "StartService") |
| 308 | 544 | ||
| 545 | + lastErrorCode = objOutParams.ReturnValue | ||
| 546 | + | ||
| 309 | If (objOutParams.ReturnValue = SVC_SUCCESS) Then | 547 | If (objOutParams.ReturnValue = SVC_SUCCESS) Then |
| 310 | startService = TRUE | 548 | startService = TRUE |
| 311 | Else | 549 | Else |
| @@ -316,6 +554,12 @@ End Function | @@ -316,6 +554,12 @@ End Function | ||
| 316 | 554 | ||
| 317 | ' Method to stop a service | 555 | ' Method to stop a service |
| 318 | Public Function stopService(ByVal svcName) | 556 | Public Function stopService(ByVal svcName) |
| 557 | + If (NOT isServiceInstalled( svcName )) Then | ||
| 558 | + writeLog "The KnowledgeTree " & svcName & " service could not be stopped because it isn't installed. Run 'dmsctl.vbs install' to correct." | ||
| 559 | + stopService = FALSE | ||
| 560 | + Exit Function | ||
| 561 | + End If | ||
| 562 | + | ||
| 319 | strComputer = "." | 563 | strComputer = "." |
| 320 | Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\CIMV2") | 564 | Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\CIMV2") |
| 321 | ' Obtain an instance of the the class | 565 | ' Obtain an instance of the the class |
| @@ -328,6 +572,8 @@ Public Function stopService(ByVal svcName) | @@ -328,6 +572,8 @@ Public Function stopService(ByVal svcName) | ||
| 328 | ' The OutParameters object in objOutParams | 572 | ' The OutParameters object in objOutParams |
| 329 | ' is created by the provider. | 573 | ' is created by the provider. |
| 330 | Set objOutParams = objWMIService.ExecMethod("Win32_Service.Name='" & svcName & "'", "StopService") | 574 | Set objOutParams = objWMIService.ExecMethod("Win32_Service.Name='" & svcName & "'", "StopService") |
| 575 | + | ||
| 576 | + lastErrorCode = objOutParams.ReturnValue | ||
| 331 | 577 | ||
| 332 | If (objOutParams.ReturnValue = SVC_SUCCESS) Then | 578 | If (objOutParams.ReturnValue = SVC_SUCCESS) Then |
| 333 | stopService = TRUE | 579 | stopService = TRUE |
| @@ -337,6 +583,49 @@ Public Function stopService(ByVal svcName) | @@ -337,6 +583,49 @@ Public Function stopService(ByVal svcName) | ||
| 337 | 583 | ||
| 338 | End Function | 584 | End Function |
| 339 | 585 | ||
| 586 | +' Method to uninstall a service | ||
| 587 | +Public Function uninstallService(ByVal svcName) | ||
| 588 | + If (NOT isServiceInstalled( svcName )) Then | ||
| 589 | + uninstallService = TRUE ' Service already uninstalled so return TRUE | ||
| 590 | + Exit Function | ||
| 591 | + End If | ||
| 592 | + | ||
| 593 | + wasStopped = TRUE | ||
| 594 | + If (NOT stopService(svcName)) Then | ||
| 595 | + wasStopped = FALSE | ||
| 596 | + End If | ||
| 597 | + | ||
| 598 | + strComputer = "." | ||
| 599 | + Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\CIMV2") | ||
| 600 | + ' Obtain an instance of the the class | ||
| 601 | + ' using a key property value. | ||
| 602 | + Set objShare = objWMIService.Get("Win32_Service.Name='" & svcName & "'") | ||
| 603 | + | ||
| 604 | + ' no InParameters to define | ||
| 605 | + | ||
| 606 | + ' Execute the method and obtain the return status. | ||
| 607 | + ' The OutParameters object in objOutParams | ||
| 608 | + ' is created by the provider. | ||
| 609 | + Set objOutParams = objWMIService.ExecMethod("Win32_Service.Name='" & svcName & "'", "Delete") | ||
| 610 | + | ||
| 611 | + lastErrorCode = objOutParams.ReturnValue | ||
| 612 | + | ||
| 613 | + If (objOutParams.ReturnValue = SVC_SUCCESS) Then | ||
| 614 | + uninstallService = TRUE | ||
| 615 | + Else | ||
| 616 | + uninstallService = FALSE | ||
| 617 | + | ||
| 618 | + ' Extra Event logging to assist the Administrator | ||
| 619 | + If (wasStopped) Then | ||
| 620 | + writeLog "The KnowledgeTree " & svcName & " service could not be uninstalled because it could not be stopped. Stop this service manually before uninstalling." | ||
| 621 | + uninstallService = FALSE ' Must be stop service before it can be uninstalled | ||
| 622 | + End If | ||
| 623 | + | ||
| 624 | + End If | ||
| 625 | + | ||
| 626 | +End Function | ||
| 627 | + | ||
| 628 | + | ||
| 340 | ' Execute a command | 629 | ' Execute a command |
| 341 | Public Function exec(ByVal cmd) | 630 | Public Function exec(ByVal cmd) |
| 342 | 631 | ||
| @@ -363,11 +652,20 @@ End Sub | @@ -363,11 +652,20 @@ End Sub | ||
| 363 | 652 | ||
| 364 | ' Event logging only works on Server 2003, 2000 and XP | 653 | ' Event logging only works on Server 2003, 2000 and XP |
| 365 | Public Sub logEvent(ByVal strMessage) | 654 | Public Sub logEvent(ByVal strMessage) |
| 655 | + ' Disabled until Windows Vista detection has been tested. | ||
| 656 | + 'If (NOT isWindowsVista() AND NOT isWindows7() AND NOT isWindows2008()) Then | ||
| 657 | + ' Const EVENT_SUCCESS = 0 | ||
| 658 | + ' Set objShell = Wscript.CreateObject("Wscript.Shell") | ||
| 659 | + ' objShell.LogEvent EVENT_SUCCESS, strMessage | ||
| 660 | + 'End If | ||
| 661 | +End Sub | ||
| 366 | 662 | ||
| 367 | - If (NOT isWindowsVista() AND NOT isWindows7 AND NOT isWindows2008) Then | ||
| 368 | - Const EVENT_SUCCESS = 0 | ||
| 369 | - Set objShell = Wscript.CreateObject("Wscript.Shell") | ||
| 370 | - objShell.LogEvent EVENT_SUCCESS, strMessage | ||
| 371 | - End If | ||
| 372 | - | 663 | +' Event logging only works on Server 2003, 2000 and XP |
| 664 | +Public Sub writeLog(ByVal strMessage) | ||
| 665 | + Set objFSO = CreateObject("Scripting.FileSystemObject") | ||
| 666 | + ForAppending = 8 | ||
| 667 | + Set objTextFile = objFSO.OpenTextFile (currDir & "\var\log\dmsctl.log", ForAppending, True) | ||
| 668 | + objTextFile.WriteLine strMessage | ||
| 669 | + objTextFile.Close | ||
| 373 | End Sub | 670 | End Sub |
| 671 | + |
setup/upgrade/upgradeWizard.php
| @@ -146,18 +146,6 @@ class UpgradeWizard { | @@ -146,18 +146,6 @@ class UpgradeWizard { | ||
| 146 | } | 146 | } |
| 147 | 147 | ||
| 148 | /** | 148 | /** |
| 149 | - * Create upgrade file | ||
| 150 | - * | ||
| 151 | - * @author KnowledgeTree Team | ||
| 152 | - * @access private | ||
| 153 | - * @param none | ||
| 154 | - * @return void | ||
| 155 | - */ | ||
| 156 | - private function createUpgradeFile() { | ||
| 157 | - touch(SYSTEM_DIR.'var'.DS.'bin'.DS."upgrade.lock"); | ||
| 158 | - } | ||
| 159 | - | ||
| 160 | - /** | ||
| 161 | * Remove upgrade file | 149 | * Remove upgrade file |
| 162 | * | 150 | * |
| 163 | * @author KnowledgeTree Team | 151 | * @author KnowledgeTree Team |
| @@ -222,8 +210,6 @@ class UpgradeWizard { | @@ -222,8 +210,6 @@ class UpgradeWizard { | ||
| 222 | */ | 210 | */ |
| 223 | public function dispatch() { | 211 | public function dispatch() { |
| 224 | $this->load(); | 212 | $this->load(); |
| 225 | - // is this necessary? | ||
| 226 | - $this->createUpgradeFile(); | ||
| 227 | $response = $this->systemChecks(); | 213 | $response = $this->systemChecks(); |
| 228 | if($this->util->installationSpecified()) { // Check if the migrator needs to be accessed | 214 | if($this->util->installationSpecified()) { // Check if the migrator needs to be accessed |
| 229 | $this->util->redirect('../wizard/index.php?step_name=install_type'); | 215 | $this->util->redirect('../wizard/index.php?step_name=install_type'); |
setup/upgrade/upgrader.php
| @@ -400,20 +400,6 @@ class Upgrader { | @@ -400,20 +400,6 @@ class Upgrader { | ||
| 400 | for ($i=1; $i< count($steps)+1; $i++) { | 400 | for ($i=1; $i< count($steps)+1; $i++) { |
| 401 | $this->_upgradeHelper($steps[$i]); | 401 | $this->_upgradeHelper($steps[$i]); |
| 402 | } | 402 | } |
| 403 | - | ||
| 404 | - $this->_completeUpgrade(); | ||
| 405 | - } | ||
| 406 | - | ||
| 407 | - /** | ||
| 408 | - * Complete upgrade cleanup process | ||
| 409 | - * | ||
| 410 | - * @author KnowledgeTree Team | ||
| 411 | - * @param none | ||
| 412 | - * @access private | ||
| 413 | - * @return void | ||
| 414 | - */ | ||
| 415 | - private function _completeUpgrade() { | ||
| 416 | - touch("upgrade"); | ||
| 417 | } | 403 | } |
| 418 | 404 | ||
| 419 | /** | 405 | /** |
setup/wizard/installUtil.php
setup/wizard/lib/services/unixScheduler.php
| @@ -179,7 +179,7 @@ class unixScheduler extends unixService { | @@ -179,7 +179,7 @@ class unixScheduler extends unixService { | ||
| 179 | function start() { | 179 | function start() { |
| 180 | // TODO : Write sh on the fly? Not sure the reasoning here | 180 | // TODO : Write sh on the fly? Not sure the reasoning here |
| 181 | $source = $this->getSchedulerSourceLoc(); | 181 | $source = $this->getSchedulerSourceLoc(); |
| 182 | - $this->writeSchedulerTask(); | 182 | +// $this->writeSchedulerTask(); |
| 183 | $logFile = "/dev/null"; | 183 | $logFile = "/dev/null"; |
| 184 | // @unlink($logFile); | 184 | // @unlink($logFile); |
| 185 | if($source) { // Source | 185 | if($source) { // Source |
setup/wizard/steps/configuration.php
| @@ -247,10 +247,12 @@ class configuration extends Step | @@ -247,10 +247,12 @@ class configuration extends Step | ||
| 247 | public function doRun($edit = false) | 247 | public function doRun($edit = false) |
| 248 | { | 248 | { |
| 249 | $server = $this->getServerInfo(); | 249 | $server = $this->getServerInfo(); |
| 250 | - if(!$edit) $this->temp_variables['server'] = $server; | 250 | + if(!$edit || $this->util->isMigration()) |
| 251 | + $this->temp_variables['server'] = $server; | ||
| 251 | 252 | ||
| 252 | $paths = $this->getPathInfo($server['file_system_root']['value']); | 253 | $paths = $this->getPathInfo($server['file_system_root']['value']); |
| 253 | - if(!$edit) $this->temp_variables['paths'] = $paths; | 254 | + if(!$edit || $this->util->isMigration()) |
| 255 | + $this->temp_variables['paths'] = $paths; | ||
| 254 | 256 | ||
| 255 | // Rewrite file system root | 257 | // Rewrite file system root |
| 256 | if(!$this->fpath) { | 258 | if(!$this->fpath) { |
| @@ -432,13 +434,15 @@ class configuration extends Step | @@ -432,13 +434,15 @@ class configuration extends Step | ||
| 432 | { | 434 | { |
| 433 | if(isset($this->temp_variables['paths'])) { | 435 | if(isset($this->temp_variables['paths'])) { |
| 434 | if ($this->util->isMigration()) { // Check if its an upgrade | 436 | if ($this->util->isMigration()) { // Check if its an upgrade |
| 435 | - $this->readInstallation(); // Read values from config.ini of other installation | 437 | + $this->readConfigPath(); // Read contents of config-path file as only var Documents are used of old stack |
| 438 | + $this->readInstallation(); // Read values from config.ini of other installation and overwrite config-path's | ||
| 436 | $dirs = $this->getFromConfigPath(); // Store contents | 439 | $dirs = $this->getFromConfigPath(); // Store contents |
| 437 | } else { | 440 | } else { |
| 438 | $dirs = $this->temp_variables['paths']; // Pull from temp | 441 | $dirs = $this->temp_variables['paths']; // Pull from temp |
| 439 | } | 442 | } |
| 440 | } else { | 443 | } else { |
| 441 | if ($this->util->isMigration()) { // Check if its an upgrade | 444 | if ($this->util->isMigration()) { // Check if its an upgrade |
| 445 | + $this->readConfigPath(); // Read contents of config-path file as only var Documents are used of old stack | ||
| 442 | $this->readInstallation(); // Read values from config.ini of other installation | 446 | $this->readInstallation(); // Read values from config.ini of other installation |
| 443 | } else { | 447 | } else { |
| 444 | $this->readConfigPath(); // Read contents of config-path file | 448 | $this->readConfigPath(); // Read contents of config-path file |
| @@ -455,13 +459,13 @@ class configuration extends Step | @@ -455,13 +459,13 @@ class configuration extends Step | ||
| 455 | } | 459 | } |
| 456 | if(WINDOWS_OS) | 460 | if(WINDOWS_OS) |
| 457 | $path = preg_replace('/\//', '\\',$path); | 461 | $path = preg_replace('/\//', '\\',$path); |
| 458 | - $dirs[$key]['path'] = $path; | ||
| 459 | - $path = $class = strtolower(substr($path,0,1)).substr($path,1); // Damn you windows | ||
| 460 | - if(isset($dir['file'])) { | ||
| 461 | - $class = $this->util->checkPermission($path, false, true); | ||
| 462 | - } else { | ||
| 463 | - $class = $this->util->checkPermission($path, $dir['create']); | ||
| 464 | - } | 462 | + $dirs[$key]['path'] = $path; |
| 463 | + $path = $class = strtolower(substr($path,0,1)).substr($path,1); // Damn you windows | ||
| 464 | + if(isset($dir['file'])) { | ||
| 465 | + $class = $this->util->checkPermission($path, false, true); | ||
| 466 | + } else { | ||
| 467 | + $class = $this->util->checkPermission($path, $dir['create']); | ||
| 468 | + } | ||
| 465 | if(isset($class['msg'])) { | 469 | if(isset($class['msg'])) { |
| 466 | if($class['class'] != 'tick') { | 470 | if($class['class'] != 'tick') { |
| 467 | $this->temp_variables['paths_perms'] = $class['class']; | 471 | $this->temp_variables['paths_perms'] = $class['class']; |
var/bin/schedulerTask.sh
| @@ -2,11 +2,11 @@ | @@ -2,11 +2,11 @@ | ||
| 2 | PHP_CLI="/usr/local/zend/bin/php" | 2 | PHP_CLI="/usr/local/zend/bin/php" |
| 3 | 3 | ||
| 4 | BIN_DIR=$(dirname $0) | 4 | BIN_DIR=$(dirname $0) |
| 5 | -INSTALL_DIR="../../${BIN_DIR}" | 5 | +INSTALL_DIR="../..${BIN_DIR}" |
| 6 | 6 | ||
| 7 | cd $INSTALL_DIR/bin | 7 | cd $INSTALL_DIR/bin |
| 8 | 8 | ||
| 9 | while true; do | 9 | while true; do |
| 10 | $PHP_CLI -Cq scheduler.php | 10 | $PHP_CLI -Cq scheduler.php |
| 11 | sleep 30 | 11 | sleep 30 |
| 12 | -done | ||
| 13 | \ No newline at end of file | 12 | \ No newline at end of file |
| 13 | +done |