Tags:
create new tag
view all tags

Feature Proposal: viewRedirectHandler() in plug-ins

Motivation

You may need to redirect view access to a certain web or topic. Or you may want to redirect under certain circumstances

Description and Documentation

Plug-ins will be able to have viewRedirectHandler($session, $web, $topic). And $session->{plugins}->dispatch('viewRedirectHandler', $session, $web, $topic) will be put in the beginning of TWiki::UI::View::view().

viewRedirectHandler() returns 1 if it did $session->redirect(...). It returns 0 otherwise. The plug-in dispatcher calls viewRedirectHandler() of enabled plug-ins until one plug-in returns 1.

Examples

Let's assume the following situation.
  • You migrate from one TWiki build (core + plug-ins + configurations) to another
  • There are many subtle but noticeable incompatibilities between the old and new TWiki build
  • The TWiki site has many webs
Given those you may take the following migration strategy.
  • During the transition from the old build to the new, you run the old and new builds in parallel at different URLs: oldtwiki.example.com and newtwiki.example.com
  • The webs on oldtwiki.ms.com are migrated from the old build to the new one by one
  • The two builds share data files (data/* and pub/*) in such a manner that the old build can see the new build data read-only and vice versa. This is for cross web linking (Web.Topic) and cross web inclusion keep working between migrated and not-yet-migrated webs
  • Let's say NotMigratedWeb.PageA has a link to MigratedWeb.PageB
    • For this link to work properly,
      http://oldtwiki.example.com/cgi-bin/view/MigratedWeb/PageB needs to be redirected to
      http://newtwiki.example.com/cgi-bin/view/MigratedWeb/PageB
  • Let's say MigratedWeb.PageC has a link to NotMigratedWeb.PageD
    • For this link to work properly,
      http://newtwiki.example.com/cgi-bin/NotMigratedWeb/PageD needs to be redirected to
      http://oldtwiki.example.com/cgi-bin/NotMigratedWeb/PageD
  • Because of the incompatibilities between the two builds, migrated webs need to be displayed on the new build while not-yet-migrated webs needs to be displayed on the old build.
  • Links and inclusion need to work during and after transition from the old build to the new, which means links and inclusion needs to work in all permutation of a source topic, a destination topic, residing in the old build, residing in the new build
The redirection mentioned above can be cleanly implemented using a plug-in having a viewRedirectHandler(). After the transition is completed, the redirection mechanism can be cleanly removed by removing the plug-in.

Impact

Implementation

-- Contributors: Hideyo Imazu - 2013-02-01

Discussion

It's regarded as accepted after 7 days of the feedback period. I'm still open to feedback but move forward.

-- Hideyo Imazu - 2013-02-11

I do not understand the need, but I am sure there is a good one. Yes, accepted by 7 day rule.

-- Peter Thoeny - 2013-02-11

Added an example. Hope it helps.

-- Hideyo Imazu - 2013-02-12

Edit | Attach | Watch | Print version | History: r5 < r4 < r3 < r2 < r1 | Backlinks | Raw View | Raw edit | More topic actions
Topic revision: r5 - 2013-02-18 - HideyoImazu
 
  • Learn about TWiki  
  • Download TWiki
This site is powered by the TWiki collaboration platform Powered by Perl Hosted by OICcam.com Ideas, requests, problems regarding TWiki? Send feedback. Ask community in the support forum.
Copyright © 1999-2026 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.