Changeset 1957 for branches/release-35/lib/MT/CMS/Blog.pm
- Timestamp:
- 04/17/08 22:43:48 (19 months ago)
- Files:
-
- 1 modified
-
branches/release-35/lib/MT/CMS/Blog.pm (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branches/release-35/lib/MT/CMS/Blog.pm
r1951 r1957 1836 1836 } 1837 1837 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 types1846 next1847 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 synchronously1856 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 1872 1838 sub cfg_archives_save { 1873 1839 my $app = shift; … … 1895 1861 $app->translate( "Saving blog failed: [_1]", $blog->errstr ) ); 1896 1862 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 1915 1863 1; 1916 1864 } 1917 1865 1866 # FIXME: Faulty, since it doesn't take into account module includes 1918 1867 sub RegistrationAffectsArchives { 1919 1868 my ( $blog_id, $archive_type ) = @_; … … 1966 1915 $tmpl->build_type(MT::PublishOption::ONDEMAND()); 1967 1916 } 1968 $tmpl->build_dynamic(0);1969 1917 $tmpl->save(); 1970 1918 } … … 1979 1927 for my $tmpl (@templates) { 1980 1928 $tmpl->build_type( $tmpl->type ne 'index' ? MT::PublishOption::DYNAMIC() : MT::PublishOption::ONDEMAND() ); 1981 $tmpl->build_dynamic( $tmpl->type ne 'index' ? 1 : 0 );1982 1929 $tmpl->save(); 1983 1930 } … … 1995 1942 for my $tmpl (@templates) { 1996 1943 $tmpl->build_type( MT::PublishOption::DYNAMIC() ); 1997 $tmpl->build_dynamic(1);1998 1944 $tmpl->save(); 1999 1945 }
