mirror of
https://github.com/danog/MadelineProto.git
synced 2024-11-30 06:18:58 +01:00
Update phpseclib, fix composer.json, PHP 5 fixes, update travis CI script.
This commit is contained in:
parent
cc635bcb27
commit
f3dbc898b7
4
.gitignore
vendored
4
.gitignore
vendored
@ -105,6 +105,6 @@ tests/500mb
|
||||
*.save
|
||||
*.save.1
|
||||
*.save.*
|
||||
composer
|
||||
phar
|
||||
phar7
|
||||
phar5
|
||||
madeline.phar
|
||||
|
@ -12,7 +12,7 @@
|
||||
"php": ">=5.6.0",
|
||||
"danog/primemodule": "dev-master",
|
||||
"danog/magicalserializer": "dev-master",
|
||||
"phpseclib/phpseclib": "dev-master#0d9dc46",
|
||||
"phpseclib/phpseclib": "dev-master#27370df",
|
||||
"vlucas/phpdotenv": "^2.4",
|
||||
"erusev/parsedown": "^1.6",
|
||||
"rollbar/rollbar": "dev-master",
|
||||
@ -21,12 +21,11 @@
|
||||
"ext-xml": "*"
|
||||
},
|
||||
"require-dev": {
|
||||
"spatie/7to5": "^1.2",
|
||||
"phpdocumentor/reflection-docblock": "^3.1"
|
||||
},
|
||||
"suggest": {
|
||||
"ext-libtgvoip": "Install the php-libtgvoip extension to make phone calls (https:/github.com/danog/php-libtgvoip)",
|
||||
"ext-socket": "Install the socket extension to speed up MadelineProto"
|
||||
"ext-sockets": "Install the socket extension to speed up MadelineProto"
|
||||
},
|
||||
"authors": [
|
||||
{
|
||||
|
62
makephar.php
62
makephar.php
@ -11,61 +11,15 @@ You should have received a copy of the GNU General Public License along with Mad
|
||||
If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
require 'vendor/autoload.php';
|
||||
use Spatie\Php7to5\DirectoryConverter;
|
||||
|
||||
if (!isset($argv[1])) {
|
||||
die('This script requires a parameter with the commit number to turn into a phar');
|
||||
if (!isset($argv[3])) {
|
||||
echo('Usage: '.$argv[0].' inputDir output.phar ref'.PHP_EOL);
|
||||
die(1);
|
||||
}
|
||||
|
||||
function rimraf($dir)
|
||||
{
|
||||
if (is_dir($dir)) {
|
||||
$objects = scandir($dir);
|
||||
foreach ($objects as $object) {
|
||||
if ($object != '.' && $object != '..') {
|
||||
if (is_dir($dir.'/'.$object)) {
|
||||
rimraf($dir.'/'.$object);
|
||||
} else {
|
||||
unlink($dir.'/'.$object);
|
||||
}
|
||||
}
|
||||
}
|
||||
rmdir($dir);
|
||||
}
|
||||
}
|
||||
@unlink($argv[2]);
|
||||
|
||||
@unlink('madeline.phar');
|
||||
rimraf('phar');
|
||||
rimraf('composer');
|
||||
mkdir('phar');
|
||||
mkdir('composer');
|
||||
chdir('composer');
|
||||
file_put_contents('composer.json', '{
|
||||
"name": "danog/madelineprototests",
|
||||
"minimum-stability":"dev",
|
||||
"require": {
|
||||
"danog/madelineproto": "dev-master#'.$argv[1].'"
|
||||
},
|
||||
"repositories": [
|
||||
{
|
||||
"type": "git",
|
||||
"url": "https://github.com/danog/phpseclib"
|
||||
}
|
||||
],
|
||||
"authors": [
|
||||
{
|
||||
"name": "Daniil Gentili",
|
||||
"email": "daniil@daniil.it"
|
||||
}
|
||||
]
|
||||
}');
|
||||
shell_exec('composer update');
|
||||
$p = new Phar(__DIR__.'/'.$argv[2], 0, $argv[2]);
|
||||
$p->buildFromDirectory(realpath($argv[1]), '/^((?!tests).)*(\.php|\.py|\.tl|\.json)$/i');
|
||||
$p->addFromString('.git/refs/heads/master', $argv[3]);
|
||||
|
||||
(new DirectoryConverter(__DIR__.'/composer', ['.php']))->alsoCopyNonPhpFiles()->savePhp5FilesTo(__DIR__.'/phar');
|
||||
|
||||
$p = new Phar(__DIR__.'/madeline.phar', 0, 'madeline.phar');
|
||||
$p->buildFromDirectory(__DIR__.'/phar', '/^((?!tests).)*(\.php|\.py|\.tl|\.json)$/i');
|
||||
$p->addFromString('.git/refs/heads/master', file_get_contents(__DIR__.'/.git/refs/heads/master'));
|
||||
|
||||
$p->setStub('<?php Phar::interceptFileFuncs(); Phar::mapPhar("madeline.phar"); require_once "phar://madeline.phar/vendor/autoload.php"; __HALT_COMPILER(); ?>');
|
||||
$p->setStub('<?php Phar::interceptFileFuncs(); Phar::mapPhar("'.$argv[2].'"); require_once "phar://'.$argv[2].'/vendor/autoload.php"; __HALT_COMPILER(); ?>');
|
||||
|
@ -3,7 +3,7 @@
|
||||
namespace phpseclib\Math;
|
||||
|
||||
if (PHP_MAJOR_VERSION < 7 && !(class_exists('\Phar') && \Phar::running())) {
|
||||
throw new Exception('MadelineProto requires php 7 to run');
|
||||
throw new \Exception('MadelineProto requires php 7 to run');
|
||||
}
|
||||
|
||||
class BigIntegor
|
||||
|
@ -535,7 +535,8 @@ trait PeerHandler
|
||||
|
||||
public function store_db($res, $force = false)
|
||||
{
|
||||
if (!isset($this->settings['pwr']) || $this->settings['pwr']['pwr'] === false || (isset($this->settings['connection_settings'][$this->datacenter->curdc]) ? $this->settings['connection_settings'][$this->datacenter->curdc] : $this->settings['connection_settings']['all'])['test_mode']) {
|
||||
$settings = isset($this->settings['connection_settings'][$this->datacenter->curdc]) ? $this->settings['connection_settings'][$this->datacenter->curdc] : $this->settings['connection_settings']['all'];
|
||||
if (!isset($this->settings['pwr']) || $this->settings['pwr']['pwr'] === false || $settings['test_mode']) {
|
||||
/*
|
||||
try {
|
||||
if (isset($res['username'])) {
|
||||
|
@ -1,6 +1,35 @@
|
||||
#!/bin/sh -e
|
||||
composer global require spatie/7to5
|
||||
|
||||
rm -rf phar7 phar5
|
||||
|
||||
mkdir phar7
|
||||
cd phar7
|
||||
echo '{
|
||||
"name": "danog/madelineprototests",
|
||||
"minimum-stability":"dev",
|
||||
"require": {
|
||||
"danog/madelineproto": "dev-master#'$TRAVIS_COMMIT'"
|
||||
},
|
||||
"repositories": [
|
||||
{
|
||||
"type": "git",
|
||||
"url": "https://github.com/danog/phpseclib"
|
||||
}
|
||||
],
|
||||
"authors": [
|
||||
{
|
||||
"name": "Daniil Gentili",
|
||||
"email": "daniil@daniil.it"
|
||||
}
|
||||
]
|
||||
}' > composer.json
|
||||
composer update
|
||||
php makephar.php $TRAVIS_COMMIT
|
||||
cd ..
|
||||
|
||||
$HOME/.composer/vendor/bin/php7to5 convert --copy-all phar7 phar5
|
||||
|
||||
php makephar.php phar5 madeline.phar $TRAVIS_COMMIT
|
||||
|
||||
[ -d JSON.sh ] || git clone https://github.com/dominictarr/JSON.sh
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user