/** * Construct the asset file from asset id and source * @param $file_id * @param Assets_s3_source $source * @param $prefetched_row if passed, will be used instead of loading DB data */ public function __construct($file_id, Assets_s3_source $source, $prefetched_row = null) { parent::__construct($file_id, $source, $prefetched_row); $bucket_id = $this->folder_row->source_id; $this->_source_settings = $source->get_source_settings(); $this->subpath = $this->folder_row->full_path . $this->row_field('file_name'); $this->path = $this->_source_settings->bucket . '/' . $this->subpath; $this->server_path = trim($this->subpath, '/'); }
/** * Constructor */ function __construct($file_id, Assets_ee_source $source, $prefetched_row = null) { parent::__construct($file_id, $source, $prefetched_row); $cache =& $this->EE->session->cache['assets']; $upload_filedir_id = $this->folder_row->filedir_id; if (!isset($cache['filedir_prefs'][$upload_filedir_id])) { $cache['filedir_prefs'][$upload_filedir_id] = $this->source->get_filedir($upload_filedir_id); } if (empty($cache['filedir_prefs'][$upload_filedir_id])) { throw new Exception(lang('exception_error')); } $this->filedir = $cache['filedir_prefs'][$upload_filedir_id]; $this->subpath = $this->folder_row->full_path . $this->row_field('file_name'); $this->path = $this->filedir->name . '/' . $this->subpath; $this->server_path = str_replace('//', '/', Assets_ee_source::resolve_server_path($this->filedir->server_path) . $this->subpath); }