diff --git a/dmsctl.sh b/dmsctl.sh index fbe83db..11e7467 100755 --- a/dmsctl.sh +++ b/dmsctl.sh @@ -16,20 +16,37 @@ INSTALL_PATH=`pwd` JAVABIN=/usr/bin/java ZEND_DIR=/usr/local/zend +# exits if the UID is not 0 [root] +check_root_privileges() +{ + ID="id -u" + MYUID=`$ID 2> /dev/null` + if [ ! -z "$MYUID" ]; then + if [ $MYUID != 0 ]; then + echo "You need root privileges to run this script!"; + exit 1 + fi + else + echo "Could not detect UID"; + exit 1 + fi +} + + if [ -f /etc/zce.rc ];then . /etc/zce.rc else echo "/etc/zce.rc doesn't exist!" exit 1; fi - +check_root_privileges # OpenOffice SOFFICEFILE=soffice SOFFICE_PIDFILE=$INSTALL_PATH/var/log/soffice.bin.pid SOFFICE_PID="" SOFFICE_PORT="8100" -SOFFICEBIN=/usr/share/ktdms-office/ktdms-office/openoffice/program/soffice +SOFFICEBIN="/usr/share/ktdms-office/ktdms-office/openoffice/program/soffice" SOFFICE="$SOFFICEBIN -nofirststartwizard -nologo -headless -accept=socket,host=127.0.0.1,port=$SOFFICE_PORT;urp;StarOffice.ServiceManager" SOFFICE_STATUS="" @@ -394,7 +411,38 @@ if [ "x$3" != "x" ]; then fi # Are we running for first time -[[ -e $INSTALL_PATH/var/bin/dmsinit.lock ]] || firstrun +if [ -e "/usr/share/knowledgetree/var/bin/dmsinit.lock" ] +then +echo ""; +else + if grep --quiet LD_LIBRARAY_PATH /etc/zce.rc ; then + echo "Nothing to be done ... maybe" + else + echo "PATH=/usr/local/zend/bin:$PATH" >> /etc/zce.rc + if [ -z $LD_LIBRARY_PATH ] ; then + echo "LD_LIBRARY_PATH=$ZEND_DIR/lib" >> /etc/zce.rc + else + echo "LD_LIBRARY_PATH=$ZEND_DIR/lib:$LD_LIBRARY_PATH" >> /etc/zce.rc + fi + fi + touch $INSTALL_PATH/var/bin/dmsinit.lock + $ZEND_DIR/bin/zendctl.sh restart +fi + +#if [ "ls /usr/share/knowledgetree/var/bin/dmsinit.lock" != "" ] ; then +# echo "No lock" +#e#lse +# echo "lock" +#f#i + +#if [ -f "/usr/share/knowledgetree/var/bin/dmsinit.lock"] ; then +# firstrun +#else +# echo 'safd'; +# exit 1; +#fi + +#[[ -e $INSTALL_PATH/var/bin/dmsinit.lock ]] || firstrun case $1 in help) help diff --git a/dmsctl.vbs b/dmsctl.vbs index 8b952d1..4ce0202 100644 --- a/dmsctl.vbs +++ b/dmsctl.vbs @@ -5,7 +5,7 @@ ' ' Service Name Consts -Const KTOFFICE = "KTOpenOffice" +Const KTOFFICE = "KTOpenoffice" Const KTSCHEDULER = "KTScheduler" Const KTLUCENE = "KTLucene" @@ -36,13 +36,17 @@ Const SVC_INVALID_SERVICES_ACCOUNT = 22 ' Status Invalid Service Account Const SVC_STATUS_SERVICE_EXISTS = 23 ' Status Service Exists Const SVC_SERVICE_ALREADY_PAUSED = 24 ' Service Already Paused -'Detecting current OS -Dim strComputer, currOS, doRunAs +Dim strComputer, currOS, currDir, doRunAs, lastErrorCode + +' Detecting the current directory +Set oFso = CreateObject("Scripting.FileSystemObject") +currDir = oFso.GetParentFolderName(Wscript.ScriptFullName) strComputer = "." currOS = "" doRunAs = false +' Detecting the current OS Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2") Set colOperatingSystems = objWMIService.ExecQuery ("Select * from Win32_OperatingSystem") @@ -52,28 +56,28 @@ For Each objOperatingSystem in colOperatingSystems Next Public Function isWindowsVista() - isWindows7 = false + isWindowsVista = false If left(currOS, 19) = "Microsoft Windows Vista" Then - isWindows7 = true + isWindowsVista = TRUE End If End Function Public Function isWindows7() isWindows7 = false If left(currOS, 19) = "Microsoft Windows 7" Then - isWindows7 = true + isWindows7 = TRUE End If End Function Public Function isWindows2008() - isWindows7 = false - If left(currOS, 19) = "Microsoft Windows 2008" Then - isWindows7 = true + isWindows2008 = false + If mid(currOS, 27, 42) = "2008 Enterprise" Then + isWindows2008 = TRUE End If End Function ' Will call this further down when the individual services need starting -If doRunAs = true Then +If doRunAs = TRUE Then 'runAs "C:\Program Files (x86)\Zend\ktdms\knowledgetree", "dmsctl_install.bat" End If @@ -87,7 +91,7 @@ End Sub dim objArgs, errMsg, result, strUsage, isSuccess strUsage = "USAGE:" &_ -"dmsctl.bat [servicename]" & vbNewLine &_ +"dmsctl.vbs [servicename]" & vbNewLine &_ vbNewLine &_ "help - this screen " & vbNewLine &_ "start - start the services" & vbNewLine &_ @@ -100,38 +104,44 @@ vbNewLine &_ " only mysql is supported for individual control at this time." Set objArgs = WScript.Arguments -If objArgs.count < 1 Then +If (objArgs.count < 1) Then Wscript.Echo strUsage Else Select Case objArgs.Item(0) Case "install" - isSuccess = true ' Track if anything went wrong + isSuccess = TRUE ' Track if anything went wrong ' Installing KTOffice - result = exec("C:\Program Files\Zend\ktdms\knowledgetree\var\bin\officeinstall.bat") + result = exec(currDir & "\var\bin\officeinstall.bat") 'Install Failed If result = 0 Then isSuccess = false - logEvent "The KnowledgeTree KTOffice service could not be installed" + writeLog "The " & KTOFFICE & " KnowledgeTree service could not be installed." + Else + writeLog "The " & KTOFFICE & " KnowledgeTree service was successfully installed." End If ' Installing KTScheduler - result = exec("C:\Program Files\Zend\ktdms\knowledgetree\var\bin\schedulerinstall.bat") + result = exec(currDir & "\var\bin\schedulerinstall.bat") 'Install Failed If result = 0 Then isSuccess = false - logEvent "The KnowledgeTree KTScheduler service could not be installed" + writeLog "The " & KTSCHEDULER & " KnowledgeTree service could not be installed." + Else + writeLog "The " & KTSCHEDULER & " KnowledgeTree service was successfully installed." End If ' Installing KTLucene - result = exec("C:\Program Files\Zend\ktdms\knowledgetree\var\bin\luceneinstall.bat") + result = exec(currDir & "\var\bin\luceneinstall.bat") 'Install Failed If result = 0 Then isSuccess = false - logEvent "The KnowledgeTree KTLucene service could not be installed" + writeLog "The " & KTLUCENE & " KnowledgeTree service could not be installed." + Else + writeLog "The " & KTLUCENE & " KnowledgeTree service was successfully installed." End If If (isSuccess) Then @@ -141,69 +151,254 @@ Else End If Case "start" - isSuccess = true - - svcName = KTOFFICE - If (NOT isServiceStarted(svcName)) Then - If (NOT startService(svcName)) Then - isSuccess = false + If (objArgs.count > 1) Then + Select Case objArgs.Item(1) + Case "soffice" + isSuccess = TRUE + svcName = KTOFFICE + If (NOT isServiceStarted(svcName)) Then + If (NOT startService(svcName)) Then + isSuccess = FALSE + writeLog "The " & KTOFFICE & " KnowledgeTree service could not be started. Result Code: " & lastErrorCode + Else + writeLog "The " & KTOFFICE & " KnowledgeTree service was successfully started" + End If + + writeLog "Successfully started " & KTOFFICE + Else + writeLog KTOFFICE & " already started. Result Code: " & lastErrorCode + End If + + If (isSuccess) Then + Wscript.Echo "The " & KTOFFICE & " KnowledgeTree service was successfully started" + Else + Wscript.Echo "The " & KTOFFICE & " KnowledgeTree service could not be started. Result Code: " & lastErrorCode + End If + + Case "scheduler" + isSuccess = TRUE + svcName = KTSCHEDULER + If (NOT isServiceStarted(svcName)) Then + If (NOT startService(svcName)) Then + isSuccess = FALSE + writeLog "The " & KTSCHEDULER & " KnowledgeTree service could not be started. Result Code: " & lastErrorCode + Else + writeLog "The " & KTSCHEDULER & " KnowledgeTree service was successfully started" + End If + + writeLog "Successfully started " & KTSCHEDULER + Else + writeLog KTSCHEDULER & " already started. Result Code: " & lastErrorCode + End If + + If (isSuccess) Then + Wscript.Echo "The " & KTSCHEDULER & " KnowledgeTree service was successfully started" + Else + Wscript.Echo "The " & KTSCHEDULER & " KnowledgeTree service could not be started. Result Code: " & lastErrorCode + End If + + Case "lucene" + isSuccess = TRUE + svcName = KTLUCENE + If (NOT isServiceStarted(svcName)) Then + If (NOT startService(svcName)) Then + isSuccess = false + writeLog "The " & KTLUCENE & " KnowledgeTree service could not be started. Result Code: " & lastErrorCode + Else + writeLog "The " & KTLUCENE & " KnowledgeTree service was successfully started" + End If + + writeLog "Successfully started " & KTLUCENE + Else + writeLog KTLUCENE & " already started. Result Code: " & lastErrorCode + End If + + If (isSuccess) Then + Wscript.Echo "The " & KTLUCENE & " KnowledgeTree service was successfully started" + Else + Wscript.Echo "The " & KTLUCENE & " KnowledgeTree service could not be started. Result Code: " & lastErrorCode + End If + End Select + Else + isSuccess = TRUE + + svcName = KTOFFICE + If (NOT isServiceStarted(svcName)) Then + If (NOT startService(svcName)) Then + isSuccess = false + End If + writeLog "Successfully started " & KTOFFICE + Else + writeLog KTOFFICE & " already started. Result Code: " & lastErrorCode End If - End If - svcName = KTSCHEDULER - If (NOT isServiceStarted(svcName)) Then - If (NOT startService(svcName)) Then - isSuccess = false + svcName = KTSCHEDULER + If (NOT isServiceStarted(svcName)) Then + If (NOT startService(svcName)) Then + isSuccess = false + End If + writeLog "Successfully started " & KTSCHEDULER + Else + writeLog KTSCHEDULER & " already started. Result Code: " & lastErrorCode End If - End If - svcName = KTLUCENE - If (NOT isServiceStarted(svcName)) Then - If (NOT startService(svcName)) Then - isSuccess = false + svcName = KTLUCENE + If (NOT isServiceStarted(svcName)) Then + If (NOT startService(svcName)) Then + isSuccess = false + End If + writeLog "Successfully started " & KTLUCENE + Else + writeLog KTLUCENE & " already started. Result Code: " & lastErrorCode End If - End If - If (isSuccess) Then - Wscript.Echo "The KnowledgeTree services were successfully started" - Else - Wscript.Echo "There were errors starting the KnowledgeTree services please see the log for details ('knowledgetree/var/log/dmsctl.log')" + If (isSuccess) Then + Wscript.Echo "The KnowledgeTree services were successfully started" + Else + Wscript.Echo "There were errors starting the KnowledgeTree services please see the log for details ('knowledgetree/var/log/dmsctl.log')" + End If End If - Case "stop" - isSuccess = true + If (objArgs.count > 1) Then + Select Case objArgs.Item(1) + Case "soffice" + isSuccess = TRUE + svcName = KTOFFICE + If (isServiceStarted(svcName)) Then + If (NOT stopService(svcName)) Then + isSuccess = false + writeLog "The " & KTOFFICE & " KnowledgeTree service could not be stopped. Result Code: " & lastErrorCode + Else + writeLog "The " & KTOFFICE & " KnowledgeTree service was successfully stopped" + End If + + writeLog "Successfully stopped " & KTOFFICE + Else + writeLog KTOFFICE & " already stopped. Result Code: " & lastErrorCode + End If + + If (isSuccess) Then + Wscript.Echo "The " & KTOFFICE & " KnowledgeTree service was successfully stopped" + Else + Wscript.Echo "The " & KTOFFICE & " KnowledgeTree service could not be stopped. Result Code: " & lastErrorCode + End If + + Case "scheduler" + isSuccess = TRUE + svcName = KTSCHEDULER + If (isServiceStarted(svcName)) Then + If (NOT stopService(svcName)) Then + isSuccess = false + writeLog "The " & KTSCHEDULER & " KnowledgeTree service could not be stopped. Result Code: " & lastErrorCode + Else + writeLog "The " & KTSCHEDULER & " KnowledgeTree service was successfully stopped" + End If + + writeLog "Successfully stopped " & KTSCHEDULER + Else + writeLog KTSCHEDULER & " already stopped. Result Code: " & lastErrorCode + End If + + If (isSuccess) Then + Wscript.Echo "The " & KTSCHEDULER & " KnowledgeTree service was successfully stopped" + Else + Wscript.Echo "The " & KTSCHEDULER & " KnowledgeTree service could not be stopped. Result Code: " & lastErrorCode + End If + + Case "lucene" + isSuccess = TRUE + svcName = KTLUCENE + If (isServiceStarted(svcName)) Then + If (NOT stopService(svcName)) Then + isSuccess = false + writeLog "The " & KTLUCENE & " KnowledgeTree service could not be stopped. Result Code: " & lastErrorCode + Else + writeLog "The " & KTLUCENE & " KnowledgeTree service was successfully stopped" + End If + + writeLog "Successfully stopped " & KTLUCENE + Else + writeLog KTLUCENE & " already stopped. Result Code: " & lastErrorCode + End If + + If (isSuccess) Then + Wscript.Echo "The " & KTLUCENE & " KnowledgeTree service was successfully stopped" + Else + Wscript.Echo "The " & KTLUCENE & " KnowledgeTree service could not be stopped. Result Code: " & lastErrorCode + End If + End Select + Else + 'Stopping all the services + isSuccess = TRUE + + svcName = KTOFFICE + If (isServiceStarted(svcName)) Then + If (NOT stopService(svcName)) Then + isSuccess = false + End If + writeLog "Successfully stopped " & KTOFFICE + Else + writeLog KTOFFICE & " already stopped. Result Code: " & lastErrorCode + End If + + svcName = KTSCHEDULER + If (isServiceStarted(svcName)) Then + If (NOT stopService(svcName)) Then + isSuccess = false + End If + writeLog "Successfully stopped " & KTSCHEDULER + Else + writeLog KTSCHEDULER & " already stopped. Result Code: " & lastErrorCode + End If + + svcName = KTLUCENE + If (isServiceStarted(svcName)) Then + If (NOT stopService(svcName)) Then + isSuccess = false + End If + writeLog "Successfully stopped " & KTLUCENE + Else + writeLog KTLUCENE & " already stopped. Result Code: " & lastErrorCode + End If + + If (isSuccess) Then + Wscript.Echo "The KnowledgeTree services were successfully stopped" + Else + Wscript.Echo "There were errors sopping the KnowledgeTree services please see the log for details ('knowledgetree/var/log/dmsctl.log')" + End If + End If + + Case "uninstall" + isSuccess = TRUE svcName = KTOFFICE - If (isServiceStarted(svcName)) Then - If (NOT stopService(svcName)) Then - isSuccess = false - End If + If (NOT uninstallService(svcName)) Then + isSuccess = false + writeLog "The KnowledgeTree KTOffice service could not be uninstalled" End If svcName = KTSCHEDULER - If (isServiceStarted(svcName)) Then - If (NOT stopService(svcName)) Then - isSuccess = false - End If + If (NOT uninstallService(svcName)) Then + isSuccess = false + writeLog "The KnowledgeTree KTScheduler service could not be uninstalled" End If svcName = KTLUCENE - If (isServiceStarted(svcName)) Then - If (NOT stopService(svcName)) Then - isSuccess = false - End If + If (NOT uninstallService(svcName)) Then + isSuccess = false + writeLog "The KnowledgeTree KTLucene service could not be uninstalled" End If If (isSuccess) Then - Wscript.Echo "The KnowledgeTree services were successfully stopped" + Wscript.Echo "The KnowledgeTree services were uninstalled" Else - Wscript.Echo "There were errors sopping the KnowledgeTree services please see the log for details ('knowledgetree/var/log/dmsctl.log')" + Wscript.Echo "There were errors uninstalling the KnowledgeTree services please see the log for details ('knowledgetree/var/log/dmsctl.log')" End If - Case "uninstall" - isSuccess = true ' Track if anything went wrong + Case "uninstall_old" 'Depricated : This method prevents verbose error logging, using WMI to uninstall instead + isSuccess = TRUE ' Track if anything went wrong - ' Stopping Then Uninstalling + ' Stopping Then FALSE 'svcName = KTOFFICE 'If (isServiceStarted(svcName)) Then ' If (NOT stopService(svcName)) Then @@ -211,16 +406,16 @@ Else ' End If 'End If - ' Uninstalling KTOffice + ' FALSE KTOffice result = exec("sc delete " & KTOFFICE) 'Uninstall Failed If result = 0 Then isSuccess = false - logEvent "The KnowledgeTree KTOffice service could not be uninstalled" + writeLog "The KnowledgeTree KTOffice service could not be uninstalled" End If - ' Stopping Then Uninstalling + ' Stopping Then FALSE 'svcName = KTSCHEDULER 'If (isServiceStarted(svcName)) Then ' If (NOT stopService(svcName)) Then @@ -228,32 +423,30 @@ Else ' End If 'End If - ' Uninstalling KTScheduler + ' FALSE KTScheduler result = exec("sc delete " & KTSCHEDULER) 'Uninstall Failed If result = 0 Then isSuccess = false - logEvent "The KnowledgeTree KTScheduler service could not be uninstalled" + writeLog "The KnowledgeTree KTScheduler service could not be uninstalled" End If - - - ' Stopping Then Uninstalling + ' Stopping Then FALSE 'svcName = KTLUCENE 'If (isServiceStarted(svcName)) Then ' If (NOT stopService(svcName)) Then - ' isSuccess = false + ' isSuccess = FALSE ' End If 'End If - ' Uninstalling KTLucene + ' FALSE KTLucene result = exec("sc delete " & KTLUCENE) 'Uninstall Failed If result = 0 Then - isSuccess = false - logEvent "The KnowledgeTree KTLucene service could not be uninstalled" + isSuccess = FALSE + writeLog "The KnowledgeTree KTLucene service could not be uninstalled" End If If (isSuccess) Then @@ -261,21 +454,56 @@ Else Else Wscript.Echo "There were errors uninstalling the KnowledgeTree services please see the log for details ('knowledgetree/var/log/dmsctl.log')" End If + Case Else Wscript.Echo strUsage End Select End If + +' Method to check if a service is installed +Public Function isServiceInstalled(ByVal svcName) + strComputer = "." + Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\CIMV2") + + ' Obtain an instance of the the class + ' using a key property value. + isServiceInstalled = FALSE + + svcQry = "SELECT * from Win32_Service" + Set objOutParams = objWMIService.ExecQuery(svcQry) + + For Each objSvc in objOutParams + + Select Case objSvc.Name + Case svcName + isServiceInstalled = TRUE + End Select + + Next + + If (Not isServiceInstalled) Then + lastErrorCode = SVC_INVALID_NAME + End If + +End Function + ' Method to interrogate a service Public Function isServiceStarted(ByVal svcName) + If (NOT isServiceInstalled( svcName )) Then + isServiceStarted = FALSE + Exit Function + End If + strComputer = "." Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\CIMV2") + ' Obtain an instance of the the class ' using a key property value. Set objShare = objWMIService.Get("Win32_Service.Name='" & svcName & "'") - + ' no InParameters to define ' Execute the method and obtain the return status. @@ -283,16 +511,24 @@ Public Function isServiceStarted(ByVal svcName) ' is created by the provider. Set objOutParams = objWMIService.ExecMethod("Win32_Service.Name='" & svcName & "'", "InterrogateService") + lastErrorCode = objOutParams.ReturnValue + If (objOutParams.ReturnValue = SVC_SERVICE_NOT_ACTIVE) Then isServiceStarted = FALSE Else isServiceStarted = TRUE End If - + end Function ' Method to start a service Public Function startService(ByVal svcName) + If (NOT isServiceInstalled( svcName )) Then + writeLog "The KnowledgeTree " & svcName & " service could not be started because it isn't installed. Run 'dmsctl.vbs install' to correct." + startService = FALSE + Exit Function + End If + strComputer = "." Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\CIMV2") ' Obtain an instance of the the class @@ -306,6 +542,8 @@ Public Function startService(ByVal svcName) ' is created by the provider. Set objOutParams = objWMIService.ExecMethod("Win32_Service.Name='" & svcName & "'", "StartService") + lastErrorCode = objOutParams.ReturnValue + If (objOutParams.ReturnValue = SVC_SUCCESS) Then startService = TRUE Else @@ -316,6 +554,12 @@ End Function ' Method to stop a service Public Function stopService(ByVal svcName) + If (NOT isServiceInstalled( svcName )) Then + writeLog "The KnowledgeTree " & svcName & " service could not be stopped because it isn't installed. Run 'dmsctl.vbs install' to correct." + stopService = FALSE + Exit Function + End If + strComputer = "." Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\CIMV2") ' Obtain an instance of the the class @@ -328,6 +572,8 @@ Public Function stopService(ByVal svcName) ' The OutParameters object in objOutParams ' is created by the provider. Set objOutParams = objWMIService.ExecMethod("Win32_Service.Name='" & svcName & "'", "StopService") + + lastErrorCode = objOutParams.ReturnValue If (objOutParams.ReturnValue = SVC_SUCCESS) Then stopService = TRUE @@ -337,6 +583,49 @@ Public Function stopService(ByVal svcName) End Function +' Method to uninstall a service +Public Function uninstallService(ByVal svcName) + If (NOT isServiceInstalled( svcName )) Then + uninstallService = TRUE ' Service already uninstalled so return TRUE + Exit Function + End If + + wasStopped = TRUE + If (NOT stopService(svcName)) Then + wasStopped = FALSE + End If + + strComputer = "." + Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\CIMV2") + ' Obtain an instance of the the class + ' using a key property value. + Set objShare = objWMIService.Get("Win32_Service.Name='" & svcName & "'") + + ' no InParameters to define + + ' Execute the method and obtain the return status. + ' The OutParameters object in objOutParams + ' is created by the provider. + Set objOutParams = objWMIService.ExecMethod("Win32_Service.Name='" & svcName & "'", "Delete") + + lastErrorCode = objOutParams.ReturnValue + + If (objOutParams.ReturnValue = SVC_SUCCESS) Then + uninstallService = TRUE + Else + uninstallService = FALSE + + ' Extra Event logging to assist the Administrator + If (wasStopped) Then + writeLog "The KnowledgeTree " & svcName & " service could not be uninstalled because it could not be stopped. Stop this service manually before uninstalling." + uninstallService = FALSE ' Must be stop service before it can be uninstalled + End If + + End If + +End Function + + ' Execute a command Public Function exec(ByVal cmd) @@ -363,11 +652,20 @@ End Sub ' Event logging only works on Server 2003, 2000 and XP Public Sub logEvent(ByVal strMessage) + ' Disabled until Windows Vista detection has been tested. + 'If (NOT isWindowsVista() AND NOT isWindows7() AND NOT isWindows2008()) Then + ' Const EVENT_SUCCESS = 0 + ' Set objShell = Wscript.CreateObject("Wscript.Shell") + ' objShell.LogEvent EVENT_SUCCESS, strMessage + 'End If +End Sub - If (NOT isWindowsVista() AND NOT isWindows7 AND NOT isWindows2008) Then - Const EVENT_SUCCESS = 0 - Set objShell = Wscript.CreateObject("Wscript.Shell") - objShell.LogEvent EVENT_SUCCESS, strMessage - End If - +' Event logging only works on Server 2003, 2000 and XP +Public Sub writeLog(ByVal strMessage) + Set objFSO = CreateObject("Scripting.FileSystemObject") + ForAppending = 8 + Set objTextFile = objFSO.OpenTextFile (currDir & "\var\log\dmsctl.log", ForAppending, True) + objTextFile.WriteLine strMessage + objTextFile.Close End Sub + diff --git a/setup/upgrade/upgradeWizard.php b/setup/upgrade/upgradeWizard.php index f41a73e..1e4c873 100644 --- a/setup/upgrade/upgradeWizard.php +++ b/setup/upgrade/upgradeWizard.php @@ -146,18 +146,6 @@ class UpgradeWizard { } /** - * Create upgrade file - * - * @author KnowledgeTree Team - * @access private - * @param none - * @return void - */ - private function createUpgradeFile() { - touch(SYSTEM_DIR.'var'.DS.'bin'.DS."upgrade.lock"); - } - - /** * Remove upgrade file * * @author KnowledgeTree Team @@ -222,8 +210,6 @@ class UpgradeWizard { */ public function dispatch() { $this->load(); - // is this necessary? - $this->createUpgradeFile(); $response = $this->systemChecks(); if($this->util->installationSpecified()) { // Check if the migrator needs to be accessed $this->util->redirect('../wizard/index.php?step_name=install_type'); diff --git a/setup/upgrade/upgrader.php b/setup/upgrade/upgrader.php index ccabb71..7ceb3f1 100644 --- a/setup/upgrade/upgrader.php +++ b/setup/upgrade/upgrader.php @@ -400,20 +400,6 @@ class Upgrader { for ($i=1; $i< count($steps)+1; $i++) { $this->_upgradeHelper($steps[$i]); } - - $this->_completeUpgrade(); - } - - /** - * Complete upgrade cleanup process - * - * @author KnowledgeTree Team - * @param none - * @access private - * @return void - */ - private function _completeUpgrade() { - touch("upgrade"); } /** diff --git a/setup/wizard/installUtil.php b/setup/wizard/installUtil.php index 9a4f87a..400bd7f 100644 --- a/setup/wizard/installUtil.php +++ b/setup/wizard/installUtil.php @@ -878,7 +878,7 @@ class InstallUtil { return $type; } - return false; + return "community"; } /** diff --git a/setup/wizard/lib/services/unixScheduler.php b/setup/wizard/lib/services/unixScheduler.php index deb5c80..a1235eb 100644 --- a/setup/wizard/lib/services/unixScheduler.php +++ b/setup/wizard/lib/services/unixScheduler.php @@ -179,7 +179,7 @@ class unixScheduler extends unixService { function start() { // TODO : Write sh on the fly? Not sure the reasoning here $source = $this->getSchedulerSourceLoc(); - $this->writeSchedulerTask(); +// $this->writeSchedulerTask(); $logFile = "/dev/null"; // @unlink($logFile); if($source) { // Source diff --git a/setup/wizard/steps/configuration.php b/setup/wizard/steps/configuration.php index bd64d0e..2a0ffc6 100644 --- a/setup/wizard/steps/configuration.php +++ b/setup/wizard/steps/configuration.php @@ -247,10 +247,12 @@ class configuration extends Step public function doRun($edit = false) { $server = $this->getServerInfo(); - if(!$edit) $this->temp_variables['server'] = $server; + if(!$edit || $this->util->isMigration()) + $this->temp_variables['server'] = $server; $paths = $this->getPathInfo($server['file_system_root']['value']); - if(!$edit) $this->temp_variables['paths'] = $paths; + if(!$edit || $this->util->isMigration()) + $this->temp_variables['paths'] = $paths; // Rewrite file system root if(!$this->fpath) { @@ -432,13 +434,15 @@ class configuration extends Step { if(isset($this->temp_variables['paths'])) { if ($this->util->isMigration()) { // Check if its an upgrade - $this->readInstallation(); // Read values from config.ini of other installation + $this->readConfigPath(); // Read contents of config-path file as only var Documents are used of old stack + $this->readInstallation(); // Read values from config.ini of other installation and overwrite config-path's $dirs = $this->getFromConfigPath(); // Store contents } else { $dirs = $this->temp_variables['paths']; // Pull from temp } } else { if ($this->util->isMigration()) { // Check if its an upgrade + $this->readConfigPath(); // Read contents of config-path file as only var Documents are used of old stack $this->readInstallation(); // Read values from config.ini of other installation } else { $this->readConfigPath(); // Read contents of config-path file @@ -455,13 +459,13 @@ class configuration extends Step } if(WINDOWS_OS) $path = preg_replace('/\//', '\\',$path); - $dirs[$key]['path'] = $path; - $path = $class = strtolower(substr($path,0,1)).substr($path,1); // Damn you windows - if(isset($dir['file'])) { - $class = $this->util->checkPermission($path, false, true); - } else { - $class = $this->util->checkPermission($path, $dir['create']); - } + $dirs[$key]['path'] = $path; + $path = $class = strtolower(substr($path,0,1)).substr($path,1); // Damn you windows + if(isset($dir['file'])) { + $class = $this->util->checkPermission($path, false, true); + } else { + $class = $this->util->checkPermission($path, $dir['create']); + } if(isset($class['msg'])) { if($class['class'] != 'tick') { $this->temp_variables['paths_perms'] = $class['class']; diff --git a/var/bin/schedulerTask.sh b/var/bin/schedulerTask.sh index 93ce1c8..4e7d69c 100755 --- a/var/bin/schedulerTask.sh +++ b/var/bin/schedulerTask.sh @@ -2,11 +2,11 @@ PHP_CLI="/usr/local/zend/bin/php" BIN_DIR=$(dirname $0) -INSTALL_DIR="../../${BIN_DIR}" +INSTALL_DIR="../..${BIN_DIR}" cd $INSTALL_DIR/bin while true; do $PHP_CLI -Cq scheduler.php sleep 30 -done \ No newline at end of file +done