#!/usr/bin/perl -w #!d:/cygwin/bin/perl.exe -w # # TWiki Collaboration Platform, http://TWiki.org/ # # Copyright (C) 2000-2004 Peter Thoeny, peter@thoeny.com # Copyright (C) 2004 Matt Wilkie, maphew@zworg.com # # For licensing info read license.txt file in the TWiki root. # 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. # # 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. See the # GNU General Public License for more details, published at # http://www.gnu.org/copyleft/gpl.html # # DESCRIPTION # This script changes the RCS lock owner to the web server user # The script is to be run as needed, which is probably: # 1) on a new installation, # 2) you've moved to a different server # 3) you've installed some new plugins or addons. # BEGIN { # Set default current working directory (needed for mod_perl) if( $ENV{"SCRIPT_FILENAME"} && $ENV{"SCRIPT_FILENAME"} =~ /^(.+)\/[^\/]+$/ ) { chdir $1; } # Set library paths in @INC, at compile time unshift @INC, '.'; require 'setlib.cfg'; } use strict; use TWiki; print "Content-type: text/html\n\n"; print "\n"; print "Preparing to change all RCS locks to match current webserver user.\n"; print "Please wait for this page to tell you it is finished.\n"; print "This could take awhile, depending on the number of topics to process\n"; print "(about 10 seconds for a standard twiki beta release - 615 topics -\n"; print "on a Win2k+cygwin+apache2 machine running @ 1100MHz with 512MB ram)."; opendir(DATA, $TWiki::dataDir) or die "Open $TWiki::dataDir failed"; foreach my $web ( grep /^\w+$/, readdir DATA ) { print "

Unlocking $web

\n"; if ( -d "$TWiki::dataDir/$web" ) { opendir(WEB, "$TWiki::dataDir/$web") or die "Open $TWiki::dataDir/$web failed";; foreach my $topic ( grep /.txt$/, readdir WEB ) { print "$topic "; print `$TWiki::rcsDir/rcs -q -u -M $TWiki::dataDir/$web/$topic`; print `$TWiki::rcsDir/rcs -q -l $TWiki::dataDir/$web/$topic`; print "
\n"; } closedir(WEB); } } closedir(DATA); print ""; 1;