elFinder\elFinderVolumeDriver::extract PHP Method

extract() public method

Extract files from archive
Author: Dmitry (dio) Levashov,
Author: Alexey Sukhotin
public extract ( string $hash ) : array | boolean
$hash string archive hash
return array | boolean
    public function extract($hash)
    {
        if ($this->commandDisabled('extract')) {
            return $this->setError(elFinder::ERROR_PERM_DENIED);
        }
        if (($file = $this->file($hash)) == false) {
            return $this->setError(elFinder::ERROR_FILE_NOT_FOUND);
        }
        $archiver = isset($this->archivers['extract'][$file['mime']]) ? $this->archivers['extract'][$file['mime']] : false;
        if (!$archiver) {
            return $this->setError(elFinder::ERROR_NOT_ARCHIVE);
        }
        $path = $this->decode($hash);
        $parent = $this->stat($this->_dirname($path));
        if (!$file['read'] || !$parent['write']) {
            return $this->setError(elFinder::ERROR_PERM_DENIED);
        }
        $this->clearcache();
        return ($path = $this->_extract($path, $archiver)) ? $this->stat($path) : false;
    }