Report installs to composer

This commit is contained in:
Daniil Gentili 2020-01-18 18:37:30 +01:00
parent 995a489704
commit f01871a0e8
Signed by: danog
GPG Key ID: 8C1BE3B34B230CA7

View File

@ -84,6 +84,25 @@ function ___install_madeline()
if ($phar) {
\file_put_contents('madeline.phar', $phar);
\file_put_contents('madeline.phar.version', $release);
$composer = \json_decode(\file_get_contents('phar://madeline.phar/vendor/composer/installed.json'), true);
$postData = ['downloads' => []];
foreach ($composer as $dep) {
$postData['downloads'][] = [
'name' => $dep['name'],
'version' => $dep['version_normalized']
];
}
$opts = ['http' =>
[
'method' => 'POST',
'header' => ['Content-Type: application/json'],
'content' => \json_encode($postData),
'timeout' => 6,
],
];
@\file_get_contents("https://packagist.org/downloads/", false, \stream_context_create($opts));
}
}
}