Show
Ignore:
Timestamp:
06/04/08 02:10:09 (18 months ago)
Author:
fumiakiy
Message:

Check if build_type is changed to dynamic from something else and do not rebuild if no map is. BugId:80001

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • branches/release-39/lib/MT/CMS/Common.pm

    r2406 r2502  
    366366            || $obj->type eq 'individual' ) 
    367367        { 
     368            my $static_maps = delete $app->{static_dynamic_maps}; 
    368369            require MT::TemplateMap; 
    369             my @maps = MT::TemplateMap->load( 
    370                 { 
    371                     template_id => $obj->id, 
    372                     build_type  => MT::PublishOption::DYNAMIC() 
    373                 } 
    374             ); 
    375             my @ats = map { $_->archive_type } @maps; 
    376             if ($#ats >= 0) { 
    377                 $q->param( 'type', join( ',', @ats ) ); 
    378                 $q->param( 'with_indexes', 1 ); 
    379                 $q->param( 'no_static', 1 ); 
    380                 $q->param( 'template_id', $obj->id ); 
    381                 $q->param( 'single_template', 1 ); 
    382                 require MT::CMS::Blog; 
    383                 return MT::CMS::Blog::start_rebuild_pages($app); 
     370            my $terms = {}; 
     371            if ( $static_maps && @$static_maps ) { 
     372                $terms->{id} = $static_maps; 
     373            } 
     374            else { 
     375                # all existing maps have been dynamic 
     376                # do nothing 
     377            } 
     378            if ( %$terms ) { 
     379                my @maps = MT::TemplateMap->load($terms); 
     380                my @ats = map { $_->archive_type } @maps; 
     381                if ($#ats >= 0) { 
     382                    $q->param( 'type', join( ',', @ats ) ); 
     383                    $q->param( 'with_indexes', 1 ); 
     384                    $q->param( 'no_static', 1 ); 
     385                    $q->param( 'template_id', $obj->id ); 
     386                    $q->param( 'single_template', 1 ); 
     387                    require MT::CMS::Blog; 
     388                    return MT::CMS::Blog::start_rebuild_pages($app); 
     389                } 
    384390            } 
    385391        }