BcZip::_extractByCommand PHP Method

_extractByCommand() protected method

コマンドによる展開
protected _extractByCommand ( $source, $target ) : boolean
$source
$target
return boolean
    protected function _extractByCommand($source, $target)
    {
        exec('which unzip', $return1);
        if (empty($return1[0])) {
            return false;
        }
        $unzipCommand = $return1[0];
        $target = preg_replace('/\\/$/', '', $target);
        $command = $unzipCommand . ' -o ' . $this->_escapePath($source) . ' -d ' . $this->_escapePath($target);
        exec($command, $return2);
        if (!empty($return2[2])) {
            $path = str_replace('  inflating: ' . $target, '', $return2[2]);
            $path = preg_replace('/^\\//', '', $path);
            $pathAry = explode(DS, $path);
            $this->topArchiveName = $pathAry[0];
            return true;
        } else {
            exec($unzipCommand . ' 2>&1', $errs);
            $this->error = $errs;
            return false;
        }
    }