You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@openoffice.apache.org by ma...@apache.org on 2012/04/07 15:57:26 UTC
svn commit: r1310774 - in
/incubator/ooo/ooo-site/trunk/content/download/test: download_new_dl.js
globalvars_new_dl.js index_new_dl.html
Author: marcus
Date: Sat Apr 7 13:57:25 2012
New Revision: 1310774
URL: http://svn.apache.org/viewvc?rev=1310774&view=rev
Log:
Testing new download logic
Added:
incubator/ooo/ooo-site/trunk/content/download/test/download_new_dl.js (with props)
incubator/ooo/ooo-site/trunk/content/download/test/globalvars_new_dl.js (with props)
incubator/ooo/ooo-site/trunk/content/download/test/index_new_dl.html (with props)
Added: incubator/ooo/ooo-site/trunk/content/download/test/download_new_dl.js
URL: http://svn.apache.org/viewvc/incubator/ooo/ooo-site/trunk/content/download/test/download_new_dl.js?rev=1310774&view=auto
==============================================================================
--- incubator/ooo/ooo-site/trunk/content/download/test/download_new_dl.js (added)
+++ incubator/ooo/ooo-site/trunk/content/download/test/download_new_dl.js Sat Apr 7 13:57:25 2012
@@ -0,0 +1,112 @@
+/*
+ * get mirror host
+ * depends on which mirror is ready to receive load
+ */
+
+function getMirrorHost() {
+ var mirrorHost = "";
+ var randVal = ( Math.random() * 100 );
+ var MIRROR_RATIO = MIRROR_RATIO_1;
+
+ document.write( "ASF is active: " + MIRROR_ASF_ACTIVE + "<br/>" );
+ document.write( "SF is active: " + MIRROR_SF_ACTIVE + "<br/>" );
+ document.write( "Mirror ratio: " + MIRROR_RATIO + " % <br/>" );
+ document.write( "Random value: " + randVal + "<br/><br/>" );
+
+ // Are Apache mirrors working?
+ if ( MIRROR_ASF_ACTIVE > 0 ) {
+ // If random value is lower than ratio
+ if ( randVal < MIRROR_RATIO ) {
+ mirrorHost = "Apache";
+ }
+ }
+ // Are SourceForge mirrors working?
+ if ( MIRROR_SF_ACTIVE > 0 ) {
+ // If random value is higher than ratio
+ if ( randVal > MIRROR_RATIO ) {
+ mirrorHost = "SourceForge";
+ }
+ }
+
+ document.write( "Regular download goes to: " + mirrorHost + "<br/><br/>" );
+
+ // Defining fall back mirror host
+ if ( mirrorHost == "" ) {
+ // Are Apache mirrors working?
+ if ( MIRROR_ASF_ACTIVE > 0 ) {
+ mirrorHost = "Apache";
+
+ // Else are SourceForge mirrors working?
+ } else if ( MIRROR_SF_ACTIVE > 0 ) {
+ mirrorHost = "SourceForge";
+
+ // None is working, we have a problem
+ } else {
+ mirrorHost = "No mirror host active, what to do?";
+ }
+
+ document.write( "Fall back download goes to: " + mirrorHost + "<br/><br/>" );
+ }
+
+ return mirrorHost;
+}
+
+function getMirrorHost_asf_sf_mb() {
+ var mirrorHost = "";
+ var randVal = ( Math.random() * 100 );
+ var MIRROR_RATIO = MIRROR_RATIO_2;
+
+ 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( "Mirror ratio: " + MIRROR_RATIO + " % <br/>" );
+ document.write( "Random value: " + randVal + "<br/><br/>" );
+
+ // Are Apache mirrors working?
+ if ( MIRROR_ASF_ACTIVE > 0 ) {
+ // If random value is lower than ratio
+ if ( randVal < MIRROR_RATIO ) {
+ mirrorHost = "Apache";
+ }
+ }
+ // Are SourceForge mirrors working?
+ if ( MIRROR_SF_ACTIVE > 0 ) {
+ // If random value is higher than ratio and lower than ratio * 2
+ if ( ( randVal > MIRROR_RATIO ) && ( randVal < ( MIRROR_RATIO * 2 ) ) ) {
+ mirrorHost = "SourceForge";
+ }
+ }
+
+ // Are Mirrorbrain mirrors working?
+ if ( MIRROR_MB_ACTIVE > 0 ) {
+ // If random value is higher than ratio * 2
+ if ( randVal > ( MIRROR_RATIO * 2 ) ) {
+ mirrorHost = "MirrorBrain";
+ }
+ }
+ document.write( "Regular download goes to: " + mirrorHost + "<br/><br/>" );
+
+ // Defining fall back mirror host
+ if ( mirrorHost == "" ) {
+ // Are Apache mirrors working?
+ 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";
+
+ // None is working, we have a problem
+ } else {
+ mirrorHost = "None, what to do?";
+ }
+
+ document.write( "Fall back download goes to: " + mirrorHost + "<br/><br/>" );
+ }
+
+ return mirrorHost;
+}
Propchange: incubator/ooo/ooo-site/trunk/content/download/test/download_new_dl.js
------------------------------------------------------------------------------
svn:eol-style = native
Added: incubator/ooo/ooo-site/trunk/content/download/test/globalvars_new_dl.js
URL: http://svn.apache.org/viewvc/incubator/ooo/ooo-site/trunk/content/download/test/globalvars_new_dl.js?rev=1310774&view=auto
==============================================================================
--- incubator/ooo/ooo-site/trunk/content/download/test/globalvars_new_dl.js (added)
+++ incubator/ooo/ooo-site/trunk/content/download/test/globalvars_new_dl.js Sat Apr 7 13:57:25 2012
@@ -0,0 +1,36 @@
+/* This file is to maintain version information that can be used
+ on all websites via JavaScript when including this file.
+
+ Instead of hard coded version data please use these variables.
+ Example:
+
+ Wrong: "We are proud to announce the availability of our new
+ OpenOffice.org 3.0.0 release."
+ Correct: "We are proud to announce the availability of our new
+ OpenOffice.org " + VERSION + " release."
+
+ MIRROR: should be "bouncer" or "mirrorbrain"
+ SCHEMA: reflects the download-set naming-schema with "old" or "new"
+*/
+
+// The supported mirror hosts, 0 means not ready to receive load
+// The mirror ratio in percent
+var MIRROR_ASF_ACTIVE = 0;
+var MIRROR_SF_ACTIVE = 1;
+var MIRROR_MB_ACTIVE = 1;
+var MIRROR_RATIO_1 = 75;
+var MIRROR_RATIO_2 = 33;
+
+// Exchange the variables resp. its content to switch the MirrorBrain server
+var MIRROR_BOUNCER_URL = "http://openoffice.bouncer.osuosl.org/";
+var MIRROR_MIRRORBRAIN_URL = "http://openoffice.mirrorbrain.org/";
+// var MIRROR_MIRRORBRAIN_URL = "http://download.services.openoffice.org/";
+var MIRROR_SOURCEFORGE_URL = "http://sourceforge.net/projects/openofficeorg.mirror/";
+
+// Variables to shortcut long URLs
+var MIRROR_MAC_PPC_URL = "http://ooopackages.good-day.net/pub/OpenOffice.org/contrib/macosppc/";
+var MIRROR_FREEBSD32_URL = "http://ooopackages.good-day.net/pub/OpenOffice.org/contrib/freebsdx86/";
+var MIRROR_FREEBSD64_URL = "http://ooopackages.good-day.net/pub/OpenOffice.org/contrib/freebsdx86-64/";
+var MIRROR_EXT_URL = MIRROR_MIRRORBRAIN_URL + "files/extended/";
+var MIRROR_LOC_URL = MIRROR_MIRRORBRAIN_URL + "files/localized/";
+var MIRROR_STABLE_URL = MIRROR_MIRRORBRAIN_URL + "files/stable/";
Propchange: incubator/ooo/ooo-site/trunk/content/download/test/globalvars_new_dl.js
------------------------------------------------------------------------------
svn:eol-style = native
Added: incubator/ooo/ooo-site/trunk/content/download/test/index_new_dl.html
URL: http://svn.apache.org/viewvc/incubator/ooo/ooo-site/trunk/content/download/test/index_new_dl.html?rev=1310774&view=auto
==============================================================================
--- incubator/ooo/ooo-site/trunk/content/download/test/index_new_dl.html (added)
+++ incubator/ooo/ooo-site/trunk/content/download/test/index_new_dl.html Sat Apr 7 13:57:25 2012
@@ -0,0 +1,31 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+ <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
+ <title>Apache OpenOffice Downloads</title>
+ <script type="text/javascript" src="globalvars_new_dl.js"></script>
+ <script type="text/javascript" src="download_new_dl.js"></script>
+</head>
+
+<body>
+
+<div class="optionset">
+
+ <script type="text/javascript">
+ <!--
+ document.write ( "<h2>This page is to test how to get download requests to more than one mirror hosts:</h2>" );
+ document.write ( "<h3>1. Mirror hosts are: Apache, SourceForge</h3>" );
+
+ getMirrorHost();
+
+ document.write ( "<h3>2. Mirror hosts are: Apache, SourceForge, MirrorBrain</h3>" );
+
+ getMirrorHost_asf_sf_mb();
+
+ //-->
+ </script>
+
+</div>
+
+</body>
+</html>
Propchange: incubator/ooo/ooo-site/trunk/content/download/test/index_new_dl.html
------------------------------------------------------------------------------
svn:eol-style = native