private function updatePackage(SplFileInfo $file, Phar $phar = null)
{
$this->info("Updating pharext core in '%s'...\n", basename($file));
$temp = new Tempname("update", substr(strstr($file, ".ext.phar"), 4));
if (!copy($file->getPathname(), $temp)) {
throw new Exception();
}
if (!chmod($temp, $file->getPerms())) {
throw new Exception();
}
if (!$this->replacePharext($temp)) {
return false;
}
if ($phar) {
$phar->addFile($temp, $file);
} elseif (!rename($temp, $file->getPathname())) {
throw new Exception();
}
return true;
}