1
0
mirror of https://github.com/danog/MadelineProto.git synced 2024-11-27 04:35:12 +01:00

Avoid race conditions

This commit is contained in:
Daniil Gentili 2021-04-10 12:29:50 +02:00
parent 209c699ef5
commit 12f4e7dbf4
Signed by: danog
GPG Key ID: 8C1BE3B34B230CA7

View File

@ -52,7 +52,7 @@ function ___install_madeline()
$contents = \file_get_contents($file); $contents = \file_get_contents($file);
if (\strpos($contents, 'new \danog\MadelineProto\Server') && \in_array($contents, [@\file_get_contents('https://github.com/danog/MadelineProtoPhar/raw/2270bd9a94d168a5e6731ffd7e61821ea244beff/mtproxyd'), @\file_get_contents('https://github.com/danog/MadelineProtoPhar/raw/7cabb718ec3ccb79e3c8e3d34f5bccbe3f63b0fd/mtproxyd')]) && ($mtproxyd = @\file_get_contents('https://phar.madelineproto.xyz/mtproxyd?v=new'))) { if (\strpos($contents, 'new \danog\MadelineProto\Server') && \in_array($contents, [@\file_get_contents('https://github.com/danog/MadelineProtoPhar/raw/2270bd9a94d168a5e6731ffd7e61821ea244beff/mtproxyd'), @\file_get_contents('https://github.com/danog/MadelineProtoPhar/raw/7cabb718ec3ccb79e3c8e3d34f5bccbe3f63b0fd/mtproxyd')]) && ($mtproxyd = @\file_get_contents('https://phar.madelineproto.xyz/mtproxyd?v=new'))) {
\file_put_contents($file, $mtproxyd); \file_put_contents($file, $mtproxyd, LOCK_EX);
return; return;
} }
@ -121,8 +121,8 @@ function ___install_madeline()
} }
$previous['danog/madelineproto'] = 'old'; $previous['danog/madelineproto'] = 'old';
\file_put_contents($madeline_phar, $phar); \file_put_contents($madeline_phar, $phar, LOCK_EX);
\file_put_contents("$madeline_phar.version", $release); \file_put_contents("$madeline_phar.version", $release, LOCK_EX);
$current = $extractVersions(); $current = $extractVersions();
$postData = ['downloads' => []]; $postData = ['downloads' => []];