31 if ($directory_root) {
32 $this->dir_root = $directory_root;
34 $this->dir_root = $CONFIG->dataroot;
56 $ls = strrpos($fullname,
"/");
61 $path = substr($fullname, 0, $ls);
63 if ((
$mode !=
'write') && (!file_exists($fullname))) {
71 }
catch (Exception
$e) {
72 elgg_log(
"Couldn't create directory: $path",
'WARNING');
88 $msg =
"Unrecognized file mode '" .
$mode .
"'";
92 return fopen($fullname,
$mode);
105 return fwrite($f,
$data);
122 return fread($f, $length);
214 $msg =
"File " . $file->
getFilename() .
" (file guid:" . $file->guid .
") is missing an owner!";
225 return $this->dir_root . $dir . $file->
getFilename();
261 public function getSize($prefix, $container_guid) {
262 if ($container_guid) {
281 elgg_deprecated_notice(
'ElggDiskFilestore::make_directory_root() is deprecated by ::makeDirectoryRoot()', 1.8);
296 if (!file_exists($dirroot)) {
297 if (!@mkdir($dirroot, 0700,
true)) {
298 throw new IOException(
"Could not make " . $dirroot);
312 return array(
"dir_root" => $this->dir_root);
323 if (isset($parameters[
'dir_root'])) {
324 $this->dir_root = $parameters[
'dir_root'];
347 elgg_deprecated_notice(
'ElggDiskFilestore::make_file_matrix() is deprecated by Elgg_EntityDirLocator', 1.8);
366 elgg_deprecated_notice(
'ElggDiskFilestore::user_file_matrix() is deprecated by Elgg_EntityDirLocator', 1.8);
385 private function mb_str_split(
$string, $charset =
'UTF8') {
388 if (is_callable(
'mb_substr')) {
393 $array[] = mb_substr(
$string, 0, 1, $charset);
415 elgg_deprecated_notice(
'ElggDiskFilestore::makeFileMatrix() is deprecated by Elgg_EntityDirLocator', 1.9);
423 return $dir->getPath();
eof($f)
Tests for end of file on a file pointer.
close($f)
Close a file pointer.
get_dir_size($dir, $totalsize=0)
Get the size of the specified directory.
const BUCKET_SIZE
Number of entries per matrix dir.
$mode
Configure site maintenance mode.
make_directory_root($dirroot)
Create a directory $dirroot.
read($f, $length, $offset=0)
Read data from a file.
user_file_matrix($guid)
Construct a filename matrix.
make_file_matrix($identifier)
Deprecated methods.
$guid
Removes an admin notice.
__construct($directory_root="")
Construct a disk filestore using the given directory root.
open(ElggFile $file, $mode)
Open a file for reading, writing, or both.
makeFileMatrix($guid)
Construct a file path matrix for an entity.
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.
getFilenameOnFilestore(ElggFile $file)
Get the filename as saved on disk for an ElggFile object.
write($f, $data)
Write data to a file.
exists(ElggFile $file)
Tests if an ElggFile file exists.
getFilename()
Return the filename.
elgg_deprecated_notice($msg, $dep_version, $backtrace_level=1)
Sends a notice about deprecated use of a function, view, etc.
elgg global
Pointer to the global context.
getSize($prefix, $container_guid)
Returns the size of all data stored under a directory in the disk store.
setParameters(array $parameters)
Sets parameters that should be saved to database.
getFileSize(ElggFile $file)
Returns the file size of an ElggFile file.
elgg_log($message, $level= 'NOTICE')
Display or log a message.
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 ElggFile object using this file ...
grabFile(ElggFile $file)
Returns the contents of the ElggFile file.
elgg_get_logged_in_user_guid()
Return the current logged in user by guid.
get_entity($guid)
Loads and returns an entity object from a guid.