jDownloads Support Forum

jDownloads for Joomla 3.x => jDownloads 3.9 (Support ended) => Bugs => Topic started by: dr236 on 14.12.2020 19:43:07

Title: A couple of suggested patches [fixed in 3.9.8]
Post by: dr236 on 14.12.2020 19:43:07
Hello

I've found I need the following patch (to jd3.9.7.2):

diff --git a/htdocs/administrator/components/com_jdownloads/views/downloads/view.html.php b/htdocs/administrator/components/com_jdownloads/views/downloads/view.html.php
index 87a5a34a..b13d32b5 100644
--- a/htdocs/administrator/components/com_jdownloads/views/downloads/view.html.php
+++ b/htdocs/administrator/components/com_jdownloads/views/downloads/view.html.php
@@ -131,7 +131,7 @@ class jdownloadsViewDownloads extends JViewLegacy
         }
     
         // We need icomoon font
-        $doc->addStyleSheet($this->baseurl.'/media/jui/css/icomoon.css');
+        $doc->addStyleSheet(\JUri::root(true).'/media/jui/css/icomoon.css');
   
         // We don't need toolbar in the modal window.
         if ($this->getLayout() !== 'modal' && $this->getLayout() !== 'modallist') {


for the icomoon css to be loaded from the downloads view in the backend (as baseurl in the backend is under administrator/).

Also, for some reason, my site that uses jdownloads (hosted at gandi.net) seems to be blocked from www.jdownloads.net. Unfortunately, this causes the backend views of eg downloads and categories to block for 60s (ie the default php default_socket_timeout value) due to the call to JDownloadsHelper::existsHelpServerURL in the relevant view methods.

I have patched JDownloadsHelper::existsHelpServerURL as follows to avoid this problem:

diff --git a/htdocs/administrator/components/com_jdownloads/helpers/jdownloads.php b/htdocs/administrator/components/com_jdownloads/helpers/jdownloads.php                                                                           
index cb36e049..6489ccce 100644
--- a/htdocs/administrator/components/com_jdownloads/helpers/jdownloads.php
+++ b/htdocs/administrator/components/com_jdownloads/helpers/jdownloads.php
@@ -2262,8 +2262,15 @@ class JDownloadsHelper

     public static function existsHelpServerURL($help_url)
     {

+        $default_socket_timeout_old = ini_set('default_socket_timeout',1);
+        if ($default_socket_timeout_old === false) {
+            return false;
+        }

         $file_headers = @get_headers($help_url);
+
+        ini_set('default_socket_timeout',$default_socket_timeout_old);

         if (!$file_headers || $file_headers[0] != 'HTTP/1.1 200 OK') {
             return false;


Thanks, David
Title: Re: A couple of suggested patches
Post by: ColinM on 16.12.2020 12:51:53
David,
Thanks for the useful inputHave sent you a PM askig a couple of clarifications
Colin
Title: Re: A couple of suggested patches
Post by: dr236 on 19.04.2021 17:35:21
Are these patches (which I needed for jd3.9.7.2) likely to be incorporated into a future version? I just installed jd3.9.7.3, which doesn't include them, so I had to apply the patches again by hand.

David
Title: Re: A couple of suggested patches
Post by: ColinM on 20.04.2021 18:11:34
David,

The second patch is not required in jD3.7.3  Will advise Arno about the first patchColin
Title: Re: A couple of suggested patches
Post by: dr236 on 21.04.2021 15:39:21
I do still need the second patch, unfortunately.

David
Title: Re: A couple of suggested patches
Post by: ColinM on 21.04.2021 17:24:47
DavidIn 3.9.7.3 the help buttons are  not meant to link to the jD documentation site but only locally.

Are you saying that without the second patch you still get the timeout?
Also for clarification I understand from your 2nd patch that 3.7.2 successfull accesed the jD documentation site.  Is that correct?
Best wishes
Colin
Title: Re: A couple of suggested patches
Post by: dr236 on 26.04.2021 16:14:02
I still get the timeout without the second patch.

As far as I can see (when eg viewing downloads in the backend):

administrator/components/com_jdownloads/views/downloads/view.html.php line 227 calls
JDownloadsHelper::existsHelpServerURL($help_url="https://www.jdownloads.net/index.php?option=com_content&view=article&id=135&tmpl=jdhelp")

but my production server (for some reason) is blocked from www.jdownloads.net, and so the call to get_headers() in existsHelpServerURL() blocks.

My patch means the call to existsHelpServerURL() still fails (so the "help" link just links to a generic help page), but at least it does not block for 60s.

David
Title: Re: A couple of suggested patches
Post by: ColinM on 26.04.2021 23:11:02
Hi
Yes it does look like we need to use something like your patch!  In jd3.9.7.3 I thought that  all thehelp options now related to a an internal page thus avoiding the problem.  But not actually giving the real help as intended :(

We are working on a 3.9.8 release so I hoe we can add in a suitable solution as you describe.
Colin
Title: Re: A couple of suggested patches
Post by: Arno on 18.05.2021 15:54:56
Hi David,
excuse me for the delay. Your help url patch will be of course a part from 3.9.8.  ;)