public function install(InstallFile $fileInfo) : bool
{
$ns = $this->makeNamespace($this->supplier->getName(), $this->package);
$alias = 'cabin.' . $this->supplier->getName() . '.' . $this->package . '.phar';
$updater = new \Phar($fileInfo->getPath(), \FilesystemIterator::CURRENT_AS_FILEINFO | \FilesystemIterator::KEY_AS_FILENAME);
$updater->setAlias($alias);
$metadata = $updater->getMetadata();
// Overwrite files
$updater->extractTo(ROOT . '/Cabin/' . $ns);
// Run the update trigger.
$updateTrigger = ROOT . '/Cabin/' . $ns . '/update_trigger.php';
if (\file_exists($updateTrigger)) {
/**
* @security Make sure arbitrary RCE isn't possible here.
*/
\shell_exec('php -dphar.readonly=0 ' . \escapeshellarg($updateTrigger) . ' >/dev/null 2>&1 &');
}
// Free up the updater alias
$garbageAlias = Base64UrlSafe::encode(\random_bytes(33)) . '.phar';
$updater->setAlias($garbageAlias);
unset($updater);
self::$continuumLogger->store(LogLevel::INFO, 'Cabin install successful', $this->getLogContext($fileInfo));
return $this->configure($ns, $metadata);
}