diff options
author | marcus <marcus@36083f99-b078-4883-b0ff-0f9b5a30f544> | 2008-10-08 12:42:31 +0000 |
---|---|---|
committer | marcus <marcus@36083f99-b078-4883-b0ff-0f9b5a30f544> | 2008-10-08 12:42:31 +0000 |
commit | 6a8eb8ba9317546b9e89b2c68fb6322b8c3bc00d (patch) | |
tree | bf547efe41f4cdad7ae2f52d6e22377b3c0e0c6d /engine/lib | |
parent | 939ce5e44c049b0897899c8c7a79544068d2e3b3 (diff) | |
download | elgg-6a8eb8ba9317546b9e89b2c68fb6322b8c3bc00d.tar.gz elgg-6a8eb8ba9317546b9e89b2c68fb6322b8c3bc00d.tar.bz2 |
Minor optimisations.
Introducing exists() on filestores
git-svn-id: https://code.elgg.org/elgg/trunk@2222 36083f99-b078-4883-b0ff-0f9b5a30f544
Diffstat (limited to 'engine/lib')
-rw-r--r-- | engine/lib/filestore.php | 23 |
1 files changed, 21 insertions, 2 deletions
diff --git a/engine/lib/filestore.php b/engine/lib/filestore.php index daed925f5..94ab26594 100644 --- a/engine/lib/filestore.php +++ b/engine/lib/filestore.php @@ -117,10 +117,17 @@ /**
* Get the contents of the whole file.
*
- * @param mixed $f The file handle.
+ * @param mixed $file The file handle.
* @return mixed The file contents.
*/
- abstract public function grabFile(ElggFile $file);
+ abstract public function grabFile(ElggFile $file); + + /** + * Return whether a file physically exists or not. + * + * @param ElggFile $file + */ + abstract public function exists(ElggFile $file);
} @@ -243,6 +250,11 @@ return file_get_contents($file->getFilenameOnFilestore());
+ } + + public function exists(ElggFile $file) + { + return file_exists($this->getFilenameOnFilestore($file)); }
/** @@ -556,6 +568,13 @@ return $fs->eof($this->handle); } + public function exists() + { + $fs = $this->getFilestore(); + + return $fs->exists($this); + } + /** * Set a filestore. * |