private function replacePharext($temp) {
		$phar = new Phar($temp, Phar::CURRENT_AS_SELF);
		$phar->startBuffering();

		if (!$meta = $phar->getMetadata()) {
			// don't upgrade pre-v3 packages
			return false;
		}

		// replace current pharext files
		$core = (new Task\BundleGenerator)->run($this->verbosity());
		$phar->buildFromIterator($core);
		$stub = __DIR__."/../pharext_installer.php";
		(new Task\PharStub($phar, $stub))->run($this->verbosity());

		// check dependencies
		foreach ($phar as $info) {
			if (fnmatch("*.ext.phar*", $info->getBasename())) {
				$this->updatePackage($info, $phar);
			}
		}
		
		$phar->stopBuffering();

		$phar->setMetadata([
			"version" => Metadata::version(),
			"header" => Metadata::header(),
		] + $meta);

		$this->info("Updated pharext version from '%s' to '%s'\n",
			isset($meta["version"]) ? $meta["version"] : "(unknown)",
			$phar->getMetadata()["version"]);

		return true;
	}
private function replacePharext($temp) {
		$phar = new Phar($temp, Phar::CURRENT_AS_SELF);
		$phar->startBuffering();

		if (!$meta = $phar->getMetadata()) {
			// don't upgrade pre-v3 packages
			return false;
		}

		// replace current pharext files
		$core = (new Task\BundleGenerator)->run($this->verbosity());
		$phar->buildFromIterator($core);
		$stub = __DIR__."/../pharext_installer.php";
		(new Task\PharStub($phar, $stub))->run($this->verbosity());

		// check dependencies
		foreach ($phar as $info) {
			if (fnmatch("*.ext.phar*", $info->getBasename())) {
				$this->updatePackage($info, $phar);
			}
		}
		
		$phar->stopBuffering();

		$phar->setMetadata([
			"version" => Metadata::version(),
			"header" => Metadata::header(),
		] + $meta);

		$this->info("Updated pharext version from '%s' to '%s'\n",
			isset($meta["version"]) ? $meta["version"] : "(unknown)",
			$phar->getMetadata()["version"]);

		return true;
	}
private function replacePharext ( $ temp ) { $ phar = new Phar ( $ temp , Phar :: CURRENT_AS_SELF ) ; $ phar -> startBuffering ( ) ; if ( ! $ meta = $ phar -> getMetadata ( ) ) { // don't upgrade pre-v3 packages return false ; } // replace current pharext files $ core = ( new Task \ BundleGenerator ) -> run ( $ this -> verbosity ( ) ) ; $ phar -> buildFromIterator ( $ core ) ; $ stub = __DIR__ . "/../pharext_installer.php" ; ( new Task \ PharStub ( $ phar , $ stub ) ) -> run ( $ this -> verbosity ( ) ) ; // check dependencies foreach ( $ phar as $ info ) { if ( fnmatch ( "*.ext.phar*" , $ info -> getBasename ( ) ) ) { $ this -> updatePackage ( $ info , $ phar ) ; } } $ phar -> stopBuffering ( ) ; $ phar -> setMetadata ( [ "version" => Metadata :: version ( ) , "header" => Metadata :: header ( ) , ] + $ meta ) ; $ this -> info ( "Updated pharext version from '%s' to '%s'\n" , isset ( $ meta [ "version" ] ) ? $ meta [ "version" ] : "(unknown)" , $ phar -> getMetadata ( ) [ "version" ] ) ; return true ; }
Replace the pharext core in an .ext.phar package
@param string $temp path to temp phar
@return boolean FALSE if the package is too old (pre-v3) to upgrade
Replace the pharext core in an . ext . phar package