Subversion Repositories wimsdev

Rev

Rev 9188 | Go to most recent revision | Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
8961 bpr 1
 
2
!if $stepcl=$empty
3
 
4
  listyear=!listfile -t $wims_home/backup/oldclasses
5
  !if $listyear=$empty
6
    error=noyear
7
    !exit
8
  !endif
9
  !set cnt=0
10
  !for j in $listyear
11
    listclass$j=!listfile -t $wims_home/backup/oldclasses/$j/*.tgz
12
    listclass$j=!replace internal .tgz by in $(listclass$j)
13
    listclass$j=!replace internal $wims_home/backup/oldclasses/$j/ by in $(listclass$j)
14
    listclass$j=!words2items $(listclass$j)
15
    cnt_=!itemcnt $(listclass$j)
16
    cnt=$[$cnt_+$cnt]
17
  !next
18
!else
19
  !if $clrestore=$empty
20
    error=noclass
21
    !reset stepcl test
22
    !exit
23
  !endif
24
  !if $stepcl=1
25
    date=!char 1 to 8 of $wims_now
26
    month=!char 5 to 6 of $date
27
    !if $month=12
28
      date=$[$date+10000 - 1100]
29
    !else
30
      date=$[$date+100]
31
    !endif
32
    class=!replace internal _ by , in $clrestore
33
    !distribute item $class into year,class
34
    class=!nospace $class
35
    test=!sh cd $wims_home\
36
    cp backup/oldclasses/$year/$class.tgz log/classes/\
37
    cd $wims_home/log/classes/\
38
    if [ ! `ls -d $class | wc -c` -eq 0 ] ; then echo "class already existing; nothing is done" ; exit ; fi ;\
39
    tar xzf $class.tgz\
40
    perl -np -i -e "s:class_expiration=.*:class_expiration=$date:g" $class/.def\
41
    rm $class.tgz\
42
    cd $wims_home; mkdir -p backup2; mv backup/oldclasses/$year/$class.tgz backup2
43
    !if $test!=$empty
44
      error=$test
45
      !reset test stepcl
46
      !sh cd $wims_home/log/classes/ ; rm -f $class.tgz
47
      !exit
48
    !else
49
      !increase stepcl
50
    !endif
51
  !endif
52
!endif
53