Release old - old phar fixes

This commit is contained in:
Travis CI User 2019-06-17 10:53:55 +00:00
parent 15f553b7a9
commit 5be505a916
2 changed files with 22 additions and 38 deletions

Binary file not shown.

View File

@ -1,36 +1,27 @@
<?php
if (PHP_MAJOR_VERSION === 5) {
if (PHP_MINOR_VERSION < 6) {
throw new \Exception('MadelineProto requires at least PHP 5.6 to run');
}
$newline = PHP_EOL;
if (php_sapi_name() !== 'cli') $newline = '<br>'.$newline;
echo "**********************************************************************$newline";
echo "**********************************************************************$newline$newline";
echo "YOU ARE USING AN OLD AND BUGGED VERSION OF PHP, PLEASE UPDATE TO PHP 7$newline";
echo "PHP 5 USERS WILL NOT RECEIVE MADELINEPROTO UPDATES AND BUGFIXES$newline$newline";
echo "SUPPORTED VERSIONS: PHP 7.0, 7.1, 7.2, 7.3+$newline";
echo "RECOMMENDED VERSION: PHP 7.3$newline$newline";
echo "**********************************************************************$newline";
echo "**********************************************************************$newline";
unset($newline);
}
function ___install_madeline()
{
if (count(debug_backtrace(0)) === 1) {
die('You must include this file in another PHP script'.PHP_EOL);
}
$old = false;
if (PHP_MAJOR_VERSION === 5) {
if (PHP_MINOR_VERSION < 6) {
throw new \Exception('MadelineProto requires at least PHP 7.1 to run');
}
$old = true;
}
if (PHP_MAJOR_VERSION === 7 && PHP_MINOR_VERSION === 0) {
$old = true;
}
if ($old) {
$newline = PHP_EOL;
if (php_sapi_name() !== 'cli') {
$newline = '<br>'.$newline;
}
echo "**********************************************************************************$newline";
echo "**********************************************************************************$newline$newline";
echo "YOU ARE USING AN OLD AND BUGGED VERSION OF PHP, PLEASE UPDATE TO PHP 7.3$newline";
echo "PHP 5/7.0 USERS WILL NOT RECEIVE PHP UPDATES AND BUGFIXES: https://www.php.net/eol.php$newline";
echo "PHP 5/7.0 USERS WILL NOT RECEIVE MADELINEPROTO UPDATES AND BUGFIXES$newline$newline";
echo "SUPPORTED VERSIONS: PHP 7.1, 7.2, 7.3+$newline";
echo "RECOMMENDED VERSION: PHP 7.3$newline$newline";
echo "**********************************************************************************$newline";
echo "**********************************************************************************$newline";
unset($newline);
}
// MTProxy update
$file = debug_backtrace(0, 1)[0]['file'];
@ -48,26 +39,19 @@ function ___install_madeline()
$release_template = 'https://phar.madelineproto.xyz/release%s?v=new';
$phar_template = 'https://phar.madelineproto.xyz/madeline%s.phar?v=new';
// Version definition
$release_branch = defined('MADELINE_BRANCH') ? '-'.MADELINE_BRANCH : '-old';
if ($release_branch === '-') {
$release_branch = '';
}
$release_default_branch = '';
$release_default = '';
if (PHP_MAJOR_VERSION <= 5) {
if (PHP_MAJOR_VERSION === 5) {
$release_branch = '5'.$release_branch;
$release_default_branch = '5';
} elseif (PHP_MINOR_VERSION >= 3) {
$release_branch = '';
$release_default = '5';
}
// Checking if defined branch/default branch builds can be downloaded
if (!($release = @file_get_contents(sprintf($release_template, $release_branch)))) {
if (!($release = @file_get_contents(sprintf($release_template, $release_default_branch)))) {
if (!($release = @file_get_contents(sprintf($release_template, $release_default)))) {
return;
}
$release_branch = $release_default_branch;
$release_branch = $release_default;
}
if (!file_exists('madeline.phar') || !file_exists('madeline.phar.version') || file_get_contents('madeline.phar.version') !== $release) {