public function saveZipFile($storageService, $storageFolder)
    {
        try {
            $this->zip->close();

            if ($this->isSecured()) {
                $password = $this->getPassword();
                $tmpDir = rtrim(sys_get_temp_dir(), DIRECTORY_SEPARATOR) . DIRECTORY_SEPARATOR;
                $extractDir = $tmpDir . substr(basename($this->zipFile), 0, strlen(basename($this->zipFile)) - 4);
                $tmpZip = new \ZipArchive();
                $tmpZip->open($this->zipFile);
                $tmpZip->extractTo($extractDir);
                $tmpZip->close();
                @unlink($this->zipFile);
                $server = strtolower(php_uname('s'));
                $commandSeparator = ';';
                if (strpos($server, 'windows') !== false) {
                    $commandSeparator = '&';
                }
                @exec("cd $extractDir $commandSeparator zip -r -P $password $this->zipFile .", $output);
                \Log::info('Encrypting zip file with a password.', $output);
                @FileUtilities::deleteTree($extractDir, true);
            }

            /** @type FileServiceInterface $storage */
            $storage = ServiceManager::getService($storageService);
            if (!$storage->folderExists($storageFolder)) {
                $storage->createFolder($storageFolder);
            }

            $storage->moveFile($storageFolder . '/' . basename($this->zipFile), $this->zipFile);

            $url = Environment::getURI() .
                '/api/v2/' .
                $storageService .
                '/' .
                $storageFolder .
                '/' .
                basename($this->zipFile);

            return $url;
        } catch (\Exception $e) {
            throw new InternalServerErrorException(
                'Failed to save the exported package using storage service ' .
                $storageService . '. ' .
                $e->getMessage()
            );
        }
    }
public function saveZipFile($storageService, $storageFolder)
    {
        try {
            $this->zip->close();

            if ($this->isSecured()) {
                $password = $this->getPassword();
                $tmpDir = rtrim(sys_get_temp_dir(), DIRECTORY_SEPARATOR) . DIRECTORY_SEPARATOR;
                $extractDir = $tmpDir . substr(basename($this->zipFile), 0, strlen(basename($this->zipFile)) - 4);
                $tmpZip = new \ZipArchive();
                $tmpZip->open($this->zipFile);
                $tmpZip->extractTo($extractDir);
                $tmpZip->close();
                @unlink($this->zipFile);
                $server = strtolower(php_uname('s'));
                $commandSeparator = ';';
                if (strpos($server, 'windows') !== false) {
                    $commandSeparator = '&';
                }
                @exec("cd $extractDir $commandSeparator zip -r -P $password $this->zipFile .", $output);
                \Log::info('Encrypting zip file with a password.', $output);
                @FileUtilities::deleteTree($extractDir, true);
            }

            /** @type FileServiceInterface $storage */
            $storage = ServiceManager::getService($storageService);
            if (!$storage->folderExists($storageFolder)) {
                $storage->createFolder($storageFolder);
            }

            $storage->moveFile($storageFolder . '/' . basename($this->zipFile), $this->zipFile);

            $url = Environment::getURI() .
                '/api/v2/' .
                $storageService .
                '/' .
                $storageFolder .
                '/' .
                basename($this->zipFile);

            return $url;
        } catch (\Exception $e) {
            throw new InternalServerErrorException(
                'Failed to save the exported package using storage service ' .
                $storageService . '. ' .
                $e->getMessage()
            );
        }
    }
public function saveZipFile ( $ storageService , $ storageFolder ) { try { $ this -> zip -> close ( ) ; if ( $ this -> isSecured ( ) ) { $ password = $ this -> getPassword ( ) ; $ tmpDir = rtrim ( sys_get_temp_dir ( ) , DIRECTORY_SEPARATOR ) . DIRECTORY_SEPARATOR ; $ extractDir = $ tmpDir . substr ( basename ( $ this -> zipFile ) , 0 , strlen ( basename ( $ this -> zipFile ) ) - 4 ) ; $ tmpZip = new \ ZipArchive ( ) ; $ tmpZip -> open ( $ this -> zipFile ) ; $ tmpZip -> extractTo ( $ extractDir ) ; $ tmpZip -> close ( ) ; @ unlink ( $ this -> zipFile ) ; $ server = strtolower ( php_uname ( 's' ) ) ; $ commandSeparator = ';' ; if ( strpos ( $ server , 'windows' ) !== false ) { $ commandSeparator = '&' ; } @ exec ( "cd $extractDir $commandSeparator zip -r -P $password $this->zipFile ." , $ output ) ; \ Log :: info ( 'Encrypting zip file with a password.' , $ output ) ; @ FileUtilities :: deleteTree ( $ extractDir , true ) ; } /** @type FileServiceInterface $storage */ $ storage = ServiceManager :: getService ( $ storageService ) ; if ( ! $ storage -> folderExists ( $ storageFolder ) ) { $ storage -> createFolder ( $ storageFolder ) ; } $ storage -> moveFile ( $ storageFolder . '/' . basename ( $ this -> zipFile ) , $ this -> zipFile ) ; $ url = Environment :: getURI ( ) . '/api/v2/' . $ storageService . '/' . $ storageFolder . '/' . basename ( $ this -> zipFile ) ; return $ url ; } catch ( \ Exception $ e ) { throw new InternalServerErrorException ( 'Failed to save the exported package using storage service ' . $ storageService . '. ' . $ e -> getMessage ( ) ) ; } }
Saves ZipArchive.

@param $storageService
@param $storageFolder

@return string
@throws \DreamFactory\Core\Exceptions\InternalServerErrorException
Saves ZipArchive .