From: <de...@de...> - 2017-06-29 10:18:39
|
Author: HideyoImazu Date: 2017-06-29 10:02:26 +0000 (Thu, 29 Jun 2017) New Revision: 30352 Trac url: http://develop.twiki.org/trac/changeset/30352 Modified: twiki/branches/TWikiRelease06x00/core/lib/TWiki/Store/RcsWrap.pm twiki/branches/TWikiRelease06x00/core/lib/TWiki/UI/Save.pm twiki/branches/TWikiRelease06x00/core/templates/messages.tmpl Log: Item7815: Coping with zero byte RCS file Modified: twiki/branches/TWikiRelease06x00/core/lib/TWiki/Store/RcsWrap.pm =================================================================== --- twiki/branches/TWikiRelease06x00/core/lib/TWiki/Store/RcsWrap.pm 2017-06-29 10:00:57 UTC (rev 30351) +++ twiki/branches/TWikiRelease06x00/core/lib/TWiki/Store/RcsWrap.pm 2017-06-29 10:02:26 UTC (rev 30352) @@ -263,6 +263,11 @@ sub numRevisions { my( $this ) = @_; + if ( -e $this->{rcsFile} && -s $this->{rcsFile} == 0 ) { + $this->{session}->writeWarning('null RCS: ' . $this->{rcsFile}); + $this->{session}{rcsFileNull} = 1; + unlink $this->{rcsFile}; + } unless( -e $this->{rcsFile}) { return 1 if( -e $this->{file} ); return 0; Modified: twiki/branches/TWikiRelease06x00/core/lib/TWiki/UI/Save.pm =================================================================== --- twiki/branches/TWikiRelease06x00/core/lib/TWiki/UI/Save.pm 2017-06-29 10:00:57 UTC (rev 30351) +++ twiki/branches/TWikiRelease06x00/core/lib/TWiki/UI/Save.pm 2017-06-29 10:02:26 UTC (rev 30352) @@ -655,6 +655,15 @@ params => $merged ); } + if ( $session->{rcsFileNull} ) { + throw TWiki::OopsException( + 'attention', + def => 'prior_versions_lost', + web => $web, + topic => $topic, + params => "past revisions are lost." ); + } + $session->redirect( $redirecturl, undef, ( $saveaction ne 'checkpoint' ) ); } Modified: twiki/branches/TWikiRelease06x00/core/templates/messages.tmpl =================================================================== --- twiki/branches/TWikiRelease06x00/core/templates/messages.tmpl 2017-06-29 10:00:57 UTC (rev 30351) +++ twiki/branches/TWikiRelease06x00/core/templates/messages.tmpl 2017-06-29 10:02:26 UTC (rev 30352) @@ -459,6 +459,13 @@ %MAKETEXT{"Go back in your browser and save your changes locally."}% %TMPL:END% +%TMPL:DEF{"prior_versions_lost"}% +---+++ %MAKETEXT{"Prior versions lost"}% +%MAKETEXT{"During save of [_1] an error was found by the version control system. The latest and the previous versions of this topic are fine but all prior versions are lost. Your [_2] administrator may be able to recover the lost versions." args="<nop>%WEB%.<nop>%TOPIC%,%WIKITOOLNAME%"}% + +*[[%WEB%.%TOPIC%][%MAKETEXT{"OK"}%]]* + +%TMPL:END% %TMPL:DEF{"rename_web_prerequisites"}% ---+++ %MAKETEXT{"There are problems with renaming this web:"}% 1.%MAKETEXT{"You are denied access to the following topics in the web:"}% |