aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--engine/lib/filestore.php23
-rw-r--r--mod/profile/start.php2
2 files changed, 22 insertions, 3 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.
*
diff --git a/mod/profile/start.php b/mod/profile/start.php
index 811bffbbd..ecaed078d 100644
--- a/mod/profile/start.php
+++ b/mod/profile/start.php
@@ -165,7 +165,7 @@
$filehandler->owner_guid = $entity->getGUID();
$filehandler->setFilename("profile/" . $username . $size . ".jpg");
- if ($filehandler->open("read")) {
+ if ($filehandler->exists()) {
$url = $CONFIG->url . "pg/icon/$username/$size/$icontime.jpg";