-
Notifications
You must be signed in to change notification settings - Fork 38
/
RCSStoreContrib.pm
106 lines (79 loc) · 3.39 KB
/
RCSStoreContrib.pm
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
# See bottom of file for default license and copyright information
=begin TML
---+ package Foswiki::Contrib::RCSStoreContrib
This is a stub module for a new contrib. Customise this module as
required. It is typically not used by the Contrib. Foswiki does not load it
automatically. It is used by the Extensions Installer to detect the currently
installed version of the Contrib.
=cut
package Foswiki::Contrib::RCSStoreContrib;
# Always use strict to enforce variable scoping
use strict;
use warnings;
use Foswiki::Configure::Load;
our $VERSION = '1.23';
our $RELEASE = '17 Nov 2023';
our $SHORTDESCRIPTION =
'A wiki topic and attachment store using the RCS revision control system';
=begin TML
---++ bootstrapStore
Class method called from configuration bootstrap to determine if this
store can be used. If it's usable, it will take precedence over the RCS
based configurations.
This method "guesses" the following configuration settings
* ={Store}{Implementation}=
It must run after the DataDir and PubDir settings have been applied.
If it detects both RCS and PlainFile store files, it dies to prevent
history corruption.
=cut
sub bootstrapStore {
if (
my $hit = (
Foswiki::Configure::FileUtil::findFileOnTree(
$Foswiki::cfg{DataDir}, qr/,pfv$/, qr/,v$/ )
|| Foswiki::Configure::FileUtil::findFileOnTree(
$Foswiki::cfg{PubDir}, qr/,pfv$/, qr/,v$/
)
)
)
{
print STDERR
"AUTOCONFIG: Unable to use RCSStore: ,pfv files were found in data or pub, which indicates this installation is already configured for PlainFileStore e.g. $hit\n"
if (Foswiki::Configure::Load::TRAUTO);
if (
Foswiki::Configure::FileUtil::findFileOnTree(
$Foswiki::cfg{DataDir}, qr/,v$/, qr/,pfv$/ )
|| Foswiki::Configure::FileUtil::findFileOnTree(
$Foswiki::cfg{PubDir}, qr/,v$/, qr/,pfv$/
)
)
{
die
"AUTOCONFIG: WARNING: both ,pfv and ,v files were found in data or pub, suggesting that both stores have been used at some point. Unable to autoconfigure - please resolve the histories manually.\n";
}
return;
}
# If some other store is configured, don't override it. Rcs stores
# are the last resort. Default to RcsLite, it's the most portable.
unless ( $Foswiki::cfg{Store}{Implementation} ) {
$Foswiki::cfg{Store}{Implementation} = 'Foswiki::Store::RcsLite';
print STDERR "AUTOCONFIG: Store configured for RcsLite\n"
if (Foswiki::Configure::Load::TRAUTO);
}
}
1;
__END__
Foswiki - The Free and Open Source Wiki, http://foswiki.org/
Author: FoswikiContributor
Copyright (C) 2008-2023 Foswiki Contributors. Foswiki Contributors
are listed in the AUTHORS file in the root of this distribution.
NOTE: Please extend that file, not this notice.
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version. For
more details read LICENSE in the root of this distribution.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
As per the GPL, removal of this notice is prohibited.