in lib/metafile.pl [202:287]
sub outofdate($$$) {
my $dirname = shift;
my $basename = shift;
my $lang = shift;
if (/^\Q$basename.xml/) {
my $ood = 0;
my $reven = reven($dirname, $basename);
if ($reven) {
my $curpath = docpath("$dirname$_");
my ($rev, $orev);
# grab the revision info from the source file
sysopen(FILE, $curpath, O_RDONLY)
or die "could not open file '$curpath' ($!), stopped";
{
local $_;
while (<FILE>) {
$rev = $1, $orev=$2, last
if /<!--\s*English\s+Revision\s*:\s*([^\s:]+)
(?::(\S+)\s+\(outdated\))?\s+-->/xi
or
/<!--\s*English\s+Revision\s*:\s*(\S+)\s+
(?:\(outdated:\s*(\S+)\s*\)\s+)?-->/xi;
}
}
close(FILE)
or die "could not close file '$curpath' ($!), stopped";
# if outdated, take some action
if ($rev and $rev ne $reven) {
# note the actual revision in the source file
unless ($orev and $orev eq $reven) {
my $cont;
sysopen(FILE, $curpath, O_RDONLY)
or die "could not open file '$curpath' ($!), stopped";
{
local $/; # slurp mode
$cont = <FILE>;
}
close(FILE)
or die "could not close file '$curpath' ($!), stopped";
unless (
$cont =~ s{<!--\s*English\s+Revision\s*:\s*([^\s:]+)
(?::\S+\s+\(outdated\))?\s+-->}
{<!-- English Revision: $1:$reven (outdated) -->}ix
) {
$cont =~ s{<!--\s*English\s+Revision\s*:\s*(\S+)\s+
(?:\(outdated[^)]*\)\s+)?-->}
{<!-- English Revision: $1:$reven (outdated) -->}ix
}
sysopen(FILE, "$curpath.tmp", O_WRONLY | O_CREAT | O_TRUNC)
or die "could not open file '$curpath.tmp' ($!), stopped";
print FILE $cont
or die "could write file '$curpath.tmp' ($!), stopped";
close(FILE)
or die "could not close file '$curpath.tmp' ($!), stopped";
rename "$curpath.tmp", $curpath
or die "could not rename $curpath.tmp -> $curpath ".
"($!), stopped";
print substr($dirname, 1), $_, " adjusted (refers to: ",
$rev, ", current is: $reven)\n";
}
# record the filename for later output on the terminal
$curpath = docpath(".outdated.$lang");
sysopen(FILE, $curpath, O_WRONLY | O_CREAT | O_APPEND)
or die "could not open file '$curpath' ($!), stopped";
print FILE substr("$dirname$_\n", 1);
close(FILE)
or die "could not close file '$curpath' ($!), stopped";
return 23; # true, soo true.
}
}
}
return;
}