Update a Download Feed
@param models\Download\Feed\DownloadFeed $downloadFeed
@return models\Download\Feed\DownloadFeed
180780
public function updateFeed( models\Download\Feed\DownloadFeed $downloadFeed){
        $service = sprintf( self::API_DOWNLOAD_FEEDS_ITEM, $downloadFeed->getId());
        $rest = $this->getService( $service);
        $rest->PUT( $downloadFeed);

        return $rest->getResult( models\Download\Feed\DownloadFeed::class);
    }
134618
public function getUserFeed($limit = 0)
    {
        $params = array();
        if ($limit > 0) {
            $params['count'] = $limit;
        }

        return $this->_makeCall('users/self/feed', true, $params);
    }
613428
public function remove( $downloadTaskId, $announceUrl) {
        $service = sprintf( self::API_DOWNLOAD_TRACKER_ITEM, $downloadTaskId, $announceUrl);
        $rest = $this->getService( $service);
        $rest->DELETE();

        return $rest->getSuccess();
    }
373411
static function download($reqst = '')
    {
        //checando a existencia do arquivo solicitado
        $reqst = static::fileExists($reqst);
        if($reqst == false) return false;

        //gerando header apropriado
        include static::$config.'mimetypes.php';
        $ext = end((explode('.', $reqst)));
        if (!isset($_mimes[$ext])) $mime = 'text/plain';
        else $mime = (is_array($_mimes[$ext])) ? $_mimes[$ext][0] : $_mimes[$ext];

        //get file
        $dt = file_get_contents($reqst);

        //download
        ob_end_clean();
        ob_start('ob_gzhandler');

        header('Vary: Accept-Language, Accept-Encoding');
        header('Content-Type: ' . $mime);
        header('Expires: ' . gmdate('D, d M Y H:i:s', time() + 31536000) . ' GMT');
        header('Last-Modified: ' . gmdate('D, d M Y H:i:s', filemtime($reqst)) . ' GMT');
        header('Cache-Control: must_revalidate, public, max-age=31536000');
        header('Content-Length: ' . strlen($dt));
        header('Content-Disposition: attachment; filename='.basename($reqst)); 
        header('ETAG: '.md5($reqst));
        exit($dt);
    }
97186
function softwareUpdate_download(channel, waitForFinish, timeout) {
    waitForFinish = waitForFinish ? waitForFinish : true;

    // Check that the correct channel has been set
    this._controller.assert(function() {
      return channel == this.channel;
    }, "The current update channel is identical to the specified one.", this);

    // Click the next button
    var next = this.getElement({type: "button", subtype: "next"});
    this._controller.click(next);

    // Wait for the download page - if it fails the update was already cached
    try {
      this.waitForWizardPage(WIZARD_PAGES.downloading);

      if (waitForFinish)
        this.waitforDownloadFinished(timeout);
    } catch (ex) {
      this.waitForWizardPage(WIZARD_PAGES.finished);
    }
  }
1346714
public function generateFeed()
	{
		// TODO Вынести возврат заголовков в отдельный метод
		//header("Content-type: text/xml");

		$feed =
			$this->generateHead() .
			$this->generateChannels() .
			$this->generateItems() .
			$this->generateTale();

		return $feed;
	}
604193
public function download($url, callable $onComplete = null)
    {
        //first check if the function is called external
        if($this->isExternal())
        {
            $data = file_get_contents($url);
            //hold the process to simulate more to do ;-)
            sleep(3);
            echo "Downloaded: ".strlen($data).' bytes from url: '.$url.PHP_EOL;
            //return the data
            //parent thread can handle this if needed
            return $data;
        }
        else
        {
            //we are in the parent context
            //just redirect to the thread
            //we use async as we dont want to wait for the result
            //return the handle allow the caller to check result
            return $this->asyncCallOnChild(__FUNCTION__, array($url), $onComplete);
        }
    }
1062857
public function store(CreateFeedRequest $request)
    {
        if(! class_exists($request->model)) return redirect()->back()->withInput()
            ->with('failed', 'This model does not exist. Please create model before creating feed.');

        $model = new $request->model;
        if(! method_exists($model, 'getFeedItems')) return redirect()->back()->withInput()
            ->with('failed', 'You must implement RssFeedInterface on your model before making feed');

        $this->feed->create($request->all());

        return redirect('admin/feeds');
    }
453767
public function getFromId( $download_id){
        $rest = $this->getService( self::API_DOWNLOAD . $download_id);
        $rest->GET();

        return $rest->getResult( models\Download\Task::class);
    }
1307356
public function setFeedType(?SubFeed $subFeed): void
    {
        if ($subFeed && !$subFeed->getFeedType()) {
            throw new \InvalidArgumentException('The feedType field must be specified on the subfeed.');
        }
        $this->feedTypeSubFeed = $subFeed;
    }
1101361
public function update(UpdateFeedRequest $request, $id)
    {
        if(! class_exists($request->model)) return redirect()->back()->withInput()
            ->with('failed', 'This model does not exist. Please create model before updating feed.');

        $model = new $request->model;
        if(! method_exists($model, 'getFeedItems')) return redirect()->back()->withInput()
            ->with('failed', 'You must implement RssFeedInterface on your model before updating feed with new model');

        $feed = $this->feed->findOrFail($id);
        $feed->update($request->all());

        return redirect('admin/feeds');
    }
611036
public function downloadFile(\SplFileInfo $content)
    {
        if ($content->isFile()) {

            if (!$content->isReadable()) {
                throw new MbException("The download file can not be read!");
            }

            $this->getMbAudit()->setResponseType('download');

            $finfo = new \finfo;

            $this->header("Content-Type", $finfo->file($content->getRealPath(), FILEINFO_MIME));
            $this->header("Content-Length", $content->getSize());
            $this->header("Content-Disposition", "attachment; filename={$content->getBasename()}");

            $this->sendHeaders();

            $this->getMbAudit()->setResponseData([
                'path'     => $content->getRealPath(),
                'filename' => $content->getBasename(),
                'size'     => $content->getSize(),
            ]);

            readfile($content->getRealPath());

            return true;
        } else {
            throw new MbException("The requested file for download is invalid!");
        }
    }
728139
public function navigateStreamFeed(StreamFeed $streamFeed, LinkRelation $relation): ?StreamFeed
    {
        $url = $streamFeed->getLinkUrl($relation);

        if (empty($url)) {
            return null;
        }

        return $this->readStreamFeed($url, $streamFeed->getEntryEmbedMode());
    }
962757
public function update()
    {
        $downloader = new Downloader();
        $content = $downloader->downloadContent(self::DOWNLOAD_URI);

        $uriPicker = new FallbackURIPicker();
        $path = $uriPicker->pickURI($content);

        if (strlen($path) > 0 && $path{0} != "/") {
            $path = sprintf("/%s/%s", dirname(self::DOWNLOAD_URI), $path);

        }
        $pathParts = explode('/', $path);
        foreach ($pathParts as $i => $part) {
            switch ($part) {
                case '..':
                    unset($pathParts[$i-1]);
                    // fall-through as the current part ("..") should be removed as well.

                case '.':
                    unset($pathParts[$i]);
                    break;
            }

        }
        $path = implode('/', $pathParts);
        $urlParts = parse_url(self::DOWNLOAD_URI);
        $url = sprintf("%s://%s%s", $urlParts["scheme"], $urlParts["host"], $path);

        // download file
        $file = $downloader->downloadFile($url);

        // Validate file format.
        $validator = new FileValidator();
        $validator->validate($file);

        // blz_20100308.txt is not sorted.
        $parser     = new FileParser($file);
        $lastBankID = $parser->getBankID($parser->getLines());
        if ($lastBankID < 80000000) {
            $this->sortFile($file);

        }

        $this->fileUtil->safeRename($file, $this->parser->getFile());
        chmod($this->parser->getFile(), 0644);
    }
1012191
public static function get_download_link(\context_user $usercontext, $requestid) {
        $downloadurl = moodle_url::make_pluginfile_url($usercontext->id,
                'tool_dataprivacy', 'export', $requestid, '/', 'export.zip', true);
        $downloadtext = get_string('download', 'tool_dataprivacy');
        return new \action_menu_link_secondary($downloadurl, null, $downloadtext);
    }
1268627
public function markFeedAsRead( $downloadFeedId){
        $service = sprintf( self::API_DOWNLOAD_FEEDS_ITEMS_MARK_AS_READ, $downloadFeedId);
        $rest = $this->getService( $service);
        $rest->POST();

        return $rest->getSuccess();
    }
780378
public function setDownloads( $downloads )
    {
        $this->downloads = empty( $downloads ) &&
                           $downloads !== 0 &&
                           $downloads !== '0' ? null : (int) $downloads;

        return $this;
    }