Subversion Repositories wimsdev

Rev

Rev 16091 | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
23 reyssat 1
!bound restore within replace,merge default merge
2
 
3
v=!record 0 of wimshome/$wims_sesdir/upload/class/version
4
v=!word 1 of $v
10714 bpr 5
!if $v=$empty or $v<4
12414 bpr 6
  error=no_upload
7
  !exit
23 reyssat 8
!endif
9
serial=!record 0 of wimshome/$wims_sesdir/upload/class/serial
10
serial=!word 1 of $serial
11
!readdef wimshome/log/classes/$wims_class/neighbors
12
 
13
sharing=
14
!for r in $sharelist
12414 bpr 15
  !if $(sharing_$r)!=$empty
16
    sharing=!append item $r to $sharing
17
  !endif
23 reyssat 18
!endif
19
sharing=!append item log,neighbor to $sharing
20
 
21
safe=!listcomplement def,sup in $reclist
22
selection=!replace item all by $safe in $selection
23
sel=!listintersect $selection and $reclist
24
sel=!listcomplement $sharing in $sel
25
!if $sel=$empty
12414 bpr 26
  no_selection=yes
27
  !read arch/upload.proc
28
  job2=upload
29
  !exit
23 reyssat 30
!endif
31
selw=!items2words $sel
32
dictionary=$module_dir/arch/recdep
33
dep=!exec translator $selw
34
copy=!words2items $selw $dep
35
copy=!listuniq $copy
16091 guerimand 36
copy=!listcomplement $forbiddenlistdep in $copy
23 reyssat 37
 
3974 guerimand 38
!! ----------------------------- restore of user when replace or merge
23 reyssat 39
!if user isitemof $copy
12413 bpr 40
  n=!recordcnt wimshome/$wims_sesdir/upload/class/.userlist
41
  !read adm/class/userremain.proc
42
  m=!recordcnt wimshome/log/classes/$wims_class/.userlist
43
  !if $restore=merge
44
    !if $n>$dispo
45
      user_bad=refused
46
      copy=!listcomplement user,score in $copy
47
    !endif
3974 guerimand 48
  !else
12413 bpr 49
    !if ($n>$dispo and $class_superclass!=$empty) or ($class_superclass=$empty and $n>$dispo+$m)
50
      user_bad=refused
51
      copy=!listcomplement user,score in $copy
3974 guerimand 52
    !else
12413 bpr 53
      !if $m>0
54
        erase=user
55
      !endif
3974 guerimand 56
    !endif
12413 bpr 57
  !endif
58
  !if ($wims_supertype=4 or $wims_supertype=2)
59
    !if $class_typename=class
60
      !if user isin $erase
61
        !for k=1 to $m
62
          u=!record $k of wimshome/log/classes/$wims_class/.userlist
63
          t=!defof user_participate in wimshome/log/classes/$wims_superclass/.users/$(u[3])
64
          t=!listcomplement $wims_class in $t
65
          !setdef !set user_participate=$t in wimshome/log/classes/$wims_superclass/.users/$(u[3])
66
        !next k
67
      !endif
68
      !reset user_ok,user_loginused
69
      !for k=1 to $n
70
        u=!record $k of wimshome/$wims_sesdir/upload/class/.userlist
71
        test=!defof user_exists in wimshome/log/classes/$wims_superclass/.users/$(u[3])
72
        !if $test!=$empty
73
          user_loginused=!append item $(u[3]) to $(user_loginused)
74
          !sh rm -f $wims_home/$wims_sesdir/upload/class/.users/$(u[3]) $wims_home/$wims_sesdir/upload/class/score/$(u[3]) $wims_home/$wims_sesdir/upload/class/noscore/$(u[3]);
75
        !else
76
          user_ok=!append item $(u[3]) to $user_ok
77
        !endif
78
      !next k
79
      !sh cd $wims_home/$wims_sesdir/upload/class/;\
3974 guerimand 80
cp -pR .users $wims_home/log/classes/$wims_superclass/;
12413 bpr 81
      !for u in $user_ok
82
        !setdef !set user_participate=$wims_class in wimshome/log/classes/$wims_superclass/.users/$u
83
      !next k
84
    !endif
85
    copy=!listcomplement user in $copy
86
    !readproc adm/class/mkuserlist
3974 guerimand 87
  !endif
23 reyssat 88
!endif
89
 
90
!if $restore=replace
12413 bpr 91
  erase=$copy
23 reyssat 92
!else
12413 bpr 93
  erase=!listcomplement user,exo in $copy
23 reyssat 94
!endif
95
copyw=!items2words $copy
96
erasew=!items2words $erase
97
dictionary=$module_dir/arch/recdir
98
copylist=!exec translator $copyw
99
eraselist=!exec translator $erasew
100
c=!replace , by , $ in $copy
2477 bpr 101
dictionary=$module_dir/lang/recnames.$moduclass_lang
23 reyssat 102
restored=!exec translator $c
103
 
104
!distribute words y y y y y y y y y y y y y y y y y y y y y y y into $copy
105
 
106
!if def isitemof $copy
12413 bpr 107
  creat=!defof class_creation in wimshome/log/classes/$wims_class/.def
23 reyssat 108
!endif
109
 
16013 guerimand 110
!if y=$def
111
  !readproc arch/restoredef.proc
112
!endif
23 reyssat 113
!mexec arch/restore.sh
4598 bpr 114
wims_class_log=Restore $copy from $wims_deposit by $wims_realuser
23 reyssat 115
selection=
116
 
117
!if user isitemof $copy
12413 bpr 118
  !read adm/class/mkuserlist
23 reyssat 119
!endif
120
 
17924 bpr 121
!! Attention la restauration de la sauvegarde ne devrait pas pouvoir modifier la variable class_expiration des sous classes d'un groupement ou d'un portail (il y a un correctif à effectuer).
23 reyssat 122
!if def isitemof $copy
12413 bpr 123
  !setdef !set class_creation=$creat in wimshome/log/classes/$wims_class/.def
124
  exp=!defof class_expiration in wimshome/log/classes/$wims_class/.def
125
  today=!char 1 to 8 of $wims_now
126
  later=!date -d '2 months' '+%Y%m%d'
127
  !if NaN isin $[$exp]
128
    exp_bad=bad
129
    exp=$later
130
  !endif
131
  !if $exp<$later
132
    exp=$later
133
    exp_bad=early
134
  !endif
135
  !if $exp>$today+10000
136
    exp=$[$today+10000]
137
    exp_bad=late
138
  !endif
139
  !if $exp_bad!=$empty
140
    !setdef !set class_expiration=$exp in wimshome/log/classes/$wims_class/.def
141
  !endif
16013 guerimand 142
!!  !mexec scripts/classlist.sh   this script don't exist
23 reyssat 143
!endif
144
 
10132 bpr 145
!read adm/class/stat