Skip to content

Commit 379347c

Browse files
Merge branch 'main' into 6.0
2 parents f51694c + 13ef418 commit 379347c

1 file changed

Lines changed: 10 additions & 37 deletions

File tree

src/Cmd.php

Lines changed: 10 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -257,36 +257,7 @@ protected function overrideConfigWithArguments(Configuration $configuration) : v
257257
protected function handleSelfUpdate() : void
258258
{
259259
$this->printVersionString();
260-
261-
// check if upgrade is necessary
262-
$latestVersion = $this->getLatestVersion();
263-
if (!$this->isPharOutdated($latestVersion)) {
264-
echo 'You already have the latest version of phpbu installed.' . PHP_EOL;
265-
exit(self::EXIT_SUCCESS);
266-
}
267-
268-
$remoteFilename = 'http://phar.phpbu.de/phpbu.phar';
269-
$localFilename = realpath($_SERVER['argv'][0]);
270-
$tempFilename = basename($localFilename, '.phar') . '-temp.phar';
271-
272-
echo 'Updating the phpbu PHAR to version ' . $latestVersion . ' ... ';
273-
274-
$this->overwriteOriginalBinaryWithTempBinary($tempFilename, $this->downloadLatestPHAR($remoteFilename));
275-
276-
// check downloaded phar
277-
try {
278-
$phar = new Phar($tempFilename);
279-
unset($phar);
280-
// replace current phar with the new one
281-
rename($tempFilename, $localFilename);
282-
} catch (\Exception $e) {
283-
// cleanup crappy phar
284-
unlink($tempFilename);
285-
echo 'failed' . PHP_EOL . $e->getMessage() . PHP_EOL;
286-
exit(self::EXIT_EXCEPTION);
287-
}
288-
289-
echo 'done' . PHP_EOL;
260+
$this->printSelfUpdateRemoved();
290261
}
291262

292263
/**
@@ -295,14 +266,16 @@ protected function handleSelfUpdate() : void
295266
protected function handleVersionCheck() : void
296267
{
297268
$this->printVersionString();
269+
$this->printSelfUpdateRemoved();
270+
}
298271

299-
$latestVersion = $this->getLatestVersion();
300-
if ($this->isPharOutdated($latestVersion)) {
301-
print 'You are not using the latest version of phpbu.' . PHP_EOL
302-
. 'Use "phpbu --self-update" to install phpbu ' . $latestVersion . PHP_EOL;
303-
} else {
304-
print 'You are using the latest version of phpbu.' . PHP_EOL;
305-
}
272+
protected function printSelfUpdateRemoved() : void
273+
{
274+
// check if upgrade is necessary
275+
echo 'The self update feature got removed.' . PHP_EOL
276+
. 'It is recommended to use phive to install and update the phpbu PHAR file.' . PHP_EOL
277+
. PHP_EOL
278+
. 'Go to https://phar.io to get the latest version if phive.' . PHP_EOL;
306279
}
307280

308281
/**

0 commit comments

Comments
 (0)