public function deleteDir($dirname) { $path = Util::normalizePrefix($dirname, '/'); $length = strlen($path); for ($i = 0; $i < $this->archive->numFiles; $i++) { $info = $this->archive->statIndex($i); if (substr($info['name'], 0, $length) === $path) { $this->archive->deleteIndex($i); } } return $this->archive->deleteName($dirname); }
public function deleteDir($dirname) { // This is needed to ensure the right number of // files are set to the $numFiles property. $this->reopenArchive(); $location = $this->applyPathPrefix($dirname); $path = Util::normalizePrefix($location, '/'); $length = strlen($path); for ($i = 0; $i < $this->archive->numFiles; $i++) { $info = $this->archive->statIndex($i); if (substr($info['name'], 0, $length) === $path) { $this->archive->deleteIndex($i); } } return $this->archive->deleteName($dirname); }
/** * Constructor * * @param string $root */ public function __construct($root) { $root = $this->ensureDirectory($root); $this->root = Util::normalizePrefix($root, DIRECTORY_SEPARATOR); }