Filesystem

class OC\Files\Filesystem
Source:lib/private/Files/Filesystem.php#73

Constants

CLASSNAME = OC_Filesystem
classname which used for hooks handling
used as signalclass in OC_Hooks::emit()
Source:lib/private/Files/Filesystem.php#96
signal_rename = rename
signalname emitted before file renaming
Source:lib/private/Files/Filesystem.php#104
signal_post_rename = post_rename
signal emitted after file renaming
Source:lib/private/Files/Filesystem.php#112
signal_create = create
signal emitted before file/dir creation
Source:lib/private/Files/Filesystem.php#120
signal_post_create = post_create
signal emitted after file/dir creation
Source:lib/private/Files/Filesystem.php#128
signal_copy = copy
signal emits before file/dir copy
Source:lib/private/Files/Filesystem.php#137
signal_post_copy = post_copy
signal emits after file/dir copy
Source:lib/private/Files/Filesystem.php#145
signal_write = write
signal emits before file/dir save
Source:lib/private/Files/Filesystem.php#153
signal_post_write = post_write
signal emits after file/dir save
Source:lib/private/Files/Filesystem.php#160
signal_update = update
signal emitted before file/dir update
Source:lib/private/Files/Filesystem.php#168
signal_post_update = post_update
signal emitted after file/dir update
Source:lib/private/Files/Filesystem.php#176
signal_read = read
signal emits when reading file/dir
Source:lib/private/Files/Filesystem.php#183
signal_delete = delete
signal emits when removing file/dir
Source:lib/private/Files/Filesystem.php#190
signal_param_path = path
parameters definitions for signals
Source:lib/private/Files/Filesystem.php#195
signal_param_oldpath = oldpath
Source:lib/private/Files/Filesystem.php#196
signal_param_newpath = newpath
Source:lib/private/Files/Filesystem.php#197
signal_param_run = run
run - changing this flag to false in hook handler will cancel event
Source:lib/private/Files/Filesystem.php#202
signal_create_mount = create_mount
Source:lib/private/Files/Filesystem.php#204
signal_delete_mount = delete_mount
Source:lib/private/Files/Filesystem.php#205
signal_param_mount_type = mounttype
Source:lib/private/Files/Filesystem.php#206
signal_param_users = users
Source:lib/private/Files/Filesystem.php#207

Properties

public property OC\Files\Filesystem::$loaded
Source:lib/private/Files/Filesystem.php#80

Methods

public static OC\Files\Filesystem::logWarningWhenAddingStorageWrapper($shouldLog)
Source:

lib/private/Files/Filesystem.php#222

Parameters:
  • $shouldLog (bool)
Returns:

bool previous value

public static OC\Files\Filesystem::addStorageWrapper($wrapperName, $wrapper, $priority=50)
Source:

lib/private/Files/Filesystem.php#233

Parameters:
  • $wrapperName (string)
  • $wrapper (callable)
  • $priority (int)
public static OC\Files\Filesystem::getLoader()
Returns the storage factory
Source:lib/private/Files/Filesystem.php#253
Returns:\OCP\Files\Storage\IStorageFactory
public static OC\Files\Filesystem::getMountManager($user="")
Returns the mount manager
Source:lib/private/Files/Filesystem.php#265
Returns:\OC\Files\Mount\Manager
public static OC\Files\Filesystem::getMountPoint($path)
get the mountpoint of the storage object for a path
( note: because a storage is not always mounted inside the fakeroot, the
returned mountpoint is relative to the absolute root of the filesystem
and doesn’t take the chroot into account )
Source:

lib/private/Files/Filesystem.php#281

Parameters:
  • $path (string)
Returns:

string

public static OC\Files\Filesystem::getMountPoints($path)
get a list of all mount points in a directory
Source:

lib/private/Files/Filesystem.php#299

Parameters:
  • $path (string)
Returns:

string[]

public static OC\Files\Filesystem::getStorage($mountPoint)
get the storage mounted at $mountPoint
Source:

lib/private/Files/Filesystem.php#317

Parameters:
  • $mountPoint (string)
Returns:

\OC\Files\Storage\Storage | null

public static OC\Files\Filesystem::getMountByStorageId($id)
Source:

lib/private/Files/Filesystem.php#329

Parameters:
  • $id (string)
Returns:

\OC\Files\Mount\MountPoint[]

public static OC\Files\Filesystem::getMountByNumericId($id)
Source:

lib/private/Files/Filesystem.php#340

Parameters:
  • $id (int)
Returns:

\OC\Files\Mount\MountPoint[]

public static OC\Files\Filesystem::resolvePath($path)
resolve a path to a storage and internal path
Source:

lib/private/Files/Filesystem.php#353

Parameters:
  • $path (string)
Returns:

array an array consisting of the storage and the internal path

public static OC\Files\Filesystem::init($user, $root)
Source:lib/private/Files/Filesystem.php#365
public static OC\Files\Filesystem::initMountManager()
Source:lib/private/Files/Filesystem.php#384
public static OC\Files\Filesystem::initMountPoints($user="")
Initialize system and personal mount points for a user
Source:

lib/private/Files/Filesystem.php#396

Parameters:
  • $user (string)
Throws:

\OC\User\NoUserException if the user is not available

public static OC\Files\Filesystem::getView()
get the default filesystem view
Source:lib/private/Files/Filesystem.php#497
Returns:\OC\Files\View
public static OC\Files\Filesystem::tearDown()
tear down the filesystem, removing all storage providers
Source:lib/private/Files/Filesystem.php#504
public static OC\Files\Filesystem::getRoot()
get the relative path of the root data directory for the current user
Source:lib/private/Files/Filesystem.php#516
Returns:string Returns path like /admin/files
public static OC\Files\Filesystem::clearMounts()
clear all mounts and storage backends
Source:lib/private/Files/Filesystem.php#526
public static OC\Files\Filesystem::mount($class, $arguments, $mountpoint)
mount an \OC\Files\Storage\Storage in our virtual filesystem
Source:

lib/private/Files/Filesystem.php#540

Parameters:
public static OC\Files\Filesystem::getLocalFile($path)
return the path to a local version of the file
we need this because we can’t know if a file is stored local or not from
outside the filestorage and for some purposes a local file is needed
Source:

lib/private/Files/Filesystem.php#556

Parameters:
  • $path (string)
Returns:

string

public static OC\Files\Filesystem::getLocalFolder($path)
Source:

lib/private/Files/Filesystem.php#564

Parameters:
  • $path (string)
Returns:

string

public static OC\Files\Filesystem::getLocalPath($path)
return path to file which reflects one visible in browser
Source:

lib/private/Files/Filesystem.php#574

Parameters:
  • $path (string)
Returns:

string

public static OC\Files\Filesystem::isValidPath($path)
check if the requested path is valid
Source:

lib/private/Files/Filesystem.php#589

Parameters:
  • $path (string)
Returns:

bool

public static OC\Files\Filesystem::isBlacklisted($data)
checks if a file is blacklisted for storage in the filesystem
Listens to write and rename hooks
Source:

lib/private/Files/Filesystem.php#606

Parameters:
  • $data (array) from hook
public static OC\Files\Filesystem::isFileBlacklisted($filename)
Source:

lib/private/Files/Filesystem.php#623

Parameters:
  • $filename (string)
Returns:

bool

public static OC\Files\Filesystem::isIgnoredDir($dir)
check if the directory should be ignored when scanning
NOTE: the special directories . and .
. would cause never ending recursion
Source:

lib/private/Files/Filesystem.php#638

Parameters:
  • $dir (string)
Returns:

bool

public static OC\Files\Filesystem::mkdir($path)
following functions are equivalent to their php builtin equivalents for arguments/return values.
Source:lib/private/Files/Filesystem.php#648
public static OC\Files\Filesystem::rmdir($path)
Source:lib/private/Files/Filesystem.php#652
public static OC\Files\Filesystem::is_dir($path)
Source:lib/private/Files/Filesystem.php#656
public static OC\Files\Filesystem::is_file($path)
Source:lib/private/Files/Filesystem.php#660
public static OC\Files\Filesystem::stat($path)
Source:lib/private/Files/Filesystem.php#664
public static OC\Files\Filesystem::filetype($path)
Source:lib/private/Files/Filesystem.php#668
public static OC\Files\Filesystem::filesize($path)
Source:lib/private/Files/Filesystem.php#672
public static OC\Files\Filesystem::readfile($path)
Source:lib/private/Files/Filesystem.php#676
public static OC\Files\Filesystem::isCreatable($path)
Source:lib/private/Files/Filesystem.php#680
public static OC\Files\Filesystem::isReadable($path)
Source:lib/private/Files/Filesystem.php#684
public static OC\Files\Filesystem::isUpdatable($path)
Source:lib/private/Files/Filesystem.php#688
public static OC\Files\Filesystem::isDeletable($path)
Source:lib/private/Files/Filesystem.php#692
public static OC\Files\Filesystem::isSharable($path)
Source:lib/private/Files/Filesystem.php#696
public static OC\Files\Filesystem::file_exists($path)
Source:lib/private/Files/Filesystem.php#700
public static OC\Files\Filesystem::filemtime($path)
Source:lib/private/Files/Filesystem.php#704
public static OC\Files\Filesystem::touch($path, $mtime=null)
Source:lib/private/Files/Filesystem.php#708
public static OC\Files\Filesystem::file_get_contents($path)
Source:lib/private/Files/Filesystem.php#715
Returns:string
public static OC\Files\Filesystem::file_put_contents($path, $data)
Source:lib/private/Files/Filesystem.php#719
Source:lib/private/Files/Filesystem.php#723
public static OC\Files\Filesystem::rename($path1, $path2)
Source:lib/private/Files/Filesystem.php#727
public static OC\Files\Filesystem::copy($path1, $path2)
Source:lib/private/Files/Filesystem.php#731
public static OC\Files\Filesystem::fopen($path, $mode)
Source:lib/private/Files/Filesystem.php#735
public static OC\Files\Filesystem::toTmpFile($path)
Source:lib/private/Files/Filesystem.php#742
Returns:string
public static OC\Files\Filesystem::fromTmpFile($tmpFile, $path)
Source:lib/private/Files/Filesystem.php#746
public static OC\Files\Filesystem::getMimeType($path)
Source:lib/private/Files/Filesystem.php#750
public static OC\Files\Filesystem::hash($type, $path, $raw=false)
Source:lib/private/Files/Filesystem.php#754
public static OC\Files\Filesystem::free_space($path=/)
Source:lib/private/Files/Filesystem.php#758
public static OC\Files\Filesystem::search($query)
Source:lib/private/Files/Filesystem.php#762
public static OC\Files\Filesystem::searchByMime($query)
Source:

lib/private/Files/Filesystem.php#769

Parameters:
  • $query (string)
public static OC\Files\Filesystem::searchByTag($tag, $userId)
Source:

lib/private/Files/Filesystem.php#778

Parameters:
  • $tag (string | int) name or tag id
  • $userId (string) owner of the tags
Returns:

\OC\Files\FileInfo[] array or file info

public static OC\Files\Filesystem::hasUpdated($path, $time)
check if a file or folder has been updated since $time
Source:

lib/private/Files/Filesystem.php#789

Parameters:
  • $path (string)
  • $time (int)
Returns:

bool

public static OC\Files\Filesystem::normalizePath($path, $stripTrailingSlash=true, $isAbsolutePath=false, $keepUnicode=false)
Fix common problems with a file path
Source:

lib/private/Files/Filesystem.php#802

Parameters:
  • $path (string)
  • $stripTrailingSlash (bool) whether to strip the trailing slash
  • $isAbsolutePath (bool) whether the given path is absolute
  • $keepUnicode (bool) true to disable unicode normalization
Returns:

string

public static OC\Files\Filesystem::getFileInfo($path, $includeMountPoints=true)
get the filesystem info
Source:

lib/private/Files/Filesystem.php#863

Parameters:
  • $path (string)
  • $includeMountPoints (bool) whether to add mountpoint sizes,

defaults to true

Returns:

\OC\Files\FileInfo | bool False if file does not exist

public static OC\Files\Filesystem::putFileInfo($path, $data)
change file metadata
Source:

lib/private/Files/Filesystem.php#876

Parameters:
  • $path (string)
  • $data (array)
Returns:

int returns the fileid of the updated file

public static OC\Files\Filesystem::getDirectoryContent($directory, $mimetype_filter="")
get the content of a directory
Source:

lib/private/Files/Filesystem.php#887

Parameters:
  • $directory (string) path under datadirectory
  • $mimetype_filter (string) limit returned content to this mimetype or mimepart
Returns:

\OC\Files\FileInfo[]

public static OC\Files\Filesystem::getPath($id)
Get the path of a file by id
Note that the resulting path is not guaranteed to be unique for the id, multiple paths can point to the same file
Source:

lib/private/Files/Filesystem.php#900

Parameters:
  • $id (int)
Throws:

\OCP\Files\NotFoundException

Returns:

string

public static OC\Files\Filesystem::getOwner($path)
Get the owner for a file or folder
Source:

lib/private/Files/Filesystem.php#910

Parameters:
  • $path (string)
Returns:

string

public static OC\Files\Filesystem::getETag($path)
get the ETag for a file or folder
Source:

lib/private/Files/Filesystem.php#920

Parameters:
  • $path (string)
Returns:

string