Elgg  Version 3.0
ElggTempDiskFilestore.php
Go to the documentation of this file.
1 <?php
13 
17  protected $unique_sub_dir;
18 
24  public function __construct($directory_root = '') {
25 
26  if (!$directory_root) {
27  $directory_root = rtrim(sys_get_temp_dir(), DIRECTORY_SEPARATOR) . '/';
28  }
29 
30  $this->unique_sub_dir = uniqid() . '/';
31 
32  parent::__construct($directory_root);
33  }
34 
45 
46  $filename = $file->getFilename();
47  if (!$filename) {
48  return '';
49  }
50 
51  return $this->dir_root . $this->unique_sub_dir . $file->getFilename();
52  }
53 
57  public function getParameters() {
58  $params = parent::getParameters();
59  $params['unique_sub_dir'] = $this->unique_sub_dir;
60 
61  return $params;
62  }
63 
67  public function setParameters(array $parameters) {
68 
69  if (isset($parameters['unique_sub_dir'])) {
70  $this->unique_sub_dir = $parameters['unique_sub_dir'];
71  }
72 
73  return parent::setParameters($parameters);
74  }
75 }
__construct($directory_root= '')
Construct a temp disk filestore using the given directory root.
if(!array_key_exists($filename, $text_files)) $file
$params
Saves global plugin settings.
Definition: save.php:13
setParameters(array $parameters)
{}
getFilename()
Return the filename.
Definition: ElggFile.php:67
getFilenameOnFilestore(\ElggFile $file)
Get the filename as saved on disk for an object.
$filename