Changeset 320


Ignore:
Timestamp:
01/16/11 21:06:31 (13 years ago)
Author:
nanardon
Message:
  • delete old statistics at maintenance tasks
Location:
server/trunk/web/lib/Sophie/Controller
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • server/trunk/web/lib/Sophie/Controller/Admin/Maintenance.pm

    r319 r320  
    3434        admin.maintenance.delete_expired_sessions 
    3535        admin.maintenance.delete_expired_paste 
     36        admin.maintenance.delete_old_chat_statistics 
    3637    ) ]; 
    3738} 
     
    5758} 
    5859 
     60sub delete_old_chat_statistics :XMLRPC { 
     61    my ($self, $c) = @_; 
     62    $c->model('Base::ChatStat')->search( 
     63        { 
     64            -nest => \[ 
     65            "day < now() - ?::interval", 
     66            [ plain_text => "365 days" ], 
     67        ], 
     68        } 
     69    )->delete; 
     70    $c->model('Base')->storage->sth->commit; 
     71    $c->stash->{xmlrpc} = 'Done'; 
     72} 
    5973 
    6074=head1 AUTHOR 
  • server/trunk/web/lib/Sophie/Controller/Chat.pm

    r319 r320  
    5454    my ($self, $c, $cmd) = @_; 
    5555 
    56     $c->model('Base::ChatStat')->search( 
    57         { 
    58             -nest => \[ 
    59             "day < now() - ?::interval", 
    60             [ plain_text => "365 days" ], 
    61         ], 
    62         } 
    63     )->delete; 
    6456    my $stat = $c->model('Base::ChatStat')->find_or_create({ 
    6557        cmd => $cmd, 
Note: See TracChangeset for help on using the changeset viewer.