Show
Ignore:
Timestamp:
04/17/08 22:43:48 (19 months ago)
Author:
bchoate
Message:

Fixes for propogation of build_type from template to templatemaps. BugId:79370

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • branches/release-35/lib/MT/CMS/Blog.pm

    r1951 r1957  
    18361836} 
    18371837 
    1838 sub _switch_publish_options { 
    1839     my ( $blog, $current, $new, $dcty ) = @_; 
    1840     require MT::Template; 
    1841     require MT::TemplateMap; 
    1842     my @tmpl = MT::Template->load( { blog_id => $blog->id } ); 
    1843     my $pref_at = $blog->archive_type_preferred || ''; 
    1844     for my $tmpl (@tmpl) { 
    1845         # FIXME: enumeration of types 
    1846         next 
    1847           if !( $tmpl->type =~ m/^(individual|page|category|archive)$/ ); 
    1848         # if ( $tmpl->build_type == $current ) { 
    1849         #     $tmpl->build_type($new); 
    1850         #     $tmpl->save; 
    1851         # } 
    1852         my @tmpl_maps = MT::TemplateMap->load( { template_id => $tmpl->id } ); 
    1853         foreach my $tmpl_map (@tmpl_maps) { 
    1854             if ($dcty eq 'async_partial') { 
    1855                 # build the preferred individual/page archives synchronously 
    1856                 if (($tmpl_map->archive_type =~ m/^(Individual|Page)$/) && 
    1857                     ($tmpl_map->is_preferred)) { 
    1858                     $tmpl_map->build_type(MT::PublishOption::ONDEMAND()); 
    1859                     $tmpl_map->save; 
    1860                     next; 
    1861                 } 
    1862             } 
    1863             if ( $tmpl_map->build_type != $new ) { 
    1864                 $tmpl_map->build_type($new); 
    1865                 $tmpl_map->save; 
    1866             } 
    1867         } 
    1868     } 
    1869     1; 
    1870 } 
    1871  
    18721838sub cfg_archives_save { 
    18731839    my $app = shift; 
     
    18951861        $app->translate( "Saving blog failed: [_1]", $blog->errstr ) ); 
    18961862 
    1897     require MT::PublishOption; 
    1898     if ($pq) { 
    1899         _switch_publish_options( 
    1900             $blog, 
    1901             MT::PublishOption::ONDEMAND(), 
    1902             MT::PublishOption::ASYNC(), 
    1903             $dcty, 
    1904         ); 
    1905     } 
    1906     else { 
    1907         _switch_publish_options( 
    1908             $blog, 
    1909             MT::PublishOption::ASYNC(), 
    1910             MT::PublishOption::ONDEMAND(), 
    1911             $dcty, 
    1912         ); 
    1913     } 
    1914  
    19151863    1; 
    19161864} 
    19171865 
     1866# FIXME: Faulty, since it doesn't take into account module includes 
    19181867sub RegistrationAffectsArchives { 
    19191868    my ( $blog_id, $archive_type ) = @_; 
     
    19661915                $tmpl->build_type(MT::PublishOption::ONDEMAND()); 
    19671916            } 
    1968             $tmpl->build_dynamic(0); 
    19691917            $tmpl->save(); 
    19701918        } 
     
    19791927        for my $tmpl (@templates) { 
    19801928            $tmpl->build_type( $tmpl->type ne 'index' ? MT::PublishOption::DYNAMIC() : MT::PublishOption::ONDEMAND() ); 
    1981             $tmpl->build_dynamic( $tmpl->type ne 'index' ? 1 : 0 ); 
    19821929            $tmpl->save(); 
    19831930        } 
     
    19951942        for my $tmpl (@templates) { 
    19961943            $tmpl->build_type( MT::PublishOption::DYNAMIC() ); 
    1997             $tmpl->build_dynamic(1); 
    19981944            $tmpl->save(); 
    19991945        }