Skip to content

Commit

Permalink
Added function for reading file contents
Browse files Browse the repository at this point in the history
  • Loading branch information
icc committed Apr 22, 2016
1 parent 64de9d5 commit e324e29
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
10 changes: 10 additions & 0 deletions h5p-default-storage.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -244,6 +244,16 @@ public function deleteCachedAssets($keys) {
}
}

/**
* Read file content of given file and then return it.
*
* @param string $file_path
* @return string
*/
public function getContent($file_path) {
return file_get_contents($this->path . $file_path);
}

/**
* Recursive function for copying directories.
*
Expand Down
8 changes: 8 additions & 0 deletions h5p-file-storage.interface.php
Original file line number Diff line number Diff line change
Expand Up @@ -117,4 +117,12 @@ public function getCachedAssets($key);
* The hash keys of removed files
*/
public function deleteCachedAssets($keys);

/**
* Read file content of given file and then return it.
*
* @param string $file_path
* @return string contents
*/
public function getContent($file_path);
}

0 comments on commit e324e29

Please sign in to comment.