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

URL install is here! :) #7

Merged
merged 15 commits into from
Nov 25, 2017
Merged

URL install is here! :) #7

merged 15 commits into from
Nov 25, 2017

Conversation

cukabeka
Copy link
Member

Endlich Github-Projekte direkt via ZIP-URL installieren.

Viel Spaß beim Addons ausprobieren :)

cukabeka and others added 12 commits October 11, 2017 16:09
TODO
 - Translations
 - maybe update package.yml (needs some PHP Stream Wrapper to be active...)
 - wrap ZIP Install functionaliy in a zip-installer base class!!
 - List available Stream Wrappers (http, ftp ...) right from the beginning.
- new zip_install class that wrapps the install function
turn input value to placeholder
@hirbod
Copy link
Contributor

hirbod commented Oct 21, 2017

Danke für den PR. Ich verstehe nur nicht, wieso du nicht rex_socket dafür genutzt hast? Sockets haben den Vorteil, das diese auf jedem Server funktionieren. file_get_contents() auf externe URLs ist auf vielen Webspaces gesperrt. CURL nicht immer installiert In der Form würde ich das nicht mergen, bitte baue es auf die Redaxo interne Socket-Class um.

@stefan-beyer
Copy link
Contributor

rex_socket behandelt keine HTTP-Redirects (z.B. Status 302 etc.) sehe ich das richtig?

@skerbis
Copy link
Member

skerbis commented Oct 26, 2017

Habe mir den Quellcode nicht angeschaut. Wenn file_get_contents() ein Problem darstellt, warum nicht mit Curl. Curl sollte auf den meisten Systemen zur Verfügung stehen.

// Funktion die file_get_contents mit curl ersetzt
function curl_file_get_contents($url) {
    $curly = curl_init();

    curl_setopt($curly, CURLOPT_HEADER, 0);
    curl_setopt($curly, CURLOPT_RETURNTRANSFER, 1); //Return Data
    curl_setopt($curly, CURLOPT_URL, $url);

    $content = curl_exec($curly);
    curl_close($curly);

    return $content;
}

@hirbod
Copy link
Contributor

hirbod commented Oct 26, 2017

Aus Slack, ungetestet:

$response = $files_socket->doGet();

$redircount = 0;
while ($response->isRedirection() && $redircount < 3) {
    $scanurl = $response->getHeader('location');
    $files_socket = rex_socket::factoryURL($scanurl);
    $response = $files_socket->doGet();
    $redircount++;
}

@cukabeka @stefan-beyer bitte dann auf rex_socket umbauen und den redirect-case 301/302 einfach mittels der einfachen while-schleife abdecken, dann ist der PR top und wird sofort gemerged & released.

@hirbod
Copy link
Contributor

hirbod commented Oct 26, 2017

Wichtiger Hinweis noch von @gharlan
Wobei man dann den Host voran setzen müsste, der ursprungsurl, die man abruft.

Sprich an $scanurl wäre noch ein Host zu hängen, da es bei nem internen 302 z.B. auch nur "/pfad" geben könnte.

So in der Art macht es search_it: (jedoch für Redaxointerne URLs)

if (strpos($scanurl,'//') === false ) {
    $scanurl = rtrim($host, "/") . '/' . ltrim(str_replace(array('../', './'), '', $scanurl), "/");
}

@stefan-beyer
Copy link
Contributor

Ich habe auf rex_socket umgebaut.
Danke für die schnellen Hinweise!

@ghost
Copy link

ghost commented Nov 7, 2017

bitte mergen.

@hirbod
Copy link
Contributor

hirbod commented Nov 7, 2017

mach ich nach meinen tests

@cukabeka
Copy link
Member Author

Ping.. ;)

@hirbod hirbod merged commit eb35d86 into FriendsOfREDAXO:master Nov 25, 2017
@hirbod
Copy link
Contributor

hirbod commented Nov 25, 2017

Thx an alle. Paket muss noch geschnürt und hochgeladen werden

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

Successfully merging this pull request may close these issues.

4 participants