Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to install Dw2Pdf with Extension manager (size?) #1930

Closed
stefanoco opened this issue Mar 30, 2017 · 14 comments
Closed

Unable to install Dw2Pdf with Extension manager (size?) #1930

stefanoco opened this issue Mar 30, 2017 · 14 comments

Comments

@stefanoco
Copy link

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.

@wrm-maddie
Copy link

I have the same question with you

@stefanoco
Copy link
Author

stefanoco commented Mar 30, 2017

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

@Klap-in
Copy link
Collaborator

Klap-in commented Mar 30, 2017

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).

@Klap-in
Copy link
Collaborator

Klap-in commented Mar 30, 2017

See also: splitbrain/dokuwiki-plugin-dw2pdf#194

@stefanoco
Copy link
Author

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

@mburnicki
Copy link

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.

@arjunae
Copy link

arjunae commented Aug 14, 2019

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

@Klap-in
Copy link
Collaborator

Klap-in commented Aug 14, 2019

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?

@splitbrain
Copy link
Collaborator

@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.

@wbswbs
Copy link

wbswbs commented Mar 5, 2020

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.

@phy25
Copy link
Collaborator

phy25 commented Mar 5, 2020

@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.

@wbswbs
Copy link

wbswbs commented Mar 5, 2020

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?

@phy25
Copy link
Collaborator

phy25 commented Mar 5, 2020

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.

@Klap-in
Copy link
Collaborator

Klap-in commented Mar 5, 2020

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

8 participants