public function fetch()

in lib/php/libsdk/SDK/Build/PGO/Tool/PackageWorkman.php [20:34]


	public function fetch(string $url, string $tgt_fn, bool $force = false) : void
	{
		$cache_fn = $this->conf->getPkgCacheDir() . DIRECTORY_SEPARATOR . basename($tgt_fn);

		if ($force || !file_exists($cache_fn)) {
			echo "Fetching '$url' into '$tgt_fn'\n";
			$this->download($url, $cache_fn);
		}

		if ($force || !file_exists($tgt_fn)) {
			if ($cache_fn != $tgt_fn && !$this->cp($cache_fn, $tgt_fn)) {
				throw new Exception("Failed to copy '$cache_fn' to '$tgt_fn'.");
			}
		}
	}