Commits

christiansalazar committed d449f7e

new method. read_file, depending on the implementation. using file_get_contents on YiiDiskFileManager.

Comments (0)

Files changed (2)

IYiiFileManager.php

 	public function get_file_info($id, $file_id, $extra=array());
 	public function can_read($id, $file_id, $extra=array());
 	public function rename_file($id, $file_id, $name, $extra=array());
+	public function read_file($id, $file_id, $extra=array());
 
 	function on_file($id, $file_id, $file_path, $extra=array());
 	function get_file_list($id, $extra=array());

YiiDiskFileManager.php

 		return (parent::get_file_info($id, $file_id) != null);
     }
 
+	/**
+	 	returns the file content, using the system provided mechanism relative to disk files
+		only return data if the given file belongs to the identity domain (the $id)
+
+		@param string $id the identity domain
+		@param string $file_id the file id, owned by the identity
+	 	@return string binary file data
+	 */
+	public function read_file($id, $file_id, $extra=array()){
+		return file_get_contents($this->get_file_path($id, $file_id, $extra));
+	}
+
 	private function get_storage_path($id){
 		$local_path = rtrim(trim($this->storage_path),"/");
 		@mkdir($local_path);