Show
Ignore:
Timestamp:
03/24/08 22:48:54 (20 months ago)
Author:
bchoate
Message:

Optimizations for dashboard widgets; restrict range of entries/comments for stats widget to 120 days worth.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • branches/release-32/lib/MT/CMS/Dashboard.pm

    r1369 r1562  
    103103        require MT::Comment; 
    104104        $param->{comment_count} = MT::Comment->count( 
    105             { junk_status => [ 0, 1 ], }, 
     105            { visible => 1, }, 
    106106            { 
    107107                join => MT::Entry->join_on( 
     
    359359        ], 
    360360    }; 
     361 
     362    require MT::Util; 
     363    my @ts = MT::Util::offset_time_list(time - (121 * 24 * 60 * 60), $blog_id); 
     364    my $earliest = sprintf('%04d%02d%02d%02d%02d%02d', 
     365        $ts[5]+1900, $ts[4]+1, @ts[3,2,1,0]); 
     366    $terms->{authored_on} = [ $earliest, undef ]; 
     367    $args->{range_incl}{authored_on} = 1; 
     368 
    361369    $terms->{blog_id} = $blog_id if $blog_id; 
    362370    if ( !$user->is_superuser && !$blog_id ) { 
     
    411419            { 
    412420                ( $blog_id ? ( blog_id => $blog_id ) : () ), 
    413                 junk_status => [ 0, 1 ], 
     421                visible => 1, 
    414422            }, 
    415423            $args 
     
    441449        ], 
    442450    }; 
     451 
     452    require MT::Util; 
     453    my @ts = MT::Util::offset_time_list(time - (121 * 24 * 60 * 60), $blog_id); 
     454    my $earliest = sprintf('%04d%02d%02d%02d%02d%02d', 
     455        $ts[5]+1900, $ts[4]+1, @ts[3,2,1,0]); 
     456    $terms->{created_on} = [ $earliest, undef ]; 
     457    $args->{range_incl}{created_on} = 1; 
     458 
    443459    if ( !$user->is_superuser && !$blog_id ) { 
    444460        $args->{join} = MT::Permission->join_on(