MadelineProto/phar.php

25 lines
1.3 KiB
PHP
Raw Normal View History

<?php
2018-05-09 18:16:35 +02:00
if (!file_exists('madeline.phar') || !file_exists('madeline.phar.version') || (file_get_contents('madeline.phar.version') !== file_get_contents('https://phar.madelineproto.xyz/release?v=new') && file_get_contents('https://phar.madelineproto.xyz/release?v=new'))) {
$release = file_get_contents('https://phar.madelineproto.xyz/release?v=new');
$phar = file_get_contents('https://phar.madelineproto.xyz/madeline.phar?v=new');
if ($release && $phar) {
file_put_contents('madeline.phar', $phar);
file_put_contents('madeline.phar.version', $release);
}
unset($release);
unset($phar);
}
$file = debug_backtrace(0, 1)[0]['file'];
2018-07-19 12:04:17 +02:00
if (file_exists($file)) {
$contents = file_get_contents($file);
2018-07-19 12:04:17 +02:00
// Should've added the self-update code in mtproxyd right away, but it's too late now
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);
unset($mtproxyd);
}
}
2018-03-01 13:28:16 +01:00
require 'madeline.phar';