Mandi! Rainer Meier In chel di` si favelave... > Thanks for your analysis.
I'm proud to contribute to WPKG! ;-) > I will have a look at the issues. Unfortunately the > download feature is not very widely used and therefore I fully believe that > there are some bugs with it. As many things, only when used get broken and fixed. ;-) > I personally rather think about extending the download feature slightly > instead > of providing a switch to disable downloads globally but keeping them in > package XML. > - WPKG might support a flag in a download tag to disable removal after > installation. > - WPKG might by default not re-download files which already exist on download > target. Ok. a doubt on the first one, see later. > (- WPKG might verify MD5/checksum of downloaded file to check whether download > was successful; requires some more effort) I remember vaguely that (w|c)script have no hash function implementation internally, so it is need to use an external program or a pure script hash implementation (that probably get sloooooowwww....). But consider that implementing a 'check if just download' function without hash can be really dangerous... and hash check are generally useful, not only on download. Anyway, because was easy and i need that, i've implemented the master switch. Patch attached. It is my first wsh exercise, and really i've not understood if isNoDownload() function are needed or not. Not to master my dumb work, but i think that a master switch is still useful. On sites where i propagate updates by the way of other mean, i know that there's no need for download... so it make little sense to do checks. Generally speaking, download/nodownload for me are a ''site switch'', not a package switch; so disable or enable checks as a package level can be useful in theory, but i think in practice the decision to download (and check) are taken at ''site'' level (eg, config.xml or wpkg.js switch). > For sure the exit code shall be dependent on the install state, not on > download > state. I will verify it too. Many thanks! -- dott. Marco Gaiarin GNUPG Key ID: 240A3D66 Associazione ``La Nostra Famiglia'' http://www.sv.lnf.it/ Polo FVG - Via della Bontà , 7 - 33078 - San Vito al Tagliamento (PN) marco.gaiarin(at)sv.lnf.it tel +39-0434-842711 fax +39-0434-842797 Dona il 5 PER MILLE a LA NOSTRA FAMIGLIA! http://www.lanostrafamiglia.it/chi_siamo/5xmille.php (cf 00307430132, categoria ONLUS oppure RICERCA SANITARIA)
--- wpkg.js.orig 2009-10-02 17:55:27.000000000 +0200 +++ wpkg.js 2011-05-16 12:11:08.663912632 +0200 @@ -316,6 +316,9 @@ /** timeout for downloads */ var downloadTimeout = 7200; +/** global switch for download */ +var noDownload = false + /** if set to true logfiles will be appended, otherwise they are overwritten */ var logAppend = false; @@ -1253,7 +1256,11 @@ var fso = new ActiveXObject("Scripting.FileSystemObject"); // delete temporary file if it already exists if (fso.fileExists(target)) { - fso.deleteFile(target); + if (isNoDownload()) { + dinfo("Cleaning up '" + target + "' disabled by config option"); + } else { + fso.deleteFile(target); + } } } @@ -3701,6 +3708,15 @@ } /** + * Return current value of noDownload setting + * + * @return true in case download are disabled, false if it is enabled (boolean). + */ +function isNoDownload() { + return noDownload; +} + +/** * Checks if a package is a zombie package which means that it exists within * the locale package database (wpkg.xml) but not on server database * (packages.xml) @@ -6018,12 +6034,17 @@ if (timeoutValue != null && timeoutValue == "") { timeout = parseInt(timeoutValue); } + + if (isNoDownload()) { + dinfo("Downloading '" + url + "' to '" + target + "' disabled by config option"); + return true; + } else { + dinfo("Downloading '" + url + "' to '" + target + "'"); + } var fso = new ActiveXObject("Scripting.FileSystemObject"); var stream = new ActiveXObject("ADODB.Stream"); var xmlHttp = new createXmlHttp(); - dinfo("Downloading '" + url + "' to '" + target + "'"); - // open HTTP connection xmlHttp.open("GET", url, true); xmlHttp.setRequestHeader("User-Agent", "XMLHTTP/1.0");
------------------------------------------------------------------------- wpkg-users mailing list archives >> http://lists.wpkg.org/pipermail/wpkg-users/ _______________________________________________ wpkg-users mailing list wpkg-users@lists.wpkg.org http://lists.wpkg.org/mailman/listinfo/wpkg-users