Subversion Repositories wimsdev

Rev

Rev 13181 | Rev 16091 | Go to most recent revision | 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
36
 
3974 guerimand 37
!! ----------------------------- restore of user when replace or merge
23 reyssat 38
!if user isitemof $copy
12413 bpr 39
  n=!recordcnt wimshome/$wims_sesdir/upload/class/.userlist
40
  !read adm/class/userremain.proc
41
  m=!recordcnt wimshome/log/classes/$wims_class/.userlist
42
  !if $restore=merge
43
    !if $n>$dispo
44
      user_bad=refused
45
      copy=!listcomplement user,score in $copy
46
    !endif
3974 guerimand 47
  !else
12413 bpr 48
    !if ($n>$dispo and $class_superclass!=$empty) or ($class_superclass=$empty and $n>$dispo+$m)
49
      user_bad=refused
50
      copy=!listcomplement user,score in $copy
3974 guerimand 51
    !else
12413 bpr 52
      !if $m>0
53
        erase=user
54
      !endif
3974 guerimand 55
    !endif
12413 bpr 56
  !endif
57
  !if ($wims_supertype=4 or $wims_supertype=2)
58
    !if $class_typename=class
59
      !if user isin $erase
60
        !for k=1 to $m
61
          u=!record $k of wimshome/log/classes/$wims_class/.userlist
62
          t=!defof user_participate in wimshome/log/classes/$wims_superclass/.users/$(u[3])
63
          t=!listcomplement $wims_class in $t
64
          !setdef !set user_participate=$t in wimshome/log/classes/$wims_superclass/.users/$(u[3])
65
        !next k
66
      !endif
67
      !reset user_ok,user_loginused
68
      !for k=1 to $n
69
        u=!record $k of wimshome/$wims_sesdir/upload/class/.userlist
70
        test=!defof user_exists in wimshome/log/classes/$wims_superclass/.users/$(u[3])
71
        !if $test!=$empty
72
          user_loginused=!append item $(u[3]) to $(user_loginused)
73
          !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]);
74
        !else
75
          user_ok=!append item $(u[3]) to $user_ok
76
        !endif
77
      !next k
78
      !sh cd $wims_home/$wims_sesdir/upload/class/;\
3974 guerimand 79
cp -pR .users $wims_home/log/classes/$wims_superclass/;
12413 bpr 80
      !for u in $user_ok
81
        !setdef !set user_participate=$wims_class in wimshome/log/classes/$wims_superclass/.users/$u
82
      !next k
83
    !endif
84
    copy=!listcomplement user in $copy
85
    !readproc adm/class/mkuserlist
3974 guerimand 86
  !endif
23 reyssat 87
!endif
88
 
89
!if $restore=replace
12413 bpr 90
  erase=$copy
23 reyssat 91
!else
12413 bpr 92
  erase=!listcomplement user,exo in $copy
23 reyssat 93
!endif
94
copyw=!items2words $copy
95
erasew=!items2words $erase
96
dictionary=$module_dir/arch/recdir
97
copylist=!exec translator $copyw
98
eraselist=!exec translator $erasew
99
c=!replace , by , $ in $copy
2477 bpr 100
dictionary=$module_dir/lang/recnames.$moduclass_lang
23 reyssat 101
restored=!exec translator $c
102
 
103
!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
104
 
105
!if def isitemof $copy
12413 bpr 106
  creat=!defof class_creation in wimshome/log/classes/$wims_class/.def
23 reyssat 107
!endif
108
 
16013 guerimand 109
!if y=$def
110
  !readproc arch/restoredef.proc
111
!endif
23 reyssat 112
!mexec arch/restore.sh
4598 bpr 113
wims_class_log=Restore $copy from $wims_deposit by $wims_realuser
23 reyssat 114
selection=
115
 
116
!if user isitemof $copy
12413 bpr 117
  !read adm/class/mkuserlist
23 reyssat 118
!endif
119
 
13181 guerimand 120
!! 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 121
!if def isitemof $copy
12413 bpr 122
  !setdef !set class_creation=$creat in wimshome/log/classes/$wims_class/.def
123
  exp=!defof class_expiration in wimshome/log/classes/$wims_class/.def
124
  today=!char 1 to 8 of $wims_now
125
  later=!date -d '2 months' '+%Y%m%d'
126
  !if NaN isin $[$exp]
127
    exp_bad=bad
128
    exp=$later
129
  !endif
130
  !if $exp<$later
131
    exp=$later
132
    exp_bad=early
133
  !endif
134
  !if $exp>$today+10000
135
    exp=$[$today+10000]
136
    exp_bad=late
137
  !endif
138
  !if $exp_bad!=$empty
139
    !setdef !set class_expiration=$exp in wimshome/log/classes/$wims_class/.def
140
  !endif
16013 guerimand 141
!!  !mexec scripts/classlist.sh   this script don't exist
23 reyssat 142
!endif
143
 
10132 bpr 144
!read adm/class/stat