Skip to content

Commit

Permalink
Item1898: update docs, and port to foswiki
Browse files Browse the repository at this point in the history
git-svn-id: http://svn.foswiki.org/trunk/ValidateUrlsPlugin@4617 0b4bb1d4-4e5a-0410-9cc4-b2b747904278
  • Loading branch information
SvenDowideit authored and SvenDowideit committed Aug 7, 2009
1 parent ee02597 commit 41c36cd
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 7 deletions.
6 changes: 3 additions & 3 deletions data/System/ValidateUrlsPlugin.txt
Expand Up @@ -11,8 +11,8 @@ One line description, required for extensions repository catalog.

This extension is best run from the command line, perhaps from a monthly cronjob..
<verbatim>
cd twiki/bin
./rest ValidateUrlsPlugin.getExternalLinks web Sandbox
cd foswiki/bin
./rest /ValidateUrlsPlugin/getExternalLinks web=Sandbox
</verbatim>
This will generate or update =Sandbox.WebExternalURLsReport= for the Sandbox web, listing all the url's it finds in the topics of the Sandbox web, listed either as broken, or working (from the point of view of the server).

Expand Down Expand Up @@ -47,4 +47,4 @@ This can be changed by setting ={Plugins}{ValidateUrlsPlugin}{ReportViewPermissi
| Plugin Home: | http://foswiki.org/Extensions/ValidateUrlsPlugin |


<!-- Do _not_ attempt to edit this topic; it is auto-generated. Please add comments/questions/remarks to the feedback topic on twiki.org instead. -->
<!-- Do _not_ attempt to edit this topic; it is auto-generated. Please add comments/questions/remarks to the feedback topic on foswiki.org instead. -->
12 changes: 8 additions & 4 deletions lib/Foswiki/Plugins/ValidateUrlsPlugin.pm
Expand Up @@ -46,7 +46,6 @@ searches through the specified web and lists all the explicitly listed external
=cut

sub getExternalLinks {

#my ($session) = @_;

#TODO: make a lease file, and only allow the first request to run..
Expand All @@ -55,7 +54,9 @@ sub getExternalLinks {
my %urlHash;
my $urls = \%urlHash;

my $web = Foswiki::Func::getCgiQuery()->param('web');
my $query = Foswiki::Func::getRequestObject();
my $web = $query->param('web');
return 'no web specified' if (not defined($web));
$web =~ /(.*)/;
$web = $1;

Expand Down Expand Up @@ -102,7 +103,7 @@ s/($Foswiki::regex{linkProtocolPattern}:([^\s<>'"\]]+[^\s*.,!?;:"')<|\]]))/_exte
my @okLinks;

foreach my $key (@sortedKeys) {
if ( $urls->{$key}->{response} eq 200 ) {
if ( defined($urls->{$key}->{response}) and $urls->{$key}->{response} eq 200 ) {
push( @okLinks, $key );
}
else {
Expand Down Expand Up @@ -161,7 +162,10 @@ s/($Foswiki::regex{linkProtocolPattern}:([^\s<>'"\]]+[^\s*.,!?;:"')<|\]]))/_exte
return
"$web contains "
. scalar( keys( %{$urls} ) )
. " urls: <br />$return\n\n";
. " urls: <br />$return\n\n"
. "see <a href='"
. Foswiki::Func::getScriptUrl($web, 'WebExternalURLsReport', 'view')
. "'>$web 's WebExternalURLsReport</a>";
}

sub _externalLink {
Expand Down

0 comments on commit 41c36cd

Please sign in to comment.