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