29 if ($directory_root) {
30 $this->dir_root = $directory_root;
54 $ls = strrpos($fullname,
"/");
59 $path = substr($fullname, 0, $ls);
61 if ((
$mode ===
'read') && (!file_exists($fullname))) {
69 }
catch (Exception
$e) {
70 _elgg_services()->logger->warn(
"Couldn't create directory: $path");
86 $msg =
"Unrecognized file mode '" .
$mode .
"'";
87 throw new \InvalidParameterException($msg);
90 return fopen($fullname,
$mode);
103 return fwrite($f,
$data);
216 $msg =
"File " .
$file->getFilename() .
" (file guid:" .
$file->guid .
") is missing an owner!";
217 throw new \InvalidParameterException($msg);
227 return $this->dir_root . $dir .
$file->getFilename();
238 return file_get_contents(
$file->getFilenameOnFilestore());
249 if (!
$file->getFilename()) {
281 if (!file_exists($dirroot)) {
282 if (!@mkdir($dirroot, 0700,
true)) {
283 throw new \IOException(
"Could not make " . $dirroot);
297 return array(
"dir_root" => $this->dir_root);
308 if (isset($parameters[
'dir_root'])) {
309 $this->dir_root = $parameters[
'dir_root'];
331 elgg_deprecated_notice(
'\ElggDiskFilestore::makeFileMatrix() is deprecated by \Elgg\EntityDirLocator', 1.9);
338 $dir = new \Elgg\EntityDirLocator(
$guid);
339 return $dir->getPath();
$mode
Configure site maintenance mode.
getParameters()
Returns a list of attributes to save to the database when saving the \ElggFile object using this file...
seek($f, $position)
Seek to the specified position.
getSize($prefix, $container_guid)
Returns the size of all data stored under a directory in the disk store.
close($f)
Close a file pointer.
getFilenameOnFilestore(\ElggFile $file)
Get the filename as saved on disk for an \ElggFile object.
__construct($directory_root="")
Construct a disk filestore using the given directory root.
tell($f)
Return the current location of the internal pointer.
exists(\ElggFile $file)
Tests if an \ElggFile file exists.
eof($f)
Tests for end of file on a file pointer.
const BUCKET_SIZE
Number of entries per matrix dir.
setParameters(array $parameters)
Sets parameters that should be saved to database.
makeFileMatrix($guid)
Deprecated methods.
makeDirectoryRoot($dirroot)
Create a directory $dirroot.
grabFile(\ElggFile $file)
Returns the contents of the \ElggFile file.
read($f, $length, $offset=0)
Read data from a file.
write($f, $data)
Write data to a file.
open(\ElggFile $file, $mode)
Open a file for reading, writing, or both.
getFileSize(\ElggFile $file)
Returns the file size of an \ElggFile file.
$guid
Removes an admin notice.
elgg_deprecated_notice($msg, $dep_version, $backtrace_level=1)
Log a notice about deprecated use of a function, view, etc.
_elgg_services(\Elgg\Di\ServiceProvider $services=null)
Get the global service provider.
get_entity($guid)
Loads and returns an entity object from a guid.
get_dir_size($dir, $total_size=0)
Get the size of the specified directory.
if(!array_key_exists($filename, $text_files)) $file