diff options
| author | fukachan <fukachan> | 2001-01-25 14:19:51 +0000 |
|---|---|---|
| committer | fukachan <fukachan> | 2001-01-25 14:19:51 +0000 |
| commit | 73df505b9c06208e383e8c1f64f57e1d403c93ce (patch) | |
| tree | 38570a91fb7923c4b0c228588692353f39232800 /fml/lib/FML/Ticket/System.pm | |
| parent | eaccb35bdaf9a817957acd16a0b6fb59b059d878 (diff) | |
| download | fml8-73df505b9c06208e383e8c1f64f57e1d403c93ce.tar.gz fml8-73df505b9c06208e383e8c1f64f57e1d403c93ce.tar.bz2 fml8-73df505b9c06208e383e8c1f64f57e1d403c93ce.zip | |
clean up around ticket system
Diffstat (limited to 'fml/lib/FML/Ticket/System.pm')
| -rw-r--r-- | fml/lib/FML/Ticket/System.pm | 48 |
1 files changed, 33 insertions, 15 deletions
diff --git a/fml/lib/FML/Ticket/System.pm b/fml/lib/FML/Ticket/System.pm index 2fef1e57..d6c23aa6 100644 --- a/fml/lib/FML/Ticket/System.pm +++ b/fml/lib/FML/Ticket/System.pm @@ -42,30 +42,48 @@ sub increment_id } -sub update_ticket_trace_cache +sub pcb_save_id +{ + my ($self, $curproc, $id) = @_; + my $pcb = $curproc->{ pcb }; # FML::PCB object + $pcb->set('ticket', 'id', $id); +} + + +sub pcb_get_id { my ($self, $curproc) = @_; + my $pcb = $curproc->{ pcb }; # FML::PCB object + $pcb->get('ticket', 'id'); +} + + +sub _update_cache_init +{ + my ($self, $curproc, $args) = @_; my $config = $curproc->{ config }; - my $db_dir = $config->{ ticket_db_dir }; my $ml_name = $config->{ ml_name }; - my $cachefile = $db_dir. $ml_name; + my $db_dir = $config->{ ticket_db_dir } ."/". $ml_name; unless (-d $db_dir) { - use FML::File qw(mkdirhier); - mkdirhier($db_dir, $config->{ default_directory_mode }); - $self->error_reason( FML::File->error() ); - return; + use FML::Utils qw(mkdirhier); + mkdirhier($db_dir, $config->{ default_directory_mode }) || do { + $self->error_reason( FML::Utils->error() ); + return undef; + }; } - use FileHandle; - my $fh = new FileHandle ">> $cachefile"; - if (defined $fh) { - print $fh ""; - close($fh); - } - else { - $self->error_reason("cannot open ticket cache"); + if (defined $self->{ _cachefile }) { + my $cachefile = $self->{ _cachefile }; + unless (-f $cachefile) { + use FML::Utils qw(touch); + touch($cachefile) || do { + return undef; + }; + } } + + return 1; } |
