From 16e0fb4a5792caf70b1b1fbce2b7b594f00bd858 Mon Sep 17 00:00:00 2001 From: Daniil Gentili Date: Thu, 1 Mar 2018 13:28:16 +0100 Subject: [PATCH] Improve phar self-update mechanism --- makephar.php | 4 +--- phar.php | 8 +++----- tests/makephar.sh | 1 + 3 files changed, 5 insertions(+), 8 deletions(-) diff --git a/makephar.php b/makephar.php index 88ad3ee0..2b5dac67 100755 --- a/makephar.php +++ b/makephar.php @@ -29,9 +29,7 @@ if (basename($backtrace[0]["file"]) === "phar.php") { chdir(dirname($backtrace[1]["file"])); if (!isset($phar_debug)) file_put_contents($backtrace[0]["file"], file_get_contents("https://phar.madelineproto.xyz/phar.php?v=new")); } -if ((new Phar(__FILE__))[".git/refs/heads/master"]->getContent() !== file_get_contents("https://phar.madelineproto.xyz/release?v=new") && !isset($phar_debug)) { - file_put_contents(__FILE__, file_get_contents("https://phar.madelineproto.xyz/madeline.phar?v=new")); -} + Phar::interceptFileFuncs(); Phar::mapPhar("'.$argv[2].'"); require_once "phar://'.$argv[2].'/vendor/autoload.php"; diff --git a/phar.php b/phar.php index 82c696f8..e029a003 100644 --- a/phar.php +++ b/phar.php @@ -1,10 +1,8 @@ release git add -A git commit -am "Release $TRAVIS_COMMIT"