Dokuwiki: Unable to install Dw2Pdf with Extension manager (size?)

Created on 30 Mar 2017  路  14Comments  路  Source: splitbrain/dokuwiki

Installing (or upgrading) the mentioned extension leads to an error while using Extensions Manager after seconds:

"Unable to download the file: https://github.com/splitbrain/dokuwiki-plugin-dw2pdf/tarball/master"

The file containing the extension is actually fairly big (47M) maybe some limitation for Extensions Manager? PHP seems to be correctly configured, I can down/upload files up to 100M on Dokuwiki.

Most helpful comment

Investigating on this on Linux based server (Ubuntu with Apache), leads to understanding that due to the plugin size being rather high compared to other plugins, timeouts may occur (depends on local and Github speed of course). The changes listed below solve for me. Unfortunatly a value hardcoded in sources need to be changed also, any plans for having this configurable in a future release?

(1)

Inside <dokuwiki>/inc/io.php the current value for download timeout:

function io_download($url,$file,$useAttachment=false,$defaultName='',$maxSize=2097152){
    global $conf;
    $http = new DokuHTTPClient();
    $http->max_bodysize = $maxSize;
    $http->timeout = 25; //max. 25 sec
    $http->keep_alive = false; // we do single ops here, no need for keep-alive

must be changed to 60 seconds:

function io_download($url,$file,$useAttachment=false,$defaultName='',$maxSize=2097152){
    global $conf;
    $http = new DokuHTTPClient();
    $http->max_bodysize = $maxSize;
    $http->timeout = 60; //changed to max. 60 sec
    $http->keep_alive = false; // we do single ops here, no need for keep-alive

(2)

inside /etc/php5/apache2/php.ini (location may vary of course) the default of

max_execution_time = 30

should be upgraded to

max_execution_time = 60

All 14 comments

I have the same question with you

Investigating on this on Linux based server (Ubuntu with Apache), leads to understanding that due to the plugin size being rather high compared to other plugins, timeouts may occur (depends on local and Github speed of course). The changes listed below solve for me. Unfortunatly a value hardcoded in sources need to be changed also, any plans for having this configurable in a future release?

(1)

Inside <dokuwiki>/inc/io.php the current value for download timeout:

function io_download($url,$file,$useAttachment=false,$defaultName='',$maxSize=2097152){
    global $conf;
    $http = new DokuHTTPClient();
    $http->max_bodysize = $maxSize;
    $http->timeout = 25; //max. 25 sec
    $http->keep_alive = false; // we do single ops here, no need for keep-alive

must be changed to 60 seconds:

function io_download($url,$file,$useAttachment=false,$defaultName='',$maxSize=2097152){
    global $conf;
    $http = new DokuHTTPClient();
    $http->max_bodysize = $maxSize;
    $http->timeout = 60; //changed to max. 60 sec
    $http->keep_alive = false; // we do single ops here, no need for keep-alive

(2)

inside /etc/php5/apache2/php.ini (location may vary of course) the default of

max_execution_time = 30

should be upgraded to

max_execution_time = 60

Future plan is to reduce the size of the dw2pdf plugin download.
But that requires some thoughts about alternatives for obtaining the fonts (the fonts are the biggest chunk in this download).

Yes I understand. So no plans for having timeout as a configurable item? Shall I close the issue?

I just had a similar problem when I tried to install the "DokuWiki Upgrade Plugin" update from 2017-02-03. Got an error that the file could not be downloaded. However, downloading and then installing it manually worked just fine.

Also, when I open the "Extension Manager" page on a site where the local intranet has a poor internet connection only I often get an error "The plugin repository could not be contacted. Make sure your server is allowed to contact www.dokuwiki.org and check your proxy setting [Retry]". And usually it works when I click (eventually several times) on [Retry].

So I think it would be a good idea to increase the timeout, or even make the timeout a configurable value, as suggested earlier.

Hi,
Just installed dokuwiki and i like it.
But because the environment is a bit special -mips, buildroot uclibc and old libs etc..- i do see little glitches when trying new stuff. And so i just stumbled upon the error msg discussed here.

In short - in the case here on the machine, openssl caused the error, because the installed php release requires strict Certificate checks, which cant be deactivated using fsockpen.
So i tried stream_sock_client and the extension installed without further problems.

    $socket =@fsockopen($server,$port,$errno, $errstr, $this->timeout);
             if (!$socket){
                dbglog("fsockopen failed, trying without peer verification.  $server:$port");
                //OSSL Error:  func(144):reason(134) - test -  fixMe: should ask the user.
                $socket_options = array('ssl' => array('verify_peer' => false, 'allow_self_signed' => true, 'verify_peer_name' => false));
                $stream_context = stream_context_create($socket_options);
                stream_context_set_default($socket_options);
                $socket=stream_socket_client( "$server:$port", $errno, $errstr,30, STREAM_CLIENT_CONNECT , $stream_context);
                if (!$socket){
                    dbglog($errno,$errstr);
                    $this->status = -100;
                    $this->error = "Could not connect to $server:$port\n$errstr ($errno)";
                    return false;
                }
                dbglog("OKI");
            }

Edit: just read the comments and like to state:
Above code was written only for debugging purposes durin a late night session and shouldnt be used in production environments. Just searched further and the specific local installation i have here showed that error because of a misleading php directive "openssl.cafile".

please excuse the noise.
cheers, Marcedo

You did try to install dw2pdf with the extension manager, but that fails?
Next you did the mentioned change, and then it works?
In which file did you apply your change? Is it this file?
https://codesearch.dokuwiki.org/xref/dokuwiki/inc/HTTPClient.php#269

Is it in general acceptable (security-wise) to disable verify_peer?
https://www.php.net/manual/en/context.ssl.php
Or is this something that is only acceptable after specific configuration by the wiki administrator?

@arjunae's post seems not to be related to the initial ticket at all. Probably all downloads via HTTPS failed for him. The solution to disable peer verification is indeed a bad idea and I advise strongly against it.

Since the initial question seems to be solved (we removed the download limit when installing extensions), I'm closing this.

Had this error on 5/3/2020.

Updated the above mentioned variable

$http->timeout = 25

to 60 in /inc/io.php

But still that error ( A bit later, seemed to be 60 seconds)

Download der Datei: https://github.com/splitbrain/dokuwiki-plugin-dw2pdf/tarball/master nicht m枚glich.

@wbswbs Do you have shell access to your server? If yes you can try wget https://github.com/splitbrain/dokuwiki-plugin-dw2pdf/tarball/master or curl equivalent and see how long it takes.

45,30M 303KB/s in 3m 6s

Would be nice, if I wouldn't have to download the fonts again, if I have em already.
Any possibilities for incrementel updates for plugins?

Well this is more of an issue on Dw2Pdf to see if it can download them after installation, you may want to create one there.

Well since there is no central storage of plugin downloads, it would be very tricky to implement the incremental download. Eventually the plugin authors have to create those patches between versions. Not sure if this is worthwhile.

The Dw2pdf plugin uses the mPDF library. This library is busy with splitting the fonts and the library. If this is all in place, it can be incorporated in the dw2pdf plugin as well.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

KristjanESPERANTO picture KristjanESPERANTO  路  3Comments

swiehr picture swiehr  路  4Comments

splitbrain picture splitbrain  路  4Comments

yasuhirokimura picture yasuhirokimura  路  5Comments

Michaelsy picture Michaelsy  路  4Comments