Skip to content

Commit

Permalink
Item8530: de-(tm)wiki-ify
Browse files Browse the repository at this point in the history
git-svn-id: http://svn.foswiki.org/trunk/DistributedServersPlugin@6343 0b4bb1d4-4e5a-0410-9cc4-b2b747904278
  • Loading branch information
WillNorris authored and WillNorris committed Feb 15, 2010
1 parent 75ce317 commit bbeb4a9
Show file tree
Hide file tree
Showing 5 changed files with 36 additions and 37 deletions.
15 changes: 7 additions & 8 deletions data/TWiki/DistributedServersPlugin.txt
Expand Up @@ -14,13 +14,13 @@ This plugin adds
3 (future) distributed Topic rendering


For http://nextwiki.org, it delegates all TWiki web pub requests to http://starfish.nextwiki.org/nextwiki.org/pub/TWiki/.
To help make NextWiki.org as fast as possible, consider mirroring the files from there and emailing the http://twikifork.org/Community/InfrastructureTaskTeam to get your server added to our Content distribution network.
For http://foswiki.org, it delegates all System web pub requests to http://starfish.foswiki.org/foswiki.org/pub/System/.
To help make foswiki.org as fast as possible, consider mirroring the files from there and emailing the http://foswiki.org/Community/InfrastructureTaskTeam to get your server added to our Content distribution network.

---++ Installation Instructions

you will need to sync the attachments in the webs that you are CDN'ing - one way is to use rsync and crontab:
* =*/5 * * * * /usr/local/bin/rsync -ravl /home/twikifork.org/pub/TWiki -e "ssh -i /root/.ssh/starfish.dsa" nextwiki@fosiki.nextwiki.org:/home/nextwiki/starfish.nextwiki.org/nextwiki.org/pub/ > /root/starfish.log=
* =*/5 * * * * /usr/local/bin/rsync -ravl /home/foswiki.org/pub/System -e "ssh -i /root/.ssh/starfish.dsa" foswiki@fosiki.foswiki.org:/home/foswiki/starfish.foswiki.org/foswiki.org/pub/ > /root/starfish.log=

%$INSTALL_INSTRUCTIONS%

Expand All @@ -33,10 +33,9 @@ you will need to sync the attachments in the webs that you are CDN'ing - one way
| Change History: | <!-- versions below in reverse order -->&nbsp; |
| Nov2008: | initial simple release for nextwiki.org use |
| Dependencies: | %$DEPENDENCIES% |
| Plugin Home: | http://nextwiki.org/bin/view/Extensions/DistributedServersPlugin |
| Feedback: | http://nextwiki.org/bin/view/Extensions/DistributedServersPluginDev |
| Appraisal: | http://nextwiki.org/bin/view/Extensions/DistributedServersPluginAppraisal |
| Plugin Home: | http://foswiki.org/Extensions/%TOPIC% |
| Support: | http://foswiki.org/Support/%TOPIC% |

__Related Topics:__ %SYSTEMWEB%.TWikiPlugins, %SYSTEMWEB%.DeveloperDocumentationCategory, %SYSTEMWEB%.AdminDocumentationCategory, %SYSTEMWEB%.DefaultPreferences, %USERSWEB%.SitePreferences
__Related Topics:__ [[%SYSTEMWEB%.Plugins]], %SYSTEMWEB%.DeveloperDocumentationCategory, %SYSTEMWEB%.AdminDocumentationCategory, %SYSTEMWEB%.DefaultPreferences, %USERSWEB%.SitePreferences

<!-- 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. -->
24 changes: 12 additions & 12 deletions lib/TWiki/Plugins/DistributedServersPlugin.pm
Expand Up @@ -13,22 +13,22 @@

=pod
---+ package TWiki::Plugins::DistributedServersPlugin
---+ package Foswiki::Plugins::DistributedServersPlugin
enable distributed servers to leverage Browser speedups from using a CDN.
=cut

package TWiki::Plugins::DistributedServersPlugin;
package Foswiki::Plugins::DistributedServersPlugin;

use strict;
require TWiki::Func; # The plugins API
require TWiki::Plugins; # For the API version
require Foswiki::Func; # The plugins API
require Foswiki::Plugins; # For the API version

use vars
qw( $VERSION $RELEASE $SHORTDESCRIPTION $debug $pluginName $NO_PREFS_IN_TOPIC $pubCDNIndex);
$VERSION = '$Rev$';
$RELEASE = 'TWiki-4.2';
$RELEASE = 'Foswiki-4.2';
$SHORTDESCRIPTION = 'CDN and loadbalancing Wiki support';
$NO_PREFS_IN_TOPIC = 1;
$pluginName = 'DistributedServersPlugin';
Expand All @@ -37,14 +37,14 @@ sub initPlugin {
my ( $topic, $web, $user, $installWeb ) = @_;

# check for Plugins.pm versions
if ( $TWiki::Plugins::VERSION < 1.026 ) {
TWiki::Func::writeWarning(
if ( $Foswiki::Plugins::VERSION < 1 ) {
Foswiki::Func::writeWarning(
"Version mismatch between $pluginName and Plugins.pm");
return 0;
}

#force all pub URL's to be absolute.
$TWiki::cfg{PubUrlPath} = $TWiki::Plugins::SESSION->getPubUrl(1);
$Foswiki::cfg{PubUrlPath} = $Foswiki::Plugins::SESSION->getPubUrl(1);

return 1;
}
Expand All @@ -64,11 +64,11 @@ sub postRenderingHandler {
#my $text = shift;

# remove duplicated hostPath's
my $hostUrl = TWiki::Func::getUrlHost( );
my $hostUrl = Foswiki::Func::getUrlHost( );
$_[0] =~ s|($hostUrl)($hostUrl)|$1|g;

my $pubCDNMap = $TWiki::cfg{Plugins}{DistributedServersPlugin}{CDNMap};
#print STDERR $TWiki::cfg{Plugins}{DistributedServersPlugin}{CDNMap};
my $pubCDNMap = $Foswiki::cfg{Plugins}{DistributedServersPlugin}{CDNMap};
#print STDERR $Foswiki::cfg{Plugins}{DistributedServersPlugin}{CDNMap};
foreach my $from ( keys(%{$pubCDNMap}) ) {
#print STDERR "cdn? $from";
$_[0] =~ s|($from)|pubCDN($1)|ge;
Expand All @@ -77,7 +77,7 @@ sub postRenderingHandler {

sub pubCDN {
my $fromUrl = shift;
my $pubCDNMap = $TWiki::cfg{Plugins}{DistributedServersPlugin}{CDNMap};
my $pubCDNMap = $Foswiki::cfg{Plugins}{DistributedServersPlugin}{CDNMap};
my $url = $pubCDNMap->{$fromUrl}[ $pubCDNIndex++ ];
$pubCDNIndex = 0 if ( $pubCDNIndex >= scalar( @{ $pubCDNMap->{$fromUrl} } ) );

Expand Down
20 changes: 10 additions & 10 deletions lib/TWiki/Plugins/DistributedServersPlugin/Config.spec
Expand Up @@ -5,20 +5,20 @@
# this is most useful for skin files - and should be avoided for any Web's containing
# secured attachments
$TWiki::cfg{Plugins}{DistributedServersPlugin}{CDNMap} = {
'http://t42p/trunk/pub/TWiki/' => [
'http://starfish.nextwiki.org/nextwiki.org/pub/TWiki/'
'http://t42p/trunk/pub/System/' => [
'http://starfish.foswiki.org/foswiki.org/pub/System/'
],
'http://twikifork.org/pub/TWiki/' => [
'http://starfish.nextwiki.org/nextwiki.org/pub/TWiki/'
'http://twikifork.org/pub/System/' => [
'http://starfish.foswiki.org/foswiki.org/pub/System/'
],
'http://www.twikifork.org/pub/TWiki/' => [
'http://starfish.nextwiki.org/nextwiki.org/pub/TWiki/'
'http://www.twikifork.org/pub/System/' => [
'http://starfish.foswiki.org/foswiki.org/pub/System/'
],
'http://nextwiki.org/pub/TWiki/' => [
'http://starfish.nextwiki.org/nextwiki.org/pub/TWiki/'
'http://foswiki.org/pub/System/' => [
'http://starfish.foswiki.org/foswiki.org/pub/System/'
],
'http://www.nextwiki.org/pub/TWiki/' => [
'http://starfish.nextwiki.org/nextwiki.org/pub/TWiki/'
'http://www.foswiki.org/pub/System/' => [
'http://starfish.foswiki.org/foswiki.org/pub/System/'
]
};

Expand Down
6 changes: 3 additions & 3 deletions lib/TWiki/Plugins/DistributedServersPlugin/MANIFEST
@@ -1,4 +1,4 @@
# Release manifest for DistributedServersPlugin
data/TWiki/DistributedServersPlugin.txt 0644 Documentation
lib/TWiki/Plugins/DistributedServersPlugin.pm 0644 Perl module
lib/TWiki/Plugins/DistributedServersPlugin/Config.spec
data/Foswiki/DistributedServersPlugin.txt 0644 Documentation
lib/Foswiki/Plugins/DistributedServersPlugin.pm 0644 Perl module
lib/Foswiki/Plugins/DistributedServersPlugin/Config.spec
8 changes: 4 additions & 4 deletions lib/TWiki/Plugins/DistributedServersPlugin/build.pl
Expand Up @@ -2,10 +2,10 @@
BEGIN {
unshift @INC, split( /:/, $ENV{FOSWIKI_LIBS} );
}
use TWiki::Contrib::Build;
use Foswiki::Contrib::Build;

# Create the build object
$build = new TWiki::Contrib::Build('DistributedServersPlugin');
$build = new Foswiki::Contrib::Build('DistributedServersPlugin');

# (Optional) Set the details of the repository for uploads.
# This can be any web on any accessible TWiki installation.
Expand All @@ -15,9 +15,9 @@ BEGIN
# name of web to upload to
$build->{UPLOADTARGETWEB} = 'Extensions';
# Full URL of pub directory
$build->{UPLOADTARGETPUB} = 'http://nextwiki.org/pub';
$build->{UPLOADTARGETPUB} = 'http://foswiki.org/pub';
# Full URL of bin directory
$build->{UPLOADTARGETSCRIPT} = 'http://nextwiki.org/bin';
$build->{UPLOADTARGETSCRIPT} = 'http://foswiki.org/bin';
# Script extension
$build->{UPLOADTARGETSUFFIX} = '';

Expand Down

0 comments on commit bbeb4a9

Please sign in to comment.