protected function download(\Concrete\Core\File\File $file, $rcID = null) { $filename = $file->getFilename(); $file->trackDownload($rcID); $fsl = $file->getFileStorageLocationObject(); $configuration = $fsl->getConfigurationObject(); $fv = $file->getVersion(); if ($configuration->hasPublicURL()) { return \Redirect::url($fv->getURL())->send(); } else { return $fv->forceDownload(); } }
/** * {@inheritDoc} */ public function trackDownload($rcID = NULL) { $this->__initializer__ && $this->__initializer__->__invoke($this, 'trackDownload', array($rcID)); return parent::trackDownload($rcID); }
/** * Forces the download of a file and shuts down. * Returns null if approved version wasn't found. * * @param File $file * @param null|int $rcID */ protected function force_download($file, $rcID = null) { $file->trackDownload($rcID); // Magic call to approved FileVersion return $file->forceDownload(); }
/** * Tracks File Download, takes the cID of the page that the file was downloaded from * @param int $rcID * @return void */ public function trackDownload($rcID = null) { return parent::trackDownload($rcID); }