Ignore:
Timestamp:
01/22/12 19:36:26 (4 months ago)
Author:
CrawfordCurrie
Message:

Item11461: no need to fake the loaded rev, as we know the new content being saved is correct for the current rev (even if it was generated internally)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/Release01x01/core/lib/Foswiki/Meta.pm

    r13773 r13782  
    18981898        my $pretext = $text;               # text before the handler modifies it 
    18991899        my $premeta = $this->stringify();  # just the meta, no text 
    1900  
    1901         # The meta obj may not have a loaded rev yet. If anything in the 
    1902         # beforeSaveHandlers tries to do an access check with an unloadedRev, 
    1903         # it will attempt to load the latest which we really don't want it to do. 
    1904         # So we mark it as NEW. 
    1905         $this->{_loadedRev} = 'NEW' unless defined $this->{_loadedRev}; 
     1900        unless ( $this->{_loadedRev} ) { 
     1901            # The meta obj doesn't have a loaded rev yet, and we have to block the 
     1902            # beforeSaveHandlers from loading the topic from store. We are saving, 
     1903            # and anything we have in $this is going to get written anyway, so we 
     1904            # can simply mark it as "the latest". 
     1905            # SMELL: this may not work if the beforeSaveHandler tries to use the 
     1906            # meta obj for access control checks, so that is not recommended. 
     1907            $this->{_loadedRev} = $this->getLatestRev(); 
     1908        } 
     1909 
    19061910        $plugins->dispatch( 'beforeSaveHandler', $text, $this->{_topic}, 
    19071911            $this->{_web}, $this ); 
    1908         undef $this->{_loadedRev} if $this->{_loadedRev} eq 'NEW'; 
    19091912 
    19101913        # If the text has changed; it may be a text or meta change, or both 
Note: See TracChangeset for help on using the changeset viewer.