root/trunk/midgard/tools/yamp/remove_sg0_admin.pl

Revision 6972, 0.7 kB (checked in by bergie, 6 years ago)

Fixing tmp file names

  • Property svn:eol-style set to native
  • Property svn:executable set to *
  • Property svn:keywords set to Author Date Id Revision
Line 
1 #!/usr/bin/perl
2
3 #  changes the "changed" tag of SG0 admin in repligard file,
4 #  so his record is never updated (but created if not existing)
5
6
7 $admin_user_guid = "f6b665f1984503790ed91f39b11b5392";
8
9 local $/;
10
11 open FILE, "< $ARGV[0]";
12 $xml = <FILE>;
13 close FILE;
14
15 # this would remove SG0 admin completely
16 #$xml =~ s/<person id="$admin_user_guid".*?<\/person>//s;
17
18 $xml =~ s/<person(.*?)id="$admin_user_guid"(.*?)changed="(\d+)"(.*?)>/<person${1}id="$admin_user_guid"$2changed="19980101000000"$4>/;
19
20 open FILE2, "> /tmp/$1.$$";
21 print FILE2 $xml;
22 close FILE2;
23
24 # create backup copy
25 #system("mv", $ARGV[0], $ARGV[0] . ".backup");
26
27 system("mv", "/tmp/$1.$$", $ARGV[0]);
28 unlink("/tmp/$1.$$");
Note: See TracBrowser for help on using the browser.