Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Item13315: Add a warning if PlainFile is on a pristine system
Make sure users know to select an RCS store if they intend to migrate
data.
  • Loading branch information
gac410 committed Mar 21, 2015
1 parent 0016ee0 commit 924e0de
Showing 1 changed file with 40 additions and 3 deletions.
Expand Up @@ -10,11 +10,37 @@ our @ISA = ('Foswiki::Configure::Checker');
sub check_current_value {
my ( $this, $reporter ) = @_;

_checkDir( $Foswiki::cfg{DataDir}, $reporter )
my $bad = 0;
$bad ||= _checkDir( $Foswiki::cfg{DataDir}, $reporter )
if ( defined $Foswiki::cfg{DataDir} );
_checkDir( $Foswiki::cfg{PubDir}, $reporter )
$bad ||= _checkDir( $Foswiki::cfg{PubDir}, $reporter )
if ( defined $Foswiki::cfg{PubDir} );

if ( _checkPFV( $Foswiki::cfg{DataDir} )
|| _checkPFV( $Foswiki::cfg{PubDir} ) )
{
$reporter->NOTE( <<HERE);
PlainFile history found. This is the correct choice.
*Caution* If you intend to migrate data from an older system, you will
need to migrate your data using the =tools/change_store.pl= script!
HERE
}
else {

if ( !$bad && $Foswiki::cfg{Store}{Implementation} =~ /PlainFile/ ) {
$reporter->NOTE(
'No RCS revision files were found. You may safely use the PlainFile Store.'
);
$reporter->WARN( <<HERE);
*Caution* If you intend to migrate data from an older version of Foswiki, you should select
one of the RCS based store now before editing any wiki topics or registering any users!
HERE
$reporter->NOTE( <<HERE);
If you want to convert to the =PlainFile= store, you will
need to migrate your data using the =tools/change_store.pl= script!
HERE
}
}
return;
}

Expand All @@ -33,10 +59,21 @@ sub _checkDir {
'RCS files detected, Migrate RCS files using =tools/change_store.pl=.'
);
$reporter->NOTE("First RCS file encountered: $bad");
return;
return 1;
}
}

sub _checkPFV {
my $ddir = shift;
Foswiki::Configure::Load::expandValue($ddir);

my $bad =
Foswiki::Configure::FileUtil::findFileOnTree( $ddir, qr/,pfv$/, qr/,v$/ );

return $bad;

}

1;
__END__
Foswiki - The Free and Open Source Wiki, http://foswiki.org/
Expand Down

0 comments on commit 924e0de

Please sign in to comment.