protected function _downloadUpdate($updateUrl, $updateFile)
    {
        $this->log->addInfo(sprintf('Downloading update "%s" to "%s"', $updateUrl, $updateFile));
        if (function_exists('curl_version') && $this->_isValidUrl($updateUrl)) {
            $update = $this->_downloadCurl($updateUrl);
            if ($update === false) {
                return false;
            }
        } elseif (ini_get('allow_url_fopen')) {
            // TODO: Throw exception on error
            $update = @file_get_contents($updateUrl, false, $this->_useBasicAuth());

            if ($update === false) {
                $this->log->addError(sprintf('Could not download update "%s"!', $updateUrl));

                throw new DownloadException($updateUrl);
            }
        } else {
            throw new \Exception('No valid download method found!');
        }

        $handle = fopen($updateFile, 'w');
        if (!$handle) {
            $this->log->addError(sprintf('Could not open file handle to save update to "%s"!', $updateFile));

            return false;
        }

        if (!fwrite($handle, $update)) {
            $this->log->addError(sprintf('Could not write update to file "%s"!', $updateFile));
            fclose($handle);

            return false;
        }

        fclose($handle);

        return true;
    }
protected function _downloadUpdate($updateUrl, $updateFile)
    {
        $this->log->addInfo(sprintf('Downloading update "%s" to "%s"', $updateUrl, $updateFile));
        if (function_exists('curl_version') && $this->_isValidUrl($updateUrl)) {
            $update = $this->_downloadCurl($updateUrl);
            if ($update === false) {
                return false;
            }
        } elseif (ini_get('allow_url_fopen')) {
            // TODO: Throw exception on error
            $update = @file_get_contents($updateUrl, false, $this->_useBasicAuth());

            if ($update === false) {
                $this->log->addError(sprintf('Could not download update "%s"!', $updateUrl));

                throw new DownloadException($updateUrl);
            }
        } else {
            throw new \Exception('No valid download method found!');
        }

        $handle = fopen($updateFile, 'w');
        if (!$handle) {
            $this->log->addError(sprintf('Could not open file handle to save update to "%s"!', $updateFile));

            return false;
        }

        if (!fwrite($handle, $update)) {
            $this->log->addError(sprintf('Could not write update to file "%s"!', $updateFile));
            fclose($handle);

            return false;
        }

        fclose($handle);

        return true;
    }
protected function _downloadUpdate ( $ updateUrl , $ updateFile ) { $ this -> log -> addInfo ( sprintf ( 'Downloading update "%s" to "%s"' , $ updateUrl , $ updateFile ) ) ; if ( function_exists ( 'curl_version' ) && $ this -> _isValidUrl ( $ updateUrl ) ) { $ update = $ this -> _downloadCurl ( $ updateUrl ) ; if ( $ update === false ) { return false ; } } elseif ( ini_get ( 'allow_url_fopen' ) ) { // TODO: Throw exception on error $ update = @ file_get_contents ( $ updateUrl , false , $ this -> _useBasicAuth ( ) ) ; if ( $ update === false ) { $ this -> log -> addError ( sprintf ( 'Could not download update "%s"!' , $ updateUrl ) ) ; throw new DownloadException ( $ updateUrl ) ; } } else { throw new \ Exception ( 'No valid download method found!' ) ; } $ handle = fopen ( $ updateFile , 'w' ) ; if ( ! $ handle ) { $ this -> log -> addError ( sprintf ( 'Could not open file handle to save update to "%s"!' , $ updateFile ) ) ; return false ; } if ( ! fwrite ( $ handle , $ update ) ) { $ this -> log -> addError ( sprintf ( 'Could not write update to file "%s"!' , $ updateFile ) ) ; fclose ( $ handle ) ; return false ; } fclose ( $ handle ) ; return true ; }
Download the update

@param string $updateUrl Url where to download from
@param string $updateFile Path where to save the download
@return bool
@throws DownloadException
@throws \Exception
Download the update