You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@openoffice.apache.org by bu...@apache.org on 2012/04/08 03:56:53 UTC

svn commit: r811917 - in /websites/staging/ooo-site/trunk: cgi-bin/ content/ content/download/test/download_new_dl.js content/download/test/globalvars_new_dl.js

Author: buildbot
Date: Sun Apr  8 01:56:53 2012
New Revision: 811917

Log:
Staging update by buildbot for openofficeorg

Modified:
    websites/staging/ooo-site/trunk/cgi-bin/   (props changed)
    websites/staging/ooo-site/trunk/content/   (props changed)
    websites/staging/ooo-site/trunk/content/download/test/download_new_dl.js
    websites/staging/ooo-site/trunk/content/download/test/globalvars_new_dl.js

Propchange: websites/staging/ooo-site/trunk/cgi-bin/
------------------------------------------------------------------------------
--- cms:source-revision (original)
+++ cms:source-revision Sun Apr  8 01:56:53 2012
@@ -1 +1 @@
-1310906
+1310936

Propchange: websites/staging/ooo-site/trunk/content/
------------------------------------------------------------------------------
--- cms:source-revision (original)
+++ cms:source-revision Sun Apr  8 01:56:53 2012
@@ -1 +1 @@
-1310906
+1310936

Modified: websites/staging/ooo-site/trunk/content/download/test/download_new_dl.js
==============================================================================
--- websites/staging/ooo-site/trunk/content/download/test/download_new_dl.js (original)
+++ websites/staging/ooo-site/trunk/content/download/test/download_new_dl.js Sun Apr  8 01:56:53 2012
@@ -35,25 +35,28 @@ function getMirrorHost() {
 		// Are Apache mirrors working?
 		if ( MIRROR_ASF_ACTIVE > 0 ) {
 			mirrorHost = "Apache";
+		}
 
 		// Else are SourceForge mirrors working?
-		} else if ( MIRROR_SF_ACTIVE > 0 ) {
+		else if ( MIRROR_SF_ACTIVE > 0 ) {
 			mirrorHost = "SourceForge";
+		}
 
 		// None is working, we have a problem
-		} else {
+		else {
 			mirrorHost = "No mirror host active, what to do?";
 		}
 
-		document.write( "Fall back download goes to: " + mirrorHost + "<br/><br/>" );
+		document.write( "Fall back download goes to: " + mirrorHost + "<br/>" );
+		document.write( "<br/>" );
 	}
 
 	return mirrorHost;
 }
 
 function getMirrorHost_asf_sf_mb_percent() {
-	var mirrorHost = "";
-	var randVal    = ( Math.random() * 100 );
+	var mirrorHost   = "";
+	var randVal      = ( Math.random() * 100 );
 	var MIRROR_RATIO = MIRROR_RATIO_2;
 
 	document.write( "ASF is active: " + MIRROR_ASF_ACTIVE + "<br/>" );
@@ -84,6 +87,7 @@ function getMirrorHost_asf_sf_mb_percent
 			mirrorHost = "MirrorBrain";
 		}
 	}
+
 	document.write( "Regular download goes to: " + mirrorHost + "<br/>" );
 
 	// Defining fall back mirror host
@@ -91,34 +95,96 @@ function getMirrorHost_asf_sf_mb_percent
 		// Are Apache mirrors working?
 		if ( MIRROR_ASF_ACTIVE > 0 ) {
 			mirrorHost = "Apache";
+		}
 
 		// Else are SourceForge mirrors working?
-		} else if ( MIRROR_SF_ACTIVE > 0 ) {
+		else if ( MIRROR_SF_ACTIVE > 0 ) {
 			mirrorHost = "SourceForge";
+		}
 
 		// Else are MirrorBrain mirrors working?
-		} else if ( MIRROR_MB_ACTIVE > 0 ) {
+		else if ( MIRROR_MB_ACTIVE > 0 ) {
 			mirrorHost = "MirrorBrain";
+		}
 
 		// None is working, we have a problem
-		} else {
+		else {
 			mirrorHost = "None, what to do?";
 		}
 
-		document.write( "Fall back download goes to: " + mirrorHost + "<br/><br/>" );
+		document.write( "Fall back download goes to: " + mirrorHost + "<br/>" );
+		document.write( "<br/>" );
 	}
 
 	return mirrorHost;
 }
 
 function getMirrorHost_asf_sf_mb_weighted() {
+	var mirrorHost    = "";
+	// get total weight of the weight array (here it is 6)
+	var weight        = eval( MIRROR_HOSTS_WEIGHT.join( "+" ) );
+	// multiply the random numbe with the total weight and round it down
+	var randVal       = Math.floor ( Math.random() * weight );
+	// Assign the random position of the weighted array
+	var mirrorHost = MIRROR_HOSTS_WEIGHTED [ randVal ];
+
+	document.write( "ASF is active: " + MIRROR_ASF_ACTIVE        + "<br/>" );
+	document.write( "MB is active: "  + MIRROR_MB_ACTIVE         + "<br/>" );
+	document.write( "SF is active: "  + MIRROR_SF_ACTIVE         + "<br/>" );
+	document.write( "ASF weight: "    + MIRROR_HOSTS_WEIGHT[ 0 ] + "<br/>" );
+	document.write( "MB weight: "     + MIRROR_HOSTS_WEIGHT[ 1 ] + "<br/>" );
+	document.write( "SF weight: "     + MIRROR_HOSTS_WEIGHT[ 2 ] + "<br/>" );
+	document.write( "Total weight: "  + weight                   + "<br/>" );
+	document.write( "Random value: "  + randVal                  + "<br/>" );
+	document.write( "<br/>" );
+
+	document.write( "Regular download goes to: " + mirrorHost + "<br/>" );
+
+	// Defining fall back mirror host
+
+	// Is Apache down?
+	if ( ( MIRROR_ASF_ACTIVE < 1 ) && ( mirrorHost == "Apache" ) )
+		mirrorHost = "MirrorBrain";
+
+	// Is MirrorBrain down?
+	else if ( ( MIRROR_MB_ACTIVE < 1 ) && ( mirrorHost == "MirrorBrain" ) )
+		mirrorHost = "SourceForge";
+
+	// Is SourceForge down?
+	else if ( ( MIRROR_SF_ACTIVE < 1 ) && ( mirrorHost == "SourceForge" ) )
+		mirrorHost = "MirrorBrain";
+
+	// Is Apache and MirrorBrain down?
+	if ( ( MIRROR_ASF_ACTIVE < 1 ) && ( MIRROR_MB_ACTIVE < 1 ) )
+		mirrorHost = "SourceForge";
+
+	// Is Apache and SourceForge down?
+	else if ( ( MIRROR_ASF_ACTIVE < 1 ) && ( MIRROR_SF_ACTIVE < 1 ) )
+		mirrorHost = "MirrorBrain";
+
+	// Is MirrorBrain and SourceForge down?
+	else if ( ( MIRROR_MB_ACTIVE < 1 ) && ( MIRROR_SF_ACTIVE < 1 ) )
+		mirrorHost = "Apache";
+
+	// None is working, we have a problem
+	if ( ( MIRROR_ASF_ACTIVE < 1 ) && ( MIRROR_MB_ACTIVE < 1 )
+	&& ( MIRROR_SF_ACTIVE < 1 ) )
+		mirrorHost = "None, what to do?";
+
+	document.write( "Fall back download goes to: " + mirrorHost + "<br/>" );
+	document.write( "<br/>" );
+
+	return mirrorHost;
+}
+
+function getMirrorHost_asf_sf_mb_weighted2() {
 	var mirrorHost = "";
 	var weight     = MIRROR_ASF_WEIGHT + MIRROR_MB_WEIGHT + MIRROR_SF_WEIGHT;
 	var randVal    = Math.random();
 
 	document.write( "ASF is active: "  + MIRROR_ASF_ACTIVE              + "<br/>" );
-	document.write( "SF is active: "   + MIRROR_SF_ACTIVE               + "<br/>" );
 	document.write( "MB is active: "   + MIRROR_MB_ACTIVE               + "<br/>" );
+	document.write( "SF is active: "   + MIRROR_SF_ACTIVE               + "<br/>" );
 	document.write( "ASF weight: "     + MIRROR_ASF_WEIGHT + " ");
 	document.write( "with threshold: " + ( MIRROR_ASF_WEIGHT / weight ) + "<br/>" );
 	document.write( "MB weight: "      + MIRROR_MB_WEIGHT + " ");
@@ -139,9 +205,10 @@ function getMirrorHost_asf_sf_mb_weighte
 
 	// Are MirrorBrain mirrors working?
 	if ( MIRROR_MB_ACTIVE > 0 ) {
-	// If random value is lower than SF weight divided by the total weight
-	// and higher than ASF weight divided by the total weight
-		if ( randVal < ( MIRROR_SF_WEIGHT / weight ) && ( randVal > ( MIRROR_ASF_WEIGHT / weight ) )) {
+		// If random value is lower than SF weight divided by the total weight
+		// and higher than ASF weight divided by the total weight
+		if ( ( randVal > ( MIRROR_ASF_WEIGHT / weight ) )
+		&& ( randVal < ( MIRROR_SF_WEIGHT / weight ) ) ) {
 			mirrorHost = "MirrorBrain";
 		}
 	}
@@ -153,6 +220,7 @@ function getMirrorHost_asf_sf_mb_weighte
 			mirrorHost = "SourceForge";
 		}
 	}
+
 	document.write( "Regular download goes to: " + mirrorHost + "<br/>" );
 
 	// Defining fall back mirror host
@@ -161,20 +229,21 @@ function getMirrorHost_asf_sf_mb_weighte
 		if ( MIRROR_ASF_ACTIVE > 0 ) {
 			mirrorHost = "Apache";
 
-		// Else are SourceForge mirrors working?
-		} else if ( MIRROR_SF_ACTIVE > 0 ) {
-			mirrorHost = "SourceForge";
-
 		// Else are MirrorBrain mirrors working?
 		} else if ( MIRROR_MB_ACTIVE > 0 ) {
 			mirrorHost = "MirrorBrain";
 
+		// Else are SourceForge mirrors working?
+		} else if ( MIRROR_SF_ACTIVE > 0 ) {
+			mirrorHost = "SourceForge";
+
 		// None is working, we have a problem
 		} else {
 			mirrorHost = "None, what to do?";
 		}
 
-		document.write( "Fall back download goes to: " + mirrorHost + "<br/><br/>" );
+		document.write( "Fall back download goes to: " + mirrorHost + "<br/>" );
+		document.write( "<br/>" );
 	}
 
 	return mirrorHost;

Modified: websites/staging/ooo-site/trunk/content/download/test/globalvars_new_dl.js
==============================================================================
--- websites/staging/ooo-site/trunk/content/download/test/globalvars_new_dl.js (original)
+++ websites/staging/ooo-site/trunk/content/download/test/globalvars_new_dl.js Sun Apr  8 01:56:53 2012
@@ -15,14 +15,14 @@
 
 // The supported mirror hosts, 0 means not ready to receive load
 // The mirror ratio in percent
-var MIRROR_ASF_ACTIVE = 1;
-var MIRROR_SF_ACTIVE  = 1;
-var MIRROR_MB_ACTIVE  = 1;
-var MIRROR_RATIO_1    = 75;
-var MIRROR_RATIO_2    = 33;
-var MIRROR_ASF_WEIGHT = 1;
-var MIRROR_MB_WEIGHT  = 2;
-var MIRROR_SF_WEIGHT  = 3;
+var MIRROR_ASF_ACTIVE   = 1;
+var MIRROR_SF_ACTIVE    = 0;
+var MIRROR_MB_ACTIVE    = 1;
+var MIRROR_RATIO_1      = 75;
+var MIRROR_RATIO_2      = 33;
+var MIRROR_HOSTS        = [ "Apache", "MirrorBrain", "SourceForge" ];
+var MIRROR_HOSTS_WEIGHT = [ 1, 2, 3 ];
+var MIRROR_HOSTS_WEIGHTED = [ "Apache", "MirrorBrain", "MirrorBrain", "SourceForge", "SourceForge", "SourceForge" ];
 
 // Exchange the variables resp. its content to switch the MirrorBrain server
 var MIRROR_BOUNCER_URL      = "http://openoffice.bouncer.osuosl.org/";