Skip to content

Commit

Permalink
Item609: TWikiCompatibilityPlugin need to work for INCLUDED and prett…
Browse files Browse the repository at this point in the history
…y much _any_ attempt to find a topic - so the compatibility sadly needs to be in Store.

git-svn-id: http://svn.foswiki.org/trunk@1671 0b4bb1d4-4e5a-0410-9cc4-b2b747904278
  • Loading branch information
SvenDowideit authored and SvenDowideit committed Dec 30, 2008
1 parent b683cad commit e788fed
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 25 deletions.
17 changes: 16 additions & 1 deletion core/lib/Foswiki/Store.pm
Expand Up @@ -87,7 +87,22 @@ sub finish {
sub _getHandler {
my ( $this, $web, $topic, $attachment ) = @_;

return $this->{IMPL}->new( $this->{session}, $web, $topic, $attachment );
my $handler = $this->{IMPL}->new( $this->{session}, $web, $topic, $attachment );

my $map = $Foswiki::cfg{Plugins}{TWikiCompatibilityPlugin}{WebSearchPath};
if ($Foswiki::cfg{Plugins}{TWikiCompatibilityPlugin}{Enabled}
&& defined ($map)
&& defined ($map->{$web})
&& !$handler->storedDataExists()
) {
#try the other
my $newhandler = $this->{IMPL}->new( $this->{session}, $map->{$web}, $topic, $attachment );
if ($newhandler->storedDataExists()) {
$handler = $newhandler;
}
}

return $handler;
}

=begin TML
Expand Down
26 changes: 2 additions & 24 deletions core/lib/Foswiki/UI/View.pm
Expand Up @@ -65,18 +65,6 @@ sub view {
my $rev = $store->cleanUpRevID( $query->param('rev') );

my $topicExists = $store->topicExists( $webName, $topicName );
my $map = $Foswiki::cfg{Plugins}{TWikiCompatibilityPlugin}{WebSearchPath};
if (!$topicExists
&& $Foswiki::cfg{Plugins}{TWikiCompatibilityPlugin}{Enabled}
&& defined($map)
&& defined($map->{$webName})
) {
#try the other web (TWikiCompatibility)
if ($topicExists = $session->{store}->topicExists(
$map->{$webName}, $topicName )) {
$session->{webName} = $webName = $map->{$webName};
}
}

# text and meta of the _latest_ rev of the topic
my ( $currText, $currMeta );
Expand Down Expand Up @@ -470,25 +458,15 @@ sub viewfile {

# The next element on the path has to be the topic name
$topic = shift(@path);
if (!$topic
|| !$session->{store}->topicExists($webName, $topic)) {
#try the other web (TWikiCompatibility)
my $map = $Foswiki::cfg{Plugins}{TWikiCompatibilityPlugin}{WebSearchPath};
if ($Foswiki::cfg{Plugins}{TWikiCompatibilityPlugin}{Enabled}
&& defined ($map)
&& $session->{store}->attachmentExists( $map->{$webName}, $topic, $fileName )) {
$webName = $map->{$webName};
$session->{response}->status(200); #OK, but, um non-authorative?
} else {
throw Foswiki::OopsException(
if (!$topic) {
Foswiki::OopsException(
'attention',
def => 'no_such_attachment',
web => $webName,
topic => $topic || 'Unknown',
status => 404,
params => [ 'viewfile', '?' ]
);
}
}
# Topic has been validated
$topic = Foswiki::Sandbox::untaintUnchecked($topic);
Expand Down

0 comments on commit e788fed

Please sign in to comment.