--- loncom/debugging_tools/make_user_cc.pl 2004/09/12 21:27:05 1.1 +++ loncom/debugging_tools/make_user_cc.pl 2006/06/19 09:36:22 1.2 @@ -2,7 +2,8 @@ # use strict; use GDBM_File; -my %roles; +use lib '/home/httpd/lib/perl/'; +use LONCAPA; my $user = shift; my $userdom = shift; @@ -27,16 +28,9 @@ my ($a,$b,$c,undef) = split(//,$user,4); my $dbfile = "/home/httpd/lonUsers/$userdom/$a/$b/$c/$user/roles.db"; my $histfile = "/home/httpd/lonUsers/$userdom/$a/$b/$c/$user/roles.hist"; -tie (%roles,'GDBM_File',$dbfile,&GDBM_WRCREAT(),0640); -$roles{'/'.$coursedom.'/'.$course.'_cc'}='cc'; - -open OUT, ">".$histfile; -foreach (keys(%roles)) { - print OUT $_.' : '.$roles{$_}."\n"; -} -close OUT; - -untie %roles; +my $rolesref=&LONCAPA::locking_hash_tie($dbfile,&GDBM_WRCREAT()); +$$rolesref{'/'.$coursedom.'/'.$course.'_cc'}='cc'; +&LONCAPA::locking_hash_untie($rolesref); system ("chown www:www $histfile"); system ("chown www:www $dbfile");