aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB/includes/mcp/mcp_reports.php
diff options
context:
space:
mode:
authorMarc Alexander <admin@m-a-styles.de>2020-01-01 17:45:42 +0100
committerMarc Alexander <admin@m-a-styles.de>2020-01-01 17:45:42 +0100
commitb9193f35c1d964e3445d3933d877be3049954411 (patch)
treec58c61fdafd26ae861a20a88312868ddc1d23632 /phpBB/includes/mcp/mcp_reports.php
parent43e5337a0ad83e5146d3e322b4e119b65c4ac766 (diff)
parentcf450bd01fcdb100ffd2f50ef6e2040156edc887 (diff)
downloadforums-b9193f35c1d964e3445d3933d877be3049954411.tar
forums-b9193f35c1d964e3445d3933d877be3049954411.tar.gz
forums-b9193f35c1d964e3445d3933d877be3049954411.tar.bz2
forums-b9193f35c1d964e3445d3933d877be3049954411.tar.xz
forums-b9193f35c1d964e3445d3933d877be3049954411.zip
Merge pull request #5807 from 3D-I/ticket/16273
[ticket/16273] Check whether the index exists in memberlist - PHP 7.4
Diffstat (limited to 'phpBB/includes/mcp/mcp_reports.php')
0 files changed, 0 insertions, 0 deletions
2'>32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74
package install::http; # $Id: http.pm 270205 2010-07-02 12:24:09Z pterjan $

use urpm::download;
use common;
use Cwd;

# to be killed once callers got fixed
sub close() {
}

sub getFile {
    my ($url, %o_options) = @_;
    my ($_size, $fh) = get_file_and_size($url, %o_options) or return;
    $fh;
}

sub parse_http_url {
    my ($url) = @_;
    $url =~ m,^(?:https?|ftp)://(?:[^:/]+:[^:/]+\@)?([^/:@]+)(?::(\d+))?(/\S*)?$,;
}

sub get_file_and_size_ {
    my ($f, $url) = @_;

    if ($f =~ m!^/!) {
	my ($host, $port, $_path) = parse_http_url($url);
	get_file_and_size("http://$host" . ($port ? ":$port" : '') . $f);
    } else {
	get_file_and_size("$url/$f");
    }
}

sub get_file_and_size {
    my ($url, %o_options) = @_;

    # can be used for ftp urls (with http proxy)
    my ($host) = parse_http_url($url);
    defined $host or return undef;

    my $urpm = $::o->{packages};
    if (!$urpm) {
        require install::pkgs;
        $urpm = install::pkgs::empty_packages($::o->{keep_unrequested_dependencies});
    }

    my $cachedir = $urpm->{cachedir} || '/root';
    my $file = $url;
    $file =~ s!.*/!$cachedir/!;
    unlink $file;       # prevent "partial file" errors
    
    if ($ENV{PROXY}) {
        my ($proxy, $port) = urpm::download::parse_http_proxy(join(':', $ENV{PROXY}, $ENV{PROXYPORT}))
          or die "bad proxy declaration\n";
        $proxy .= ":1080" unless $port;
        urpm::download::set_cmdline_proxy(http_proxy => "http://$proxy/");
    }
    
    (my $cwd) = getcwd() =~ /(.*)/;
    my $res = eval { urpm::download::sync_url($urpm, $url, %o_options, dir => $cachedir) };
    #- urpmi does not always reset cwd when dying or failing!
    #- do not stay in /mnt/var/cache/urpmi, it's evil to be in /mnt
    #- FIXME: fix urpmi
    chdir $cwd;

    if ($res) {
        open(my $f, $file);
        (-s $file, $f);
    } else {
        log::l("retrieval of [$file] failed");
        undef;
    }
}

1;