protected function _unzip($file)
    {
        include_once Plugin::classPath('Installer') . 'Lib/pclzip.lib.php';
        $File = new File($file);
        $to = normalizePath($File->folder()->pwd() . '/' . $File->name() . '_unzip/');

        if (is_readable($to)) {
            $folder = new Folder($to);
            $folder->delete();
        } else {
            $folder = new Folder($to, true);
        }

        $PclZip = new \PclZip($file);
        $PclZip->delete(PCLZIP_OPT_BY_EREG, '/__MACOSX/');
        $PclZip->delete(PCLZIP_OPT_BY_EREG, '/\.DS_Store$/');

        if ($PclZip->extract(PCLZIP_OPT_PATH, $to)) {
            list($directories, $files) = $folder->read(false, false, true);
            if (count($directories) === 1 && empty($files)) {
                $container = new Folder($directories[0]);
                $container->move(['to' => $to]);
            }

            $this->_workingDir = $to;

            return true;
        }

        $this->err(__d('installer', 'Unzip error: {0}', [$PclZip->errorInfo(true)]));

        return false;
    }
protected function _unzip($file)
    {
        include_once Plugin::classPath('Installer') . 'Lib/pclzip.lib.php';
        $File = new File($file);
        $to = normalizePath($File->folder()->pwd() . '/' . $File->name() . '_unzip/');

        if (is_readable($to)) {
            $folder = new Folder($to);
            $folder->delete();
        } else {
            $folder = new Folder($to, true);
        }

        $PclZip = new \PclZip($file);
        $PclZip->delete(PCLZIP_OPT_BY_EREG, '/__MACOSX/');
        $PclZip->delete(PCLZIP_OPT_BY_EREG, '/\.DS_Store$/');

        if ($PclZip->extract(PCLZIP_OPT_PATH, $to)) {
            list($directories, $files) = $folder->read(false, false, true);
            if (count($directories) === 1 && empty($files)) {
                $container = new Folder($directories[0]);
                $container->move(['to' => $to]);
            }

            $this->_workingDir = $to;

            return true;
        }

        $this->err(__d('installer', 'Unzip error: {0}', [$PclZip->errorInfo(true)]));

        return false;
    }
protected function _unzip ( $ file ) { include_once Plugin :: classPath ( 'Installer' ) . 'Lib/pclzip.lib.php' ; $ File = new File ( $ file ) ; $ to = normalizePath ( $ File -> folder ( ) -> pwd ( ) . '/' . $ File -> name ( ) . '_unzip/' ) ; if ( is_readable ( $ to ) ) { $ folder = new Folder ( $ to ) ; $ folder -> delete ( ) ; } else { $ folder = new Folder ( $ to , true ) ; } $ PclZip = new \ PclZip ( $ file ) ; $ PclZip -> delete ( PCLZIP_OPT_BY_EREG , '/__MACOSX/' ) ; $ PclZip -> delete ( PCLZIP_OPT_BY_EREG , '/\.DS_Store$/' ) ; if ( $ PclZip -> extract ( PCLZIP_OPT_PATH , $ to ) ) { list ( $ directories , $ files ) = $ folder -> read ( false , false , true ) ; if ( count ( $ directories ) === 1 && empty ( $ files ) ) { $ container = new Folder ( $ directories [ 0 ] ) ; $ container -> move ( [ 'to' => $ to ] ) ; } $ this -> _workingDir = $ to ; return true ; } $ this -> err ( __d ( 'installer' , 'Unzip error: {0}' , [ $ PclZip -> errorInfo ( true ) ] ) ) ; return false ; }
Extracts the current ZIP package.

@param  string $file Full path to the ZIP package
@return bool True on success
Extracts the current ZIP package .