Ignore:
Timestamp:
01/22/12 19:31: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
  • trunk/core/lib/Foswiki/Meta.pm

    r13771 r13781  
    18771877        my $pretext = $text;               # text before the handler modifies it 
    18781878        my $premeta = $this->stringify();  # just the meta, no text 
    1879         # The meta obj may not have a loaded rev yet. If anything in the 
    1880         # beforeSaveHandlers tries to do an access check with an unloadedRev, 
    1881         # it will attempt to load the latest which we really don't want it to do. 
    1882         # So we mark it as NEW. 
    1883         $this->{_loadedRev} = 'NEW' unless defined $this->{_loadedRev}; 
     1879        unless ( $this->{_loadedRev} ) { 
     1880            # The meta obj doesn't have a loaded rev yet, and we have to block the 
     1881            # beforeSaveHandlers from loading the topic from store. We are saving, 
     1882            # and anything we have in $this is going to get written anyway, so we 
     1883            # can simply mark it as "the latest". 
     1884            # SMELL: this may not work if the beforeSaveHandler tries to use the 
     1885            # meta obj for access control checks, so that is not recommended. 
     1886            $this->{_loadedRev} = $this->getLatestRev(); 
     1887        } 
     1888 
    18841889        $plugins->dispatch( 'beforeSaveHandler', $text, $this->{_topic}, 
    18851890            $this->{_web}, $this ); 
    1886         undef $this->{_loadedRev} if $this->{_loadedRev} eq 'NEW'; 
    18871891 
    18881892        # If the text has changed; it may be a text or meta change, or both 
     
    19121916        $signal = shift; 
    19131917    }; 
     1918 
     1919    ASSERT($newRev, $this->{loadedRev}) if DEBUG; 
    19141920 
    19151921    # Semantics inherited from TWiki. See 
Note: See TracChangeset for help on using the changeset viewer.