hellbound/utils/composer/update.php

23 lines
566 B
PHP
Raw Normal View History

2021-11-26 11:16:25 +03:00
<?php
$VERSION = "2.0.8";
$SHA = "2021f0d52b446e0efe3c548cc058ab5671fa38cdbcf814e7911c7e9d71d61538";
$PHAR = __DIR__ . "/composer-$VERSION.phar";
if(!file_exists($PHAR))
{
echo "Downloading composer...\n";
copy("http://getcomposer.org/download/$VERSION/composer.phar", $PHAR);
if(hash_file('sha256', $PHAR) !== $SHA)
{
unlink($PHAR);
throw new Exception("Check summs don't match: $SHA VS " . hash_file('sha256', $PHAR));
}
}
system("cd " . __DIR__ . " && php $PHAR update --no-dev", $ret);
if($ret != 0)
throw new Exception("Update error");