aboutsummaryrefslogtreecommitdiff
path: root/engine
diff options
context:
space:
mode:
Diffstat (limited to 'engine')
-rw-r--r--engine/lib/filestore.php24
1 files changed, 15 insertions, 9 deletions
diff --git a/engine/lib/filestore.php b/engine/lib/filestore.php
index 7ad82b31a..d4a53f1c9 100644
--- a/engine/lib/filestore.php
+++ b/engine/lib/filestore.php
@@ -115,12 +115,12 @@
public function open(ElggFile $file, $mode)
{
- // Try and create the directory
- try { $this->make_directory_root($this->dir_root); } catch (Exception $e){}
-
$name = $file->getFilename();
$matrix = $this->make_file_matrix($name);
+ // Try and create the directory
+ try { $this->make_directory_root($this->dir_root . $matrix); } catch (Exception $e){}
+
switch ($mode)
{
case "read" : $mode = "r+b"; break;
@@ -174,7 +174,7 @@
*/
protected function make_directory_root($dirroot)
{
- if (!mkdir($dir, 0700, true))
+ if (!@mkdir($dirroot, 0700, true))
throw new IOException("Could not make $dirroot");
return true;
@@ -189,12 +189,12 @@
{
$matrix = "";
- $len = strlen($ident);
+ $len = strlen($filename);
if ($len>$this->matrix_depth)
$len = $this->matrix_depth;
- for ($n = 0; $n < strlen($ident); $n++)
- $matrix .= $ident[$n] . "/";
+ for ($n = 0; $n < $len; $n++)
+ $matrix .= $filename[$n] . "/";
return $matrix;
}
@@ -247,12 +247,12 @@
*
* @param string $name The filename.
*/
- public function setFilename($name) { $this->name = $name; }
+ public function setFilename($name) { $this->title = $name; }
/**
* Return the filename.
*/
- public function getFilename() { return $this->name; }
+ public function getFilename() { return $this->title; }
/**
* Set the optional file description.
@@ -270,6 +270,9 @@
{
if (!$this->name)
throw new IOException("You must specify a name before opening a file.");
+
+ // See if file has already been saved
+ // seek on datastore, parameters and name
// Sanity check
if (
@@ -423,6 +426,9 @@
foreach ($params as $k => $v)
$this->setMetaData("filestore::$k", $v);
+ // Now make a note of the filestore class
+ $this->setMetaData("filestore::filestore", get_class($this));
+
return true;
}