PHP 7.4 fixes

This commit is contained in:
Daniil Gentili 2019-12-25 19:38:44 +01:00
parent 0eadfe2131
commit 172d708e0e
Signed by: danog
GPG Key ID: 8C1BE3B34B230CA7
2 changed files with 16 additions and 15 deletions

View File

@ -50,20 +50,24 @@ cd ..
sudo add-apt-repository ppa:ondrej/php -y
sudo apt-get update -q
sudo apt-get install php7.3-cli php7.3-json php7.3-mbstring php7.3-curl php7.3-xml php7.3-json -y
composer global require spatie/7to5 dev-master#d4be6d0
[ -f $HOME/.composer/vendor/bin/php7to5 ] && php7to5=$HOME/.composer/vendor/bin/php7to5
[ -f $HOME/.config/composer/vendor/bin/php7to5 ] && php7to5=$HOME/.config/composer/vendor/bin/php7to5
php7.3 $php7to5 convert --copy-all phar7 phar5 >/dev/null
sed 's/^Loop::set.*;//g' -i phar5/vendor/amphp/amp/lib/Loop.php
echo 'Loop::set((new DriverFactory())->create());' >> phar5/vendor/amphp/amp/lib/Loop.php
cp $madelinePath/tests/random.php phar5/vendor/paragonie/random_compat/lib/random.php
cp phar5/vendor/danog/madelineproto/src/danog/MadelineProto/Coroutine.php phar5/vendor/amphp/amp/lib/Coroutine.php
sed 's/namespace danog\\MadelineProto;/namespace Amp;/g' -i phar5/vendor/amphp/amp/lib/Coroutine.php
sed 's/public static function echo/public static function echo_/g' -i phar5/vendor/danog/madelineproto/src/danog/MadelineProto/Tools.php
find phar5/vendor/amphp -type f -name '*.php' -exec sed "s/extension_loaded[(]'zlib'[)]/false/g" -i {} +
find phar5/vendor/danog/madelineproto -type f -name '*.php' -exec sed 's/: EncryptableSocket/: \\Amp\\Socket\\Socket/g' -i {}
php -v
php=5
@ -73,9 +77,10 @@ cd ..
composer global require danog/7to70
[ -f $HOME/.composer/vendor/bin/php7to70 ] && php7to70=$HOME/.composer/vendor/bin/php7to70
[ -f $HOME/.config/composer/vendor/bin/php7to70 ] && php7to70=$HOME/.config/composer/vendor/bin/php7to70
$php7to70 convert --copy-all phar7 phar5 >/dev/null
find phar5/vendor/danog/madelineproto -type f -name '*.php' -exec sed 's/: EncryptableSocket/: \\Amp\\Socket\\Socket/g' -i {}
php=70
} || {
cp -a phar7 phar5
@ -146,9 +151,9 @@ echo "$TRAVIS_COMMIT_MESSAGE" | grep "Apply fixes from StyleCI" && exit
[ -d JSON.sh ] || git clone https://github.com/dominictarr/JSON.sh
for chat_id in $destinations;do
ID=$(curl -s https://api.telegram.org/bot$BOT_TOKEN/sendMessage -F disable_web_page_preview=1 -F text=" <b>Recent Commits to MadelineProto:$TRAVIS_BRANCH</b>
<a href=\"https://github.com/danog/MadelineProto/commit/$TRAVIS_COMMIT\">$TRAVIS_COMMIT_MESSAGE (PHP $PHP_MAJOR_VERSION.$PHP_MINOR_VERSION)</a>
$TRAVIS_COMMIT_MESSAGE" -F parse_mode="HTML" -F chat_id=$chat_id | JSON.sh/JSON.sh -s | egrep '\["result","message_id"\]' | cut -f 2 | cut -d '"' -f 2)
ID=$(curl -s https://api.telegram.org/bot$BOT_TOKEN/sendMessage -F disable_web_page_preview=1 -F text=" <b>Recent Commits to MadelineProto:$TRAVIS_BRANCH</b>
<a href=\"https://github.com/danog/MadelineProto/commit/$TRAVIS_COMMIT\">$TRAVIS_COMMIT_MESSAGE (PHP $PHP_MAJOR_VERSION.$PHP_MINOR_VERSION)</a>
$TRAVIS_COMMIT_MESSAGE" -F parse_mode="HTML" -F chat_id=$chat_id | JSON.sh/JSON.sh -s | egrep '\["result","message_id"\]' | cut -f 2 | cut -d '"' -f 2)
done

View File

@ -61,15 +61,11 @@ function ___install_madeline()
$release_branch = '';
}
$release_fallback_branch = '';
/*if (isset($_SERVER['SERVER_ADMIN']) && strpos($_SERVER['SERVER_ADMIN'], '000webhost.io') && $custom_branch === null) {
$release_branch = '-deprecated';
$release_fallback_branch = '-deprecated';
}*/
if (PHP_MAJOR_VERSION <= 5) {
$release_branch = '5'.$release_branch;
$release_fallback_branch = '5'.$release_fallback_branch;
} elseif (PHP_MAJOR_VERSION === 7 && PHP_MINOR_VERSION === 0) {
} elseif (PHP_MAJOR_VERSION === 7 && PHP_MINOR_VERSION < 4) {
$release_branch = '70'.$release_branch;
$release_fallback_branch = '70'.$release_fallback_branch;
}