mirror of
https://github.com/danog/MadelineProtoPhar.git
synced 2024-11-27 00:34:44 +01:00
Revert "Release HEAD - Update diff script"
This reverts commit f6cb3ae379
.
This commit is contained in:
parent
f6cb3ae379
commit
8e1edd081c
41
phar.php
41
phar.php
@ -1,4 +1,4 @@
|
||||
<?php declare(strict_types=1);
|
||||
<?php
|
||||
|
||||
namespace danog\MadelineProto;
|
||||
|
||||
@ -40,7 +40,7 @@ class Installer
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
if ((PHP_MAJOR_VERSION === 8 && PHP_MINOR_VERSION < 1) || PHP_MAJOR_VERSION <= 7) {
|
||||
if (PHP_MAJOR_VERSION < 8 || PHP_MINOR_VERSION < 1) {
|
||||
die('MadelineProto requires at least PHP 8.1.'.PHP_EOL);
|
||||
}
|
||||
if (PHP_INT_SIZE < 8) {
|
||||
@ -83,11 +83,11 @@ class Installer
|
||||
/**
|
||||
* Extract composer package versions from phar.
|
||||
*
|
||||
* @param string|null $release
|
||||
* @return array<string, string>
|
||||
*/
|
||||
private static function extractVersions(?string $release): array
|
||||
private static function extractVersions($release)
|
||||
{
|
||||
$release ??= '';
|
||||
$phar = "madeline-$release.phar";
|
||||
$packages = ['danog/madelineproto' => 'old'];
|
||||
if (!\file_exists("phar://$phar/vendor/composer/installed.json")) {
|
||||
@ -111,10 +111,16 @@ class Installer
|
||||
return $packages;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Report installs to composer.
|
||||
*
|
||||
* @param string $local_release
|
||||
* @param string $remote_release
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
private static function reportComposer(?string $local_release, ?string $remote_release): void
|
||||
private static function reportComposer($local_release, $remote_release)
|
||||
{
|
||||
$previous = self::extractVersions($local_release);
|
||||
$current = self::extractVersions($remote_release);
|
||||
@ -129,7 +135,11 @@ class Installer
|
||||
];
|
||||
}
|
||||
|
||||
$phpVersion = 'PHP '.PHP_MAJOR_VERSION.'.'.PHP_MINOR_VERSION.'.'.PHP_RELEASE_VERSION;
|
||||
if (\defined('HHVM_VERSION')) {
|
||||
$phpVersion = 'HHVM '.HHVM_VERSION;
|
||||
} else {
|
||||
$phpVersion = 'PHP '.PHP_MAJOR_VERSION.'.'.PHP_MINOR_VERSION.'.'.PHP_RELEASE_VERSION;
|
||||
}
|
||||
$opts = ['http' =>
|
||||
[
|
||||
'method' => 'POST',
|
||||
@ -154,13 +164,13 @@ class Installer
|
||||
|
||||
/**
|
||||
* Load phar file.
|
||||
*
|
||||
* @param string|null $release
|
||||
* @return mixed
|
||||
*/
|
||||
private static function load(?string $release): mixed
|
||||
private static function load($release)
|
||||
{
|
||||
if ($release === null) {
|
||||
if ((PHP_MAJOR_VERSION === 8 && PHP_MINOR_VERSION < 1) || PHP_MAJOR_VERSION <= 7) {
|
||||
throw new \Exception('MadelineProto requires at least PHP 8.1.');
|
||||
}
|
||||
throw new \Exception('Could not download MadelineProto, please check your internet connection and PHP configuration!');
|
||||
}
|
||||
$phar = "madeline-$release.phar";
|
||||
@ -178,16 +188,21 @@ class Installer
|
||||
/**
|
||||
* Unlock phar.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public static function unlock(): void
|
||||
public static function unlock()
|
||||
{
|
||||
\flock(self::$lock, LOCK_UN);
|
||||
}
|
||||
|
||||
/**
|
||||
* Lock installer.
|
||||
*
|
||||
* @param string $version Version file to lock
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
private function lock(string $version): bool
|
||||
private function lock($version)
|
||||
{
|
||||
if ($this->lockInstaller) {
|
||||
return true;
|
||||
@ -198,6 +213,8 @@ class Installer
|
||||
|
||||
/**
|
||||
* Install MadelineProto.
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public function install()
|
||||
{
|
||||
|
@ -1 +1 @@
|
||||
32cf35e179916a63e1cafb45b899584712f00201-71
|
||||
37fdcd57a3e8676f58e327f28acb39b4a127229b-71
|
@ -1 +1 @@
|
||||
32cf35e179916a63e1cafb45b899584712f00201-72
|
||||
37fdcd57a3e8676f58e327f28acb39b4a127229b-72
|
@ -1 +1 @@
|
||||
32cf35e179916a63e1cafb45b899584712f00201-73
|
||||
37fdcd57a3e8676f58e327f28acb39b4a127229b-73
|
@ -1 +1 @@
|
||||
32cf35e179916a63e1cafb45b899584712f00201-74
|
||||
37fdcd57a3e8676f58e327f28acb39b4a127229b-74
|
@ -1 +1 @@
|
||||
32cf35e179916a63e1cafb45b899584712f00201-80
|
||||
37fdcd57a3e8676f58e327f28acb39b4a127229b-80
|
Loading…
Reference in New Issue
Block a user