X-Git-Url: http://git.ieval.ro/?p=gruntmaster-data.git;a=blobdiff_plain;f=lib%2FGruntmaster%2FApp%2FCommand%2FSet.pm;h=2624ce4d1d40407a1f6c21d5639ed9054c5abea5;hp=3ef26fcd63fb192e79aaf1259f3099eafe240334;hb=8ab124f5b4b8d8c871c3bf2c3fb11eb17f61d2f6;hpb=5e26317ea435eaa5dd8d8fa7ccef5fd0e883b998 diff --git a/lib/Gruntmaster/App/Command/Set.pm b/lib/Gruntmaster/App/Command/Set.pm index 3ef26fc..2624ce4 100644 --- a/lib/Gruntmaster/App/Command/Set.pm +++ b/lib/Gruntmaster/App/Command/Set.pm @@ -10,6 +10,13 @@ use Gruntmaster::Data; use File::Slurp qw/read_file/; +use constant PAGES => { + contests => '/ct/', + jobs => '/log/', + problems => '/pb/', + users => '/us/', +}; + sub opt_spec { ['file!', 'Use the contents of a file as value'] } @@ -29,6 +36,7 @@ sub execute { my ($id, %values) = @$args; %values = map { $_ => scalar read_file $values{$_} } keys %values if $opt->{file}; db->update($self->app->table, \%values, {id => $id}); + purge PAGES->{$self->app->table}.$_ for '', $id; } 1;