Changeset 12494
- Timestamp:
- 09/10/11 08:24:51 (21 months ago)
- Location:
- trunk/core
- Files:
-
- 6 edited
-
data/TestCases/TestCaseAutoFormattedSearch.txt (modified) (1 diff)
-
lib/Foswiki/Store.pm (modified) (1 diff)
-
lib/Foswiki/Store/VC/Handler.pm (modified) (10 diffs)
-
lib/Foswiki/Store/VC/RcsLiteHandler.pm (modified) (7 diffs)
-
lib/Foswiki/Store/VC/RcsWrapHandler.pm (modified) (5 diffs)
-
lib/Foswiki/Store/VC/Store.pm (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/core/data/TestCases/TestCaseAutoFormattedSearch.txt
r8124 r12494 83 83 84 84 ---++ Expected 85 _Note that the .txt says it is rev 4, but because there is no ,v to back this up 86 it is treated as rev 1_ 85 87 86 88 <!-- expected with $parent --> 87 Revision 4has parent <nop>TestCaseAutoFormattedSearch and it contains the form <nop>FormattedSearchForm89 Revision 1 has parent <nop>TestCaseAutoFormattedSearch and it contains the form <nop>FormattedSearchForm 88 90 <!-- /expected --> 89 91 -
trunk/core/lib/Foswiki/Store.pm
r12475 r12494 444 444 * =$attachment= - name of an attachment (optional) 445 445 Get an iterator over the list of revisions of the object. The iterator returns 446 the revision identifiers (which will usually be numbers) starting with the most recent revision. 446 the revision identifiers (which will usually be numbers) starting with the most 447 recent revision. 447 448 448 449 MUST WORK FOR ATTACHMENTS AS WELL AS TOPICS 450 451 If the object does not exist, returns an empty iterator ($iterator->hasNext() will be 452 false). 449 453 450 454 =cut -
trunk/core/lib/Foswiki/Store/VC/Handler.pm
r12248 r12494 205 205 206 206 Designed to be overridden by subclasses, which can call up to this method 207 if file-based rev info is required.207 if simple file-based rev info is required. 208 208 209 209 =cut 210 210 211 211 sub getInfo { 212 my $this = shift; 212 my $this = shift; # $version is not useful here, as we have no way to record history 213 213 214 214 # SMELL: this is only required for the constant 215 215 require Foswiki::Users::BaseUserMapping; 216 216 217 # If a topic file exists, grab the TOPICINFO from it. This is 218 # the default behaviour if no implementing class can come up 219 # with a better answer. Note that we only peek at the first line 220 # of the file, which is where a "proper" save will have left the tag. 217 # We only arrive here if the implementation getInfo can't serve the info; this 218 # will usually be because the ,v is missing or the topic cache is newer. 219 220 # If there is a .txt file, grab the TOPICINFO from it. 221 # Note that we only peek at the first line of the file, 222 # which is where a "proper" save will have left the tag. 221 223 my $info = {}; 222 224 my $f; 223 if ( open( $f, '<', $this->{file} ) ) { 224 local $/ = "\n"; 225 my $ti = <$f>; 226 close($f); 227 if ( defined $ti && $ti =~ /^%META:TOPICINFO{(.*)}%/ ) { 228 require Foswiki::Attrs; 229 my $a = Foswiki::Attrs->new($1); 230 231 # Default bad revs to 1, not 0, because this is coming from 232 # a topic on disk, so we know it's a "real" rev. 233 $info->{version} = Foswiki::Store::cleanUpRevID( $a->{version} ) 234 || 1; 235 $info->{date} = $a->{date} if defined $a->{date}; 236 $info->{author} = $a->{author} if defined $a->{author}; 237 $info->{comment} = $a->{comment} if defined $a->{comment}; 238 } 239 } 240 241 # version, date, author and comment fields *must* be defined 225 if ( $this->noCheckinPending() ) { 226 # TOPICINFO may be OK 227 if ( open( $f, '<', $this->{file} ) ) { 228 local $/ = "\n"; 229 my $ti = <$f>; 230 close($f); 231 if ( defined $ti && $ti =~ /^%META:TOPICINFO{(.*)}%/ ) { 232 require Foswiki::Attrs; 233 my $a = Foswiki::Attrs->new($1); 234 235 # Default bad revs to 1, not 0, because this is coming from 236 # a topic on disk, so we know it's a "real" rev. 237 $info->{version} = Foswiki::Store::cleanUpRevID( $a->{version} ) 238 || 1; 239 $info->{date} = $a->{date}; 240 $info->{author} = $a->{author}; 241 $info->{comment} = $a->{comment}; 242 } 243 } 244 } else { 245 # There is a checkin pending. We need the latest rev in the history + 1 246 $info->{version} = -e $this->{rcsFile} ? $this->_numRevisions() + 1 : 1; 247 $info->{comment} = "pending"; 248 } 249 $info->{date} = $this->getTimestamp() unless defined $info->{date}; 242 250 $info->{version} = 1 unless defined $info->{version}; 243 $info->{date} = $this->getTimestamp() unless defined $info->{date}; 244 $info->{author} = $Foswiki::Users::BaseUserMapping::DEFAULT_USER_CUID 245 unless defined $info->{author}; 246 $info->{comment} = '' 247 unless defined $info->{comment}; 251 $info->{comment} = '' unless defined $info->{comment}; 252 $info->{author} ||= $Foswiki::Users::BaseUserMapping::UNKNOWN_USER_CUID; 248 253 return $info; 254 } 255 256 # Check to see if there is a newer non-,v file waiting to be checked in. If there is, then 257 # all rev numbers have to be incremented, as they will auto-increment when it is finally 258 # checked in (usually as the result of a save). This is also used to test the validity of 259 # TOPICINFO, as a pending checkin does not contain valid TOPICINFO. 260 sub noCheckinPending { 261 my $this = shift; 262 my $isValid = 0; 263 264 if (! -e $this->{file}) { 265 $isValid = 1; # Hmmmm...... 266 } else { 267 if (-e $this->{rcsFile}) { 268 # Check the time on the rcs file; is the .txt newer? 269 # Danger, Will Robinson! stat isn't reliable on all file systems, though [9] is claimed to be OK 270 # See perldoc perlport for more on this. 271 local ${^WIN32_SLOPPY_STAT} = 1; # don't need to open the file on Win32 272 my $rcsTime = (stat($this->{rcsFile}))[9]; 273 my $fileTime = (stat($this->{file}))[9]; 274 $isValid = ($rcsTime < $fileTime) ? 0 : 1; 275 } 276 } 277 return $isValid; 278 } 279 280 # Must be implemented by subclasses 281 sub ci { 282 die "Pure virtual method"; 283 } 284 285 # Protected for use only in subclasses. Check that the object has a history 286 # and the .txt is consistent with that history. 287 sub _saveDamage { 288 my $this = shift; 289 return if $this->noCheckinPending(); 290 291 # the version in the TOPICINFO may not be correct. We need 292 # to check the change in and update the TOPICINFO accordingly 293 my $t = $this->readFile($this->{file}); 294 295 # If this is a topic, adjust the TOPICINFO 296 if (defined $this->{topic} && !defined $this->{attachment}) { 297 my $rev = -e $this->{rcsFile} ? $this->getLatestRevisionID() : 1; 298 $t =~ s/^%META:TOPICINFO{(.*)}%$//m; 299 $t = '%META:TOPICINFO{author="' 300 . $Foswiki::Users::BaseUserMapping::UNKNOWN_USER_CUID. 301 '" comment="autosave" date="' .time().'" format="1.1" version="' 302 .$rev.'"}%'."\n$t"; 303 } 304 $this->ci( 0, 305 $t, 'autosave', 306 $Foswiki::Users::BaseUserMapping::UNKNOWN_USER_CUID, time()); 307 } 308 309 =begin TML 310 311 ---++ ObjectMethod addRevisionFromText($text, $comment, $cUID, $date) 312 313 Add new revision. Replace file with text. 314 * =$text= of new revision 315 * =$comment= checkin comment 316 * =$cUID= is a cUID. 317 * =$date= in epoch seconds; may be ignored 318 319 =cut 320 321 sub addRevisionFromText { 322 my ( $this, $text, $comment, $user, $date ) = @_; 323 $this->init(); 324 # Commit any out-of-band damage to .txt 325 $this->_saveDamage(); 326 $this->ci( 0, $text, $comment, $user, $date ); 327 } 328 329 =begin TML 330 331 ---++ ObjectMethod addRevisionFromStream($fh, $comment, $cUID, $date) 332 333 Add new revision. Replace file with contents of stream. 334 * =$fh= filehandle for contents of new revision 335 * =$cUID= is a cUID. 336 * =$date= in epoch seconds; may be ignored 337 338 =cut 339 340 sub addRevisionFromStream { 341 my ( $this, $stream, $comment, $user, $date ) = @_; 342 $this->init(); 343 344 # Commit any out-of-band damage to .txt 345 $this->_saveDamage(); 346 347 $this->ci( 1, $stream, $comment, $user, $date ); 348 } 349 350 =begin TML 351 352 ---++ ObjectMethod replaceRevision($text, $comment, $cUID, $date) 353 354 Replace the top revision. 355 * =$text= is the new revision 356 * =$date= is in epoch seconds. 357 * =$cUID= is a cUID. 358 * =$comment= is a string 359 360 =cut 361 362 sub replaceRevision { 363 my $this = shift; 364 $this->_saveDamage(); 365 $this->repRev(@_); 366 } 367 368 # Signature as for replaceRevision 369 sub repRev { 370 die "Pure virtual method"; 249 371 } 250 372 … … 257 379 258 380 The default is to return an iterator from the current version number 259 down to 1. Return rev 0 if the file exists without history. 381 down to 1. Return rev 1 if the file exists without history. Return 382 an empty iterator if the file does not exist. 260 383 261 384 =cut … … 267 390 require Foswiki::ListIterator; 268 391 if ( -e $this->{file} ) { 269 return Foswiki::ListIterator->new( [ 0] );392 return Foswiki::ListIterator->new( [1] ); 270 393 } 271 394 else { … … 289 412 290 413 sub getLatestRevisionID { 291 return shift->numRevisions() || 1; 414 my $this = shift; 415 return 0 unless -e $this->{file}; 416 my $rev = $this->_numRevisions() || 1; 417 # If there is a pending pseudo-revision, need n+1, but only if there is 418 # an existing history 419 $rev++ unless $this->noCheckinPending() || !-e $this->{rcsFile}; 420 return $rev; 292 421 } 293 422 … … 308 437 sub getNextRevisionID { 309 438 my $this = shift; 310 return ( $this->numRevisions() || ( ( -e $this->{file} ) ? 1 : 0 )) + 1;439 return $this->getLatestRevisionID() + 1; 311 440 } 312 441 … … 363 492 364 493 # Rev numbers run from 1 to numRevisions 365 return $rev && $rev <= $this-> numRevisions();494 return $rev && $rev <= $this->_numRevisions(); 366 495 } 367 496 … … 454 583 return 0 unless $this->{file}; 455 584 return -e $this->{file}; 456 }457 458 =begin TML459 460 ---++ ObjectMethod getTimestamp() -> $integer461 462 Get the timestamp of the file463 Returns 0 if no file, otherwise epoch seconds464 465 =cut466 467 sub getTimestamp {468 my ($this) = @_;469 ASSERT( $this->{file} ) if DEBUG;470 471 my $date = 0;472 if ( -e $this->{file} ) {473 474 # If the stat fails, stamp it with some arbitrary static475 # time in the past (00:40:05 on 5th Jan 1989)476 $date = ( stat $this->{file} )[9] || 600000000;477 }478 return $date;479 585 } 480 586 … … 1299 1405 } 1300 1406 1407 # ObjectMethod getTimestamp() -> $integer 1408 # Get the timestamp of the file 1409 # Returns 0 if no file, otherwise epoch seconds 1410 # Used in subclasses 1411 1412 sub getTimestamp { 1413 my ($this) = @_; 1414 ASSERT( $this->{file} ) if DEBUG; 1415 1416 my $date = 0; 1417 if ( -e $this->{file} ) { 1418 1419 # If the stat fails, stamp it with some arbitrary static 1420 # time in the past (00:40:05 on 5th Jan 1989) 1421 $date = ( stat $this->{file} )[9] || 600000000; 1422 } 1423 return $date; 1424 } 1425 1301 1426 1; 1302 1427 … … 1359 1484 =begin TML 1360 1485 1361 ---++ ObjectMethod addRevisionFromText($text, $comment, $cUID, $date)1362 1363 Add new revision. Replace file with text.1364 * =$text= of new revision1365 * =$comment= checkin comment1366 * =$cUID= is a cUID.1367 * =$date= in epoch seconds; may be ignored1368 1369 *Virtual method* - must be implemented by subclasses1370 1371 =begin TML1372 1373 ---++ ObjectMethod addRevisionFromStream($fh, $comment, $cUID, $date)1374 1375 Add new revision. Replace file with contents of stream.1376 * =$fh= filehandle for contents of new revision1377 * =$cUID= is a cUID.1378 * =$date= in epoch seconds; may be ignored1379 1380 *Virtual method* - must be implemented by subclasses1381 1382 =cut1383 1384 =begin TML1385 1386 ---++ ObjectMethod replaceRevision($text, $comment, $cUID, $date)1387 1388 Replace the top revision.1389 * =$text= is the new revision1390 * =$date= is in epoch seconds.1391 * =$cUID= is a cUID.1392 * =$comment= is a string1393 1394 *Virtual method* - must be implemented by subclasses1395 1396 =cut1397 1398 =begin TML1399 1400 1486 ---++ ObjectMethod deleteRevision() 1401 1487 … … 1437 1523 1438 1524 =cut 1439 __END__ 1525 1440 1526 Foswiki - The Free and Open Source Wiki, http://foswiki.org/ 1441 1527 -
trunk/core/lib/Foswiki/Store/VC/RcsLiteHandler.pm
r12243 r12494 433 433 434 434 # implements VC::Handler 435 sub numRevisions {435 sub _numRevisions { 436 436 my ($this) = @_; 437 437 _ensureProcessed($this); … … 445 445 } 446 446 447 # implements VC::Handler 448 sub addRevisionFromText { 449 _addRevision( shift, 0, @_ ); 450 } 451 452 # implements VC::Handler 453 sub addRevisionFromStream { 454 _addRevision( shift, 1, @_ ); 455 } 456 457 sub _addRevision { 447 sub ci { 458 448 my ( $this, $isStream, $data, $log, $author, $date ) = @_; 459 449 460 450 _ensureProcessed($this); 461 if ( $this->{state} eq 'nocommav' && -e $this->{file} ) {462 463 # Must do this *before* saving the attachment, so we464 # save the file on disc465 $this->{head} = 1;466 $this->{revs}[1]->{text} =467 Foswiki::Store::VC::Handler::readFile( $this, $this->{file} );468 $this->{revs}[1]->{log} = $log;469 $this->{revs}[1]->{author} = $author;470 $this->{revs}[1]->{date} = ( defined $date ? $date : time() );471 _writeMe($this);472 }473 451 474 452 if ($isStream) { … … 481 459 $this->saveFile( $this->{file}, $data ); 482 460 } 483 484 my $head = $this->{head}; 461 my $head = $this->{head} || 0; 485 462 if ($head) { 486 463 my $lNew = _split($data); … … 517 494 518 495 # implements VC::Handler 519 sub rep laceRevision{496 sub repRev { 520 497 my ( $this, $text, $comment, $user, $date ) = @_; 521 498 _ensureProcessed($this); 522 499 _delLastRevision($this); 523 return _addRevision( $this,0, $text, $comment, $user, $date );500 return $this->ci( 0, $text, $comment, $user, $date ); 524 501 } 525 502 … … 573 550 574 551 _ensureProcessed($this); 575 576 552 my $info; 577 if ( $this->{state} ne 'nocommav' ) {553 if ( $this->{state} ne 'nocommav') { 578 554 if ( !$version || $version > $this->{head} ) { 579 555 $version = $this->{head} || 1; … … 585 561 comment => $this->{revs}[$version]->{log} 586 562 }; 563 # We have to check that there is not a pending version in the .txt 564 unless ($this->noCheckinPending()) { 565 # There's a pending version in the .txt 566 $info->{version}++; 567 $info->{author} = $Foswiki::Users::BaseUserMapping::UNKNOWN_USER_CUID; 568 $info->{comment} = "pending"; 569 $info->{date} = time(); 570 } 587 571 } 588 572 else { … … 773 757 my ( $this, $date ) = @_; 774 758 775 my $version = 1;776 777 759 _ensureProcessed($this); 778 $version = $this->{head}; 760 if ($this->{state} eq 'nocommav') { 761 return ($date >= (stat($this->{file}))[9]) ? 1 : undef; 762 } 763 764 my $version = $this->{head}; 779 765 while ( $this->{revs}[$version]->{date} > $date ) { 780 766 $version--; 781 return 0 if $version == 0; 782 } 783 767 return undef if $version == 0; 768 } 769 770 if ($version == $this->{head} && !$this->noCheckinPending()) { 771 # Check the file date 772 $version++ if ($date >= (stat($this->{file}))[9]); 773 } 784 774 return $version; 785 775 } -
trunk/core/lib/Foswiki/Store/VC/RcsWrapHandler.pm
r8604 r12494 102 102 103 103 # implements VC::Handler 104 sub addRevisionFromText { 104 105 # Designed for calling *only* from the Handler superclass and this class 106 sub ci { 107 my ($this, $isStream, $data, $comment, $user, $date) = @_; 108 # unless ( -e $this->{rcsFile} ) { # 109 # # SMELL: what is this for? 110 # _lock($this); 111 # _ci( $this, $comment, $user, $date ); 112 # } 113 _lock($this); 114 if ($isStream) { 115 $this->saveStream( $data ); 116 } else { 117 $this->saveFile( $this->{file}, $data ); 118 } 119 _ci( $this, $comment, $user, $date ); 120 } 121 122 # implements VC::Handler 123 sub repRev { 105 124 my ( $this, $text, $comment, $user, $date ) = @_; 106 $this->init(); 107 108 #print STDERR "Wrap: Forced save at $date $this->{file}\n" if $date; 109 110 unless ( -e $this->{rcsFile} ) { # 111 # SMELL: what is this for? 112 _lock($this); 113 _ci( $this, $comment, $user, $date ); 114 } 115 Foswiki::Store::VC::Handler::saveFile( $this, $this->{file}, $text ); 116 _lock($this); 117 _ci( $this, $comment, $user, $date ); 118 } 119 120 # implements VC::Handler 121 sub addRevisionFromStream { 122 my ( $this, $stream, $comment, $user, $date ) = @_; 123 $this->init(); 124 125 _lock($this); 126 Foswiki::Store::VC::Handler::saveStream( $this, $stream ); 127 _ci( $this, $comment, $user, $date ); 128 } 129 130 # implements VC::Handler 131 sub replaceRevision { 132 my ( $this, $text, $comment, $user, $date ) = @_; 133 134 my $rev = $this->numRevisions() || 0; 125 126 my $rev = $this->_numRevisions() || 0; 135 127 136 128 $comment ||= 'none'; … … 168 160 sub deleteRevision { 169 161 my ($this) = @_; 170 my $rev = $this-> numRevisions();162 my $rev = $this->_numRevisions(); 171 163 return if ( $rev <= 1 ); 172 164 return _deleteRevision( $this, $rev ); … … 281 273 282 274 # implements VC::Handler 283 sub numRevisions {284 my $this = shift;285 286 unless ( -e $this->{rcsFile} ) {287 288 # If there is no history, there can only be one.289 return 1 if -e $this->{file};290 return 0;291 }292 293 my ( $rcsOutput, $exit ) =294 Foswiki::Sandbox->sysCommand( $Foswiki::cfg{RCS}{histCmd},295 FILENAME => $this->{rcsFile} );296 if ($exit) {297 throw Error::Simple( 'RCS: '298 . $Foswiki::cfg{RCS}{histCmd} . ' of '299 . $this->hidePath( $this->{rcsFile} )300 . ' failed: '301 . $rcsOutput );302 }303 if ( $rcsOutput =~ /head:\s+\d+\.(\d+)\n/ ) {304 return $1;305 }306 if ( $rcsOutput =~ /total revisions: (\d+)\n/ ) {307 return $1;308 }309 return 1;310 }311 312 # implements VC::Handler313 275 sub getInfo { 314 276 my ( $this, $version ) = @_; 315 277 316 if ( -e $this->{rcsFile}) {317 if ( !$version || $version > $this-> numRevisions() ) {318 $version = $this-> numRevisions();278 if ( $this->noCheckinPending() ) { 279 if ( !$version || $version > $this->_numRevisions() ) { 280 $version = $this->_numRevisions(); 319 281 } 320 282 my ( $rcsOut, $exit ) = Foswiki::Sandbox->sysCommand( … … 345 307 346 308 # implements VC::Handler 309 sub _numRevisions { 310 my $this = shift; 311 312 unless ( -e $this->{rcsFile} ) { 313 314 # If there is no history, there can only be one. 315 return 1 if -e $this->{file}; 316 return 0; 317 } 318 319 my ( $rcsOutput, $exit ) = 320 Foswiki::Sandbox->sysCommand( $Foswiki::cfg{RCS}{histCmd}, 321 FILENAME => $this->{rcsFile} ); 322 if ($exit) { 323 throw Error::Simple( 'RCS: ' 324 . $Foswiki::cfg{RCS}{histCmd} . ' of ' 325 . $this->hidePath( $this->{rcsFile} ) 326 . ' failed: ' 327 . $rcsOutput ); 328 } 329 if ( $rcsOutput =~ /head:\s+\d+\.(\d+)\n/ ) { 330 return $1; 331 } 332 if ( $rcsOutput =~ /total revisions: (\d+)\n/ ) { 333 return $1; 334 } 335 return 1; 336 } 337 338 # implements VC::Handler 347 339 # rev1 is the lower, rev2 is the higher revision 348 340 sub revisionDiff { … … 526 518 my ( $this, $date ) = @_; 527 519 528 if ( !-e $this->{rcsFile} ) { 529 return; 530 } 520 unless( -e $this->{rcsFile} ) { 521 return ($date >= (stat($this->{file}))[9]) ? 1 : undef; 522 } 523 531 524 require Foswiki::Time; 532 $date = Foswiki::Time::formatTime( $date, '$rcs', 'gmtime' );525 my $sdate = Foswiki::Time::formatTime( $date, '$rcs', 'gmtime' ); 533 526 my ( $rcsOutput, $exit ) = Foswiki::Sandbox->sysCommand( 534 527 $Foswiki::cfg{RCS}{rlogDateCmd}, 535 DATE => $ date,528 DATE => $sdate, 536 529 FILENAME => $this->{file} 537 530 ); 538 531 532 my $version = undef; 539 533 if ( $rcsOutput =~ m/revision \d+\.(\d+)/ ) { 540 return $1; 541 } 542 return 1; 534 $version = $1; 535 } 536 537 if ($version && !$this->noCheckinPending()) { 538 # Check the file date 539 $version++ if ($date >= (stat($this->{file}))[9]); 540 } 541 return $version; 543 542 } 544 543 -
trunk/core/lib/Foswiki/Store/VC/Store.pm
r12444 r12494 63 63 64 64 # SMELL: this module does not respect $Foswiki::inUnitTestMode; tests 65 # just sit on top of the store which is configured in the current LocalSite.65 # just sit on top of the store which is configured in the current $Foswiki::cfg. 66 66 # Most of the time this is ok, as store listeners will be told that 67 67 # the store is in test mode, so caches should be unaffected. However … … 106 106 $topicObject->setEmbeddedStoreForm($text); 107 107 108 unless ($handler->noCheckinPending()) { 109 # If a checkin is pending, fix the TOPICINFO 110 my $ri = $topicObject->get('TOPICINFO'); 111 my $truth = $handler->getInfo($version); 112 for my $i qw(author version date) { 113 $ri->{$i} = $truth->{$i}; 114 } 115 } 116 108 117 $gotRev = $version; 109 118 unless ( defined $gotRev ) { 110 119 111 # First try the just-loaded text for the revision120 # First try the just-loaded for the revision. 112 121 my $ri = $topicObject->get('TOPICINFO'); 113 if ( defined($ri) ) { 114 115 # SMELL: this can end up overriding a correct rev no (the one 116 # requested) with an incorrect one (the one in the TOPICINFO) 117 $gotRev = $ri->{version}; 118 } 119 } 120 if ( !$gotRev ) { 122 $gotRev = $ri->{version} if defined $ri; 123 } 124 if ( !defined $gotRev ) { 121 125 122 126 # No revision from any other source; must be latest … … 270 274 sub getRevisionHistory { 271 275 my ( $this, $topicObject, $attachment ) = @_; 272 276 273 277 my $itr = $this->askListenersRevisionHistory($topicObject, $attachment); 274 278 … … 333 337 my $verb = ( $topicObject->existsInStore() ) ? 'update' : 'insert'; 334 338 339 # just in case they are not sequential 340 my $nextRev = $handler->getNextRevisionID(); 341 my $ti = $topicObject->get('TOPICINFO'); 342 $ti->{version} = $nextRev; 343 $ti->{author} = $cUID; 344 335 345 $handler->addRevisionFromText( $topicObject->getEmbeddedStoreForm(), 336 346 'save topic', $cUID, $options->{forcedate} ); 337 338 # just in case they are not sequential339 my $nextRev = $handler->getLatestRevisionID();340 347 341 348 my $extra = $options->{minor} ? 'minor' : ''; … … 351 358 ASSERT( $topicObject->isa('Foswiki::Meta') ) if DEBUG; 352 359 ASSERT($cUID) if DEBUG; 353 354 360 my $info = $topicObject->getRevisionInfo(); 355 361 my $handler = $this->getHandler($topicObject); 356 362 $handler->replaceRevision( $topicObject->getEmbeddedStoreForm(), 357 'reprev', $ info->{author}, $info->{date} );363 'reprev', $cUID, $info->{date} ); 358 364 my $rev = $handler->getLatestRevisionID(); 359 365 $handler->recordChange( $cUID, $rev, 'minor, reprev' );
Note: See TracChangeset
for help on using the changeset viewer.
