36 if (!$directory_root) {
60 $ls = strrpos($fullname,
'/');
65 $path = substr($fullname, 0, $ls);
67 if ((
$mode ===
'read') && (!file_exists($fullname))) {
75 }
catch (\Exception $e) {
95 return fopen($fullname,
$mode);
146 public function delete(
\ElggFile $file,
bool $follow_symlinks =
true):
bool {
147 $filename = $this->getFilenameOnFilestore($file);
179 public function tell($f): int|false {
190 public function eof($f): bool {
202 return filesize($this->getFilenameOnFilestore($file));
218 if (!empty($file->guid) && $file->
getSubtype() ===
'file') {
237 return Paths::sanitize($this->dir_root . $dir . $file->
getFilename(),
false);
248 return file_get_contents($file->getFilenameOnFilestore());
259 if (!$file->getFilename()) {
264 $real_filename = $this->getFilenameOnFilestore($file);
270 return file_exists($real_filename);
282 if (file_exists($dirroot)) {
287 if (!@mkdir($dirroot, 0755,
true)) {
288 $last_error = error_get_last();
295 throw new IOException(
"Couldn't create directory: {$dirroot}{$message}");
307 'dir_root' => $this->dir_root,
319 if (isset($parameters[
'dir_root'])) {
320 $this->dir_root = Paths::sanitize($parameters[
'dir_root']);
$mode
Configure site maintenance mode.
return[ 'admin/delete_admin_notices'=>['access'=> 'admin'], 'admin/menu/save'=>['access'=> 'admin'], 'admin/plugins/activate'=>['access'=> 'admin'], 'admin/plugins/activate_all'=>['access'=> 'admin'], 'admin/plugins/deactivate'=>['access'=> 'admin'], 'admin/plugins/deactivate_all'=>['access'=> 'admin'], 'admin/plugins/set_priority'=>['access'=> 'admin'], 'admin/security/security_txt'=>['access'=> 'admin'], 'admin/security/settings'=>['access'=> 'admin'], 'admin/security/regenerate_site_secret'=>['access'=> 'admin'], 'admin/site/cache/invalidate'=>['access'=> 'admin'], 'admin/site/flush_cache'=>['access'=> 'admin'], 'admin/site/icons'=>['access'=> 'admin'], 'admin/site/set_maintenance_mode'=>['access'=> 'admin'], 'admin/site/set_robots'=>['access'=> 'admin'], 'admin/site/theme'=>['access'=> 'admin'], 'admin/site/unlock_upgrade'=>['access'=> 'admin'], 'admin/site/settings'=>['access'=> 'admin'], 'admin/upgrade'=>['access'=> 'admin'], 'admin/upgrade/reset'=>['access'=> 'admin'], 'admin/user/ban'=>['access'=> 'admin'], 'admin/user/bulk/ban'=>['access'=> 'admin'], 'admin/user/bulk/delete'=>['access'=> 'admin'], 'admin/user/bulk/unban'=>['access'=> 'admin'], 'admin/user/bulk/validate'=>['access'=> 'admin'], 'admin/user/change_email'=>['access'=> 'admin'], 'admin/user/delete'=>['access'=> 'admin'], 'admin/user/login_as'=>['access'=> 'admin'], 'admin/user/logout_as'=>[], 'admin/user/makeadmin'=>['access'=> 'admin'], 'admin/user/resetpassword'=>['access'=> 'admin'], 'admin/user/removeadmin'=>['access'=> 'admin'], 'admin/user/unban'=>['access'=> 'admin'], 'admin/user/validate'=>['access'=> 'admin'], 'annotation/delete'=>[], 'avatar/upload'=>[], 'comment/save'=>[], 'diagnostics/download'=>['access'=> 'admin'], 'entity/chooserestoredestination'=>[], 'entity/delete'=>[], 'entity/mute'=>[], 'entity/restore'=>[], 'entity/subscribe'=>[], 'entity/trash'=>[], 'entity/unmute'=>[], 'entity/unsubscribe'=>[], 'login'=>['access'=> 'logged_out'], 'logout'=>[], 'notifications/mute'=>['access'=> 'public'], 'plugins/settings/remove'=>['access'=> 'admin'], 'plugins/settings/save'=>['access'=> 'admin'], 'plugins/usersettings/save'=>[], 'register'=>['access'=> 'logged_out', 'middleware'=>[\Elgg\Router\Middleware\RegistrationAllowedGatekeeper::class,],], 'river/delete'=>[], 'settings/notifications'=>[], 'settings/notifications/subscriptions'=>[], 'user/changepassword'=>['access'=> 'public'], 'user/requestnewpassword'=>['access'=> 'public'], 'useradd'=>['access'=> 'admin'], 'usersettings/save'=>[], 'widgets/add'=>[], 'widgets/delete'=>[], 'widgets/move'=>[], 'widgets/save'=>[],]
if(! $entity instanceof \ElggUser) $data
getSubtype()
Get the entity subtype.
getFilename()
Return the filename.
Exception thrown if a value does not adhere to a defined valid data domain.
An IO Exception, throw when an IO Exception occurs.
Exception thrown if an argument is not of the expected type.
A filestore that uses disk as storage.
read($f, int $length, int $offset=0)
Read data from a file.
getParameters()
Returns a list of attributes to save to the database when saving the \ElggFile object using this file...
eof($f)
Tests for end of file on a file pointer.
getFileSize(\ElggFile $file)
Returns the file size of an \ElggFile file.
close($f)
Close a file pointer.
seek($f, int $position)
Seek to the specified position.
__construct($directory_root='')
Construct a disk filestore using the given directory root.
getFilenameOnFilestore(\ElggFile $file)
Get the filename as saved on disk for an \ElggFile object.
makeDirectoryRoot($dirroot)
Create a directory $dirroot.
exists(\ElggFile $file)
Tests if an \ElggFile file exists.
grabFile(\ElggFile $file)
Returns the contents of the \ElggFile file.
setParameters(array $parameters)
Sets parameters that should be saved to database.
tell($f)
Return the current location of the internal pointer.
write($f, $data)
Write data to a file.
const BUCKET_SIZE
Number of entries per matrix dir.
open(\ElggFile $file, string $mode)
Open a file for reading, writing, or both.
This class defines the interface for all elgg data repositories.
seek($f, int $position)
Seek a given position within a file handle.
Find Elgg and project paths.
static sanitize($path, $append_slash=true)
Sanitize file paths ensuring that they begin and end with slashes etc.
_elgg_services()
Get the global service provider.
elgg_extract($key, $array, $default=null, bool $strict=true)
Checks for $array[$key] and returns its value if it exists, else returns $default.
if(! $item instanceof \ElggEntity) $length
if(parse_url(elgg_get_site_url(), PHP_URL_PATH) !=='/') if(file_exists(elgg_get_root_path() . 'robots.txt'))
Set robots.txt.