Alexandre Julliard : Move the download scripts to the git repository.
Alexandre Julliard
julliard at wine.codeweavers.com
Wed Sep 12 07:27:26 CDT 2007
Module: tools
Branch: master
Commit: 9d8f29d984f0e85e00f0cdbccea4a311ef41c3ba
URL: http://source.winehq.org/git/tools.git/?a=commit;h=9d8f29d984f0e85e00f0cdbccea4a311ef41c3ba
Author: Alexandre Julliard <julliard at winehq.org>
Date: Wed Sep 12 14:22:32 2007 +0200
Move the download scripts to the git repository.
---
download.inc.php | 89 ++++++++++++++++++++++++++++++++++++++++++++++++++++++
mono.php | 27 ++++++++++++++++
mozactivex.php | 27 ++++++++++++++++
winegecko.php | 37 ++++++++++++++++++++++
4 files changed, 180 insertions(+), 0 deletions(-)
diff --git a/download.inc.php b/download.inc.php
new file mode 100644
index 0000000..d0a8ef4
--- /dev/null
+++ b/download.inc.php
@@ -0,0 +1,89 @@
+<?php
+/**
+ * Common code for Wine downloader scripts.
+ *
+ * Copyright (c) 2006 Jonathan Ernst
+ */
+
+// List of common locations for files
+$aList += array("http://switch.dl.sourceforge.net/sourceforge/wine/",
+ "http://surfnet.dl.sourceforge.net/sourceforge/wine/",
+ "http://citkit.dl.sourceforge.net/sourceforge/wine/",
+ "http://keihanna.dl.sourceforge.net/sourceforge/wine/",
+ "http://heanet.dl.sourceforge.net/sourceforge/wine/",
+ "http://easynews.dl.sourceforge.net/sourceforge/wine/",
+ "http://ovh.dl.sourceforge.net/sourceforge/wine/",
+ "http://jaist.dl.sourceforge.net/sourceforge/wine/",
+ "http://puzzle.dl.sourceforge.net/sourceforge/wine/",
+ "http://nchc.dl.sourceforge.net/sourceforge/wine/",
+ "http://switch.dl.sourceforge.net/sourceforge/wine/",
+ "http://kent.dl.sourceforge.net/sourceforge/wine/",
+ "http://optusnet.dl.sourceforge.net/sourceforge/wine/",
+ "http://mesh.dl.sourceforge.net/sourceforge/wine/",
+ "http://internap.dl.sourceforge.net/sourceforge/wine/",
+ "http://superb-east.dl.sourceforge.net/sourceforge/wine/",
+ "http://optusnet.dl.sourceforge.net/sourceforge/wine/",
+ "http://superb-west.dl.sourceforge.net/sourceforge/wine/",
+ "http://nchc.dl.sourceforge.net/sourceforge/wine/",
+ "http://umn.dl.sourceforge.net/sourceforge/wine/",
+ "http://belnet.dl.sourceforge.net/sourceforge/wine/",
+ "http://ufpr.dl.sourceforge.net/sourceforge/wine/"
+ );
+
+
+function is_downloadable($sUrl)
+{
+ global $iFileSize;
+ $parse = parse_url($sUrl);
+ // open a socket connection
+ if($fp = @fsockopen($parse['host'], 80, $errno, $errstr, 10))
+ {
+ // set request
+ $get = "HEAD ".$parse['path']." HTTP/1.1\r\n".
+ "Host: ".$parse['host']."\r\n".
+ "Connection: close\r\n\r\n";
+ fputs($fp, $get);
+ while(!feof($fp))
+ {
+ // get ONLY header informations
+ $header .= fgets($fp, 128);
+ }
+ fclose($fp);
+ // match file size
+ preg_match('/Content-Length:\s([0-9].+?)\s/', $header, $matches);
+ $iSize = intval($matches[1]);
+ if($iSize == $iFileSize) return TRUE;
+ }
+ return FALSE;
+}
+
+
+if($_REQUEST['action']=="showlist")
+{
+ echo "<h2>List of mirrors available for file ".$sFileName." (".$iFileSize." bytes)</h2>";
+ foreach($aList as $sLocation)
+ {
+ echo $sLocation.": ";
+ if(is_downloadable($sLocation.$sFileName))
+ echo "<font color=\"green\">online</font>";
+ else
+ echo "<font color=\"red\">offline</font>";
+ echo "\n<br />";
+ flush();
+ }
+} else
+{
+ $iRand = rand(0, (sizeof($aList)-1));
+ $sUrl = $aList[$iRand].$sFileName;
+ // we continue as long as we didn't find a working mirror and we didn't tried all the mirrors
+ while(!is_downloadable($sUrl) && sizeof($aAlreadyTried)<sizeof($aList))
+ {
+ $aAlreadyTried[$iRand] = true;
+ // we loop until we take a random mirror that we didn't already tried ; of course if we have already tried all mirrors we stop
+ while($aAlreadyTried[$iRand] == true && sizeof($aAlreadyTried)<sizeof($aList))
+ $iRand = rand(0, (sizeof($aList)-1));
+ $sUrl = $aList[$iRand].$sFileName;
+ }
+ header("Location: ".$sUrl);
+}
+?>
diff --git a/mono.php b/mono.php
new file mode 100644
index 0000000..fbd6080
--- /dev/null
+++ b/mono.php
@@ -0,0 +1,27 @@
+<?php
+/**
+ * Redirects to one of many URLs that have the Mono Windows installer available.
+ *
+ * Usage:
+ * mono.php
+ * (main usage, redirects to one of many URLs that have the Mono Windows installer available)
+ *
+ * mono.php?action=showlist
+ * (display a list of server and tells if the file is available for each server)
+ *
+ * Copyright (c) 2006 Jonathan Ernst
+ */
+
+
+// Name of the file
+$sFileName = "mono-1.2.1-gtksharp-2.8.3-win32-1.exe";
+
+// Exact size of the file:
+$iFileSize = 46430421;
+
+// List of additional locations (commonly used locations are already in download.inc.php)
+$aList = array("ftp://www.go-mono.com/archive/1.2.1/windows-installer/1/");
+
+// Common code for Wine downloader scripts
+require("download.inc.php");
+?>
diff --git a/mozactivex.php b/mozactivex.php
new file mode 100644
index 0000000..96da243
--- /dev/null
+++ b/mozactivex.php
@@ -0,0 +1,27 @@
+<?php
+/**
+ * Redirects to one of many URLs that have the MozillaActiveX control available.
+ *
+ * Usage:
+ * mozactivex.php
+ * (main usage, redirects to one of many URLs that have the MozillaActiveX control available)
+ *
+ * mozactivex.php?action=showlist
+ * (display a list of server and tells if the file is available for each server)
+ *
+ * Copyright (c) 2005-2006 Jonathan Ernst
+ */
+
+
+// Name of the file
+$sFileName = "MozillaControl1712-ReactOS.exe";
+
+// Exact size of the file:
+$iFileSize = 4735160;
+
+// List of additional locations (commonly used locations are already in download.inc.php)
+$aList = array();
+
+// Common code for Wine downloader scripts
+require("download.inc.php");
+?>
diff --git a/winegecko.php b/winegecko.php
new file mode 100644
index 0000000..199e568
--- /dev/null
+++ b/winegecko.php
@@ -0,0 +1,37 @@
+<?php
+/**
+ * Redirects to one of many URLs that have the Wine Gecko installer available.
+ *
+ * Usage:
+ * winegecko.php
+ * (main usage, redirects to one of many URLs that have the Wine Gecko installer available)
+ *
+ * winegecko.php?action=showlist
+ * (display a list of server and tells if the file is available for each server)
+ *
+ * Copyright (c) 2006 Jonathan Ernst
+ */
+
+// Chek if a specific version was passed
+if(isset($_GET['v']))
+ $sVersion = $_GET['v'];
+
+// Name of the file
+$sFileName = "wine_gecko".($sVersion?'-'.$sVersion:'').".cab";
+
+// Size array
+$aFileSizes = array(
+ 'default'=>5219822,
+ '0.0.1'=>5219822,
+ '0.1.0'=>5746895
+);
+
+// Exact size of the file:
+$iFileSize = ($sVersion?$aFileSizes[$sVersion]:$aFileSizes['default']);
+
+// List of additional locations (commonly used locations are already in download.inc.php)
+$aList = array();
+
+// Common code for Wine downloader scripts
+require("download.inc.php");
+?>
More information about the wine-cvs
mailing list