Home   Package List   Routine Alphabetical List   Global Alphabetical List   FileMan Files List   FileMan Sub-Files List   Package Component Lists   Package-Namespace Mapping  
Routine: XPDIR

XPDIR.m

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