Changeset 2335
- Timestamp:
- 05/14/08 23:35:48 (6 months ago)
- Files:
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
branches/release-38/lib/MT/ArchiveType/Category.pm
r1741 r2335 42 42 archive_template => 1, 43 43 archive_listing => 1, 44 'module_category -monthly_archives' => 1,44 'module_category_archives' => 1, 45 45 }; 46 46 } … … 94 94 require MT::Entry; 95 95 96 # issue a single count_group_by for all categories 97 my $cnt_iter = MT::Placement->count_group_by({ 98 blog_id => $blog_id, 99 }, { 100 group => [ 'category_id' ], 101 join => MT::Entry->join_on('id', { status => MT::Entry::RELEASE() }), 102 }); 103 my %counts; 104 while (my ($count, $cat_id) = $cnt_iter->()) { 105 $counts{$cat_id} = $count; 106 } 107 96 108 return sub { 97 109 while ( my $c = $iter->() ) { 98 my @arguments = ( 99 { 100 blog_id => $blog_id, 101 status => MT::Entry::RELEASE() 102 }, 103 { 104 'join' => [ 105 'MT::Placement', 'entry_id', { category_id => $c->id } 106 ] 107 } 108 ); 109 my $count = MT::Entry->count( @arguments ); 110 my $count = $counts{$c->id}; 110 111 next unless $count || $args->{show_empty}; 111 112 return ( $count, category => $c ); 112 113 } 113 undef;114 }114 return (); 115 }; 115 116 } 116 117
