Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # Movable Type (r) Open Source (C) 2001-2008 Six Apart, Ltd.
- # This program is distributed under the terms of the
- # GNU General Public License, version 2.
- #
- # $Id: WeblogPublisher.pm 2051 2008-04-24 03:02:29Z fumiakiy $
- package MT::WeblogPublisher;
- use strict;
- use base qw( MT::ErrorHandler Exporter );
- our @EXPORT = qw(ArchiveFileTemplate ArchiveType);
- #
- # [... SNIP ...]
- #
- sub new {
- my $class = shift;
- my $this = {@_};
- my $cfg = MT->config;
- ########################################################
- if ( !exists $this->{start_time} ) { # Time is initialized here which is nearly at the
- $this->{start_time} = time; # beginning of MT initialization. Since this never
- } # happens again in a persistent environment, start_time
- if ( !exists $this->{NoTempFiles} ) { # will always be less than mod_time after a single rebuild.
- $this->{NoTempFiles} = $cfg->NoTempFiles; ########################################################
- }
- if ( !exists $this->{PublishCommenterIcon} ) {
- $this->{PublishCommenterIcon} = $cfg->PublishCommenterIcon;
- }
- bless $this, $class;
- $this->init();
- $this;
- }
- #
- # [... SNIP ...]
- #
- # This method performs the work of publishing Category,
- # Author, Date-based, Individual and Page archives
- sub rebuild_file {
- my $mt = shift;
- my ( $blog, $root_path, $map, $at, $ctx, $cond, $build_static, %args )
- = @_;
- my $finfo;
- my $archiver = $mt->archiver($at);
- my ( $entry, $start, $end, $category, $author );
- if ( $finfo = $args{FileInfo} ) {
- $args{Author} = $finfo->author_id if $finfo->author_id;
- $args{Category} = $finfo->category_id if $finfo->category_id;
- $args{Entry} = $finfo->entry_id if $finfo->entry_id;
- $map ||= MT::TemplateMap->load( $finfo->templatemap_id );
- $at ||= $finfo->archive_type;
- if ( $finfo->startdate ) {
- if ( ( $start, $end ) = $archiver->date_range($finfo->startdate) ) {
- $args{StartDate} = $start;
- $args{EndDate} = $end;
- }
- }
- }
- # Calculate file path and URL for the new entry.
- my $file = File::Spec->catfile( $root_path, $map->{__saved_output_file} );
- ## Untaint. We have to assume that we can trust the user's setting of
- ## the archive_path, and nothing else is based on user input.
- ($file) = $file =~ /(.+)/s;
- # compare file modification time to start of build process. if it
- # is greater than the start_time, then we shouldn't need to build this
- # file again
- my $fmgr = $blog->file_mgr;
- if (my $mod_time = $fmgr->file_mod_time($file)) { # <<<<<<<<<<<<<< This section here is what's
- return 1 if $mod_time >= $mt->start_time; # <<<<<<<<<<<<<< causing the issue.
- } # <<<<<<<<<<<<<<
- #
- # Etc. Once a template is rebuilt, it never makes
- # it past here again in a persistent environment
- #
- # [...SNIP...]
- }
Add Comment
Please, Sign In to add comment