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))) {
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();
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();
eof($f)
Tests for end of file on a file pointer.
close($f)
Close a file pointer.
const BUCKET_SIZE
Number of entries per matrix dir.
if(!array_key_exists($filename, $text_files)) $file
$mode
Configure site maintenance mode.
getFilenameOnFilestore(\ElggFile $file)
Get the filename as saved on disk for an object.
read($f, $length, $offset=0)
Read data from a file.
open(\ElggFile $file, $mode)
Open a file for reading, writing, or both.
getFileSize(\ElggFile $file)
Returns the file size of an file.
get_dir_size($dir, $total_size=0)
Get the size of the specified directory.
$guid
Removes an admin notice.
__construct($directory_root="")
Construct a disk filestore using the given directory root.
makeFileMatrix($guid)
Deprecated methods.
getFilenameOnFilestore()
Return the filename of this file as it is/will be stored on the filestore, which may be different to ...
makeDirectoryRoot($dirroot)
Create a directory $dirroot.
write($f, $data)
Write data to a file.
getFilename()
Return the filename.
elgg_deprecated_notice($msg, $dep_version, $backtrace_level=1)
Log a notice about deprecated use of a function, view, etc.
getSize($prefix, $container_guid)
Returns the size of all data stored under a directory in the disk store.
grabFile(\ElggFile $file)
Returns the contents of the file.
_elgg_services(\Elgg\Di\ServiceProvider $services=null)
Get the global service provider.
setParameters(array $parameters)
Sets parameters that should be saved to database.
exists(\ElggFile $file)
Tests if an file exists.
tell($f)
Return the current location of the internal pointer.
seek($f, $position)
Seek to the specified position.
getParameters()
Returns a list of attributes to save to the database when saving the object using this file store...
get_entity($guid)
Loads and returns an entity object from a guid.