1 | XPDIR ;SFISC/RSD - Install Restart ; 09/29/2005
|
---|
2 | ;;8.0;KERNEL;**30,58,393**;Jul 10, 1995;Build 12
|
---|
3 | EN ;restart install
|
---|
4 | N DIR,DIRUT,POP,XPD,XPDA,XPDD,XPDIJ,XPDDIQ,XPDNM,XPDNOQUE,XPDPKG,XPDST,XPDSET,XPDT,XPDQUIT,XPDQUES,Y,ZTSK,%
|
---|
5 | S %="I $P(^(0),U,9)#3,$D(^XPD(9.7,""ASP"",Y,1,Y)),$D(^XTMP(""XPDI"",Y))",XPDST=$$LOOK^XPDI1(%)
|
---|
6 | Q:'XPDST!$D(XPDQUIT)
|
---|
7 | S ZTSK=$P(^XPD(9.7,XPDST,0),U,6) D:ZTSK
|
---|
8 | .;check if task exist or is queued
|
---|
9 | .D ISQED^%ZTLOAD
|
---|
10 | .;task is queued to run
|
---|
11 | .Q:ZTSK(0)
|
---|
12 | .;task doesn't exist, k ZTSK so it can be re-scheduled
|
---|
13 | .I ZTSK(0)="" K ZTSK Q
|
---|
14 | .D STAT^%ZTLOAD
|
---|
15 | .;task is not define
|
---|
16 | .I 'ZTSK(1) K ZTSK Q
|
---|
17 | .;task is queued to run
|
---|
18 | .Q:ZTSK(1)=1
|
---|
19 | .;task is running, set quit flag
|
---|
20 | .I ZTSK(1)=2 S XPDQUIT=1 W !,"Install is currently running, cannot re-install!" Q
|
---|
21 | .;task finished or was interrupted, kill it so it can be rescheduled
|
---|
22 | .D KILL^%ZTLOAD K ZTSK Q
|
---|
23 | ;abort if there is nothing to install or they '^'
|
---|
24 | G:'$O(XPDT(0))!$D(XPDQUIT) ABORT
|
---|
25 | ;clean out old task, so they can reinstall
|
---|
26 | I '$D(ZTSK) D
|
---|
27 | .N XPD
|
---|
28 | .S XPD(9.7,XPDST_",",5)="" D FILE^DIE("","XPD")
|
---|
29 | I $G(ZTSK) W !!,"This install is already queued as task #",ZTSK,!,"Please use the Taskman Menu if you want to reschedule." G ABORT
|
---|
30 | ;kill XPDT array so that while in XPDI and ABORT is called, nothing is deleted
|
---|
31 | S XPDIJ=0,XPDA=XPDST,XPDNM=$P(^XPD(9.7,XPDA,0),U) K XPDT
|
---|
32 | ;restore environment check variables
|
---|
33 | I $D(^XTMP("XPDI",XPDA,"ENVVAR")) D
|
---|
34 | .S:$D(^XTMP("XPDI",XPDA,"ENVVAR","XPDNOQUE")) XPDNOQUE=^("XPDNOQUE")
|
---|
35 | .I $D(^XTMP("XPDI",XPDA,"ENVVAR","XPDDIQ")) M XPDDIQ=^("XPDDIQ")
|
---|
36 | G DEV^XPDI
|
---|
37 | ;
|
---|
38 | ABORT W !!,"**RESTART ABORTED**",!
|
---|
39 | L -XPD(9.7,XPDST)
|
---|
40 | Q
|
---|