-php -r '$archive = isset($argv[1]) ? $argv[1] : null; $target = isset($argv[2]) ? $argv[2] : null; if (!$archive || !$target) { fwrite(STDERR, "Missing extract arguments\n"); exit(1); } if (!is_dir(dirname($target)) && !mkdir(dirname($target), 0777, true)) { fwrite(STDERR, "Unable to create target parent directory\n"); exit(1); } $root = dirname($target); $tarPath = preg_replace("/\\.tgz$/", ".tar", $archive); if ($tarPath === null) { fwrite(STDERR, "Unable to derive tar path\n"); exit(1); } try { if (!file_exists($tarPath)) { $tgz = new PharData($archive); $tgz->decompress(); } $tar = new PharData($tarPath); $tar->extractTo($root, null, true); } catch (Exception $e) { fwrite(STDERR, "Unable to extract phpDocumentor archive: " . $e->getMessage() . "\n"); exit(1); }' "$TARGET_FILE" "$EXTRACTED_ROOT"
0 commit comments