IStorage

interface OCP\Files\Storage\IStorage
Provide a common interface to all different storage options
All paths passed to the storage are relative to the storage and should NOT have a leading slash.
Source:lib/public/Files/Storage/IStorage.php#52

Methods

public OCP\Files\Storage\IStorage::__construct($parameters)
$parameters is a free form array with the configuration options needed to construct the storage
Source:

lib/public/Files/Storage/IStorage.php#59

Parameters:
  • $parameters (array)
Since:

9.0.0

public OCP\Files\Storage\IStorage::getId()
Get the identifier for the storage,
the returned id should be the same for every storage object that is created with the same parameters
and two storage objects with the same id should refer to two storages that display the same files.
Source:lib/public/Files/Storage/IStorage.php#69
Returns:string
Since:9.0.0
public OCP\Files\Storage\IStorage::mkdir($path)
implementations need to implement a recursive mkdir
Source:

lib/public/Files/Storage/IStorage.php#79

Parameters:
  • $path (string)
Returns:

bool

Since:

9.0.0

public OCP\Files\Storage\IStorage::rmdir($path)
Source:

lib/public/Files/Storage/IStorage.php#88

Parameters:
  • $path (string)
Returns:

bool

Since:

9.0.0

public OCP\Files\Storage\IStorage::opendir($path)
Source:

lib/public/Files/Storage/IStorage.php#97

Parameters:
  • $path (string)
Returns:

resource | bool

Since:

9.0.0

public OCP\Files\Storage\IStorage::is_dir($path)
Source:

lib/public/Files/Storage/IStorage.php#106

Parameters:
  • $path (string)
Returns:

bool

Since:

9.0.0

public OCP\Files\Storage\IStorage::is_file($path)
Source:

lib/public/Files/Storage/IStorage.php#115

Parameters:
  • $path (string)
Returns:

bool

Since:

9.0.0

public OCP\Files\Storage\IStorage::stat($path)
only the following keys are required in the result: size and mtime
Source:

lib/public/Files/Storage/IStorage.php#125

Parameters:
  • $path (string)
Returns:

array | bool

Since:

9.0.0

public OCP\Files\Storage\IStorage::filetype($path)
Source:

lib/public/Files/Storage/IStorage.php#134

Parameters:
  • $path (string)
Returns:

string | bool

Since:

9.0.0

public OCP\Files\Storage\IStorage::filesize($path)
The result for filesize when called on a folder is required to be 0
Source:

lib/public/Files/Storage/IStorage.php#144

Parameters:
  • $path (string)
Returns:

int | bool

Since:

9.0.0

public OCP\Files\Storage\IStorage::isCreatable($path)
check if a file can be created in $path
Source:

lib/public/Files/Storage/IStorage.php#153

Parameters:
  • $path (string)
Returns:

bool

Since:

9.0.0

public OCP\Files\Storage\IStorage::isReadable($path)
check if a file can be read
Source:

lib/public/Files/Storage/IStorage.php#162

Parameters:
  • $path (string)
Returns:

bool

Since:

9.0.0

public OCP\Files\Storage\IStorage::isUpdatable($path)
check if a file can be written to
Source:

lib/public/Files/Storage/IStorage.php#171

Parameters:
  • $path (string)
Returns:

bool

Since:

9.0.0

public OCP\Files\Storage\IStorage::isDeletable($path)
check if a file can be deleted
Source:

lib/public/Files/Storage/IStorage.php#180

Parameters:
  • $path (string)
Returns:

bool

Since:

9.0.0

public OCP\Files\Storage\IStorage::isSharable($path)
check if a file can be shared
Source:

lib/public/Files/Storage/IStorage.php#189

Parameters:
  • $path (string)
Returns:

bool

Since:

9.0.0

public OCP\Files\Storage\IStorage::getPermissions($path)
get the full permissions of a path.
Should return a combination of the PERMISSION_ constants defined in lib/public/constants.php
Source:

lib/public/Files/Storage/IStorage.php#199

Parameters:
  • $path (string)
Returns:

int

Since:

9.0.0

public OCP\Files\Storage\IStorage::file_exists($path)
Source:

lib/public/Files/Storage/IStorage.php#208

Parameters:
  • $path (string)
Returns:

bool

Since:

9.0.0

public OCP\Files\Storage\IStorage::filemtime($path)
Source:

lib/public/Files/Storage/IStorage.php#217

Parameters:
  • $path (string)
Returns:

int | bool

Since:

9.0.0

public OCP\Files\Storage\IStorage::file_get_contents($path)
Source:

lib/public/Files/Storage/IStorage.php#226

Parameters:
  • $path (string)
Returns:

string | bool

Since:

9.0.0

public OCP\Files\Storage\IStorage::file_put_contents($path, $data)
Source:

lib/public/Files/Storage/IStorage.php#236

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

int | bool

Since:

9.0.0

Source:

lib/public/Files/Storage/IStorage.php#245

Parameters:
  • $path (string)
Returns:

bool

Since:

9.0.0

public OCP\Files\Storage\IStorage::rename($path1, $path2)
Source:

lib/public/Files/Storage/IStorage.php#255

Parameters:
  • $path1 (string)
  • $path2 (string)
Returns:

bool

Since:

9.0.0

public OCP\Files\Storage\IStorage::copy($path1, $path2)
Source:

lib/public/Files/Storage/IStorage.php#265

Parameters:
  • $path1 (string)
  • $path2 (string)
Returns:

bool

Since:

9.0.0

public OCP\Files\Storage\IStorage::fopen($path, $mode)
Source:

lib/public/Files/Storage/IStorage.php#275

Parameters:
  • $path (string)
  • $mode (string)
Returns:

resource | bool

Since:

9.0.0

public OCP\Files\Storage\IStorage::getMimeType($path)
get the mimetype for a file or folder
The mimetype for a folder is required to be “httpd/unix-directory”
Source:

lib/public/Files/Storage/IStorage.php#285

Parameters:
  • $path (string)
Returns:

string | bool

Since:

9.0.0

public OCP\Files\Storage\IStorage::hash($type, $path, $raw=false)
Source:

lib/public/Files/Storage/IStorage.php#296

Parameters:
  • $type (string)
  • $path (string)
  • $raw (bool)
Returns:

string | bool

Since:

9.0.0

public OCP\Files\Storage\IStorage::free_space($path)
Source:

lib/public/Files/Storage/IStorage.php#305

Parameters:
  • $path (string)
Returns:

int | bool

Since:

9.0.0

public OCP\Files\Storage\IStorage::touch($path, $mtime=null)
If the backend does not support the operation, false should be returned
Source:

lib/public/Files/Storage/IStorage.php#316

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

bool

Since:

9.0.0

public OCP\Files\Storage\IStorage::getLocalFile($path)
get the path to a local version of the file.
The local version of the file can be temporary and doesn’t have to be persistent across requests
Source:

lib/public/Files/Storage/IStorage.php#326

Parameters:
  • $path (string)
Returns:

string | bool

Since:

9.0.0

public OCP\Files\Storage\IStorage::hasUpdated($path, $time)
check if a file or folder has been updated since $time
Source:

lib/public/Files/Storage/IStorage.php#339

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

bool

Since:

9.0.0 hasUpdated for folders should return at least true if a file inside the folder is add, removed or renamed. returning true for other changes in the folder is optional

public OCP\Files\Storage\IStorage::getETag($path)
get the ETag for a file or folder
Source:

lib/public/Files/Storage/IStorage.php#348

Parameters:
  • $path (string)
Returns:

string | bool

Since:

9.0.0

public OCP\Files\Storage\IStorage::isLocal()
Returns whether the storage is local, which means that files
are stored on the local filesystem instead of remotely.
Calling getLocalFile() for local storages should always
return the local files, whereas for non-local storages
it might return a temporary file.
Source:lib/public/Files/Storage/IStorage.php#360
Returns:bool true if the files are stored locally, false otherwise
Since:9.0.0
public OCP\Files\Storage\IStorage::instanceOfStorage($class)
Check if the storage is an instance of $class or is a wrapper for a storage that is an instance of $class
Source:

lib/public/Files/Storage/IStorage.php#369

Parameters:
  • $class (string)
Returns:

bool

Since:

9.0.0

public OCP\Files\Storage\IStorage::getDirectDownload($path)
A custom storage implementation can return an url for direct download of a give file.
For now the returned array can hold the parameter url - in future more attributes might follow.
Source:

lib/public/Files/Storage/IStorage.php#380

Parameters:
  • $path (string)
Returns:

array | bool

Since:

9.0.0

public OCP\Files\Storage\IStorage::verifyPath($path, $fileName)
Source:

lib/public/Files/Storage/IStorage.php#389

Parameters:
  • $path (string) the path of the target folder
  • $fileName (string) the name of the file itself
Returns:

void

Throws:

\OCP\Files\InvalidPathException

Since:

9.0.0

public OCP\Files\Storage\IStorage::copyFromStorage($sourceStorage, $sourceInternalPath, $targetInternalPath)
Source:

lib/public/Files/Storage/IStorage.php#398

Parameters:
Returns:

bool

Since:

9.0.0

public OCP\Files\Storage\IStorage::moveFromStorage($sourceStorage, $sourceInternalPath, $targetInternalPath)
Source:

lib/public/Files/Storage/IStorage.php#407

Parameters:
Returns:

bool

Since:

9.0.0

public OCP\Files\Storage\IStorage::test()
Test a storage for availability
Source:lib/public/Files/Storage/IStorage.php#415
Since:9.0.0
Returns:bool
public OCP\Files\Storage\IStorage::getAvailability()
Source:lib/public/Files/Storage/IStorage.php#421
Since:9.0.0
Returns:array [ available, last_checked ]
public OCP\Files\Storage\IStorage::setAvailability($isAvailable)
Source:

lib/public/Files/Storage/IStorage.php#427

Parameters:
  • $isAvailable (bool)
Since:

9.0.0

public OCP\Files\Storage\IStorage::getOwner($path)
Source:

lib/public/Files/Storage/IStorage.php#433

Parameters:
  • $path (string) path for which to retrieve the owner
Since:

9.0.0

public OCP\Files\Storage\IStorage::getCache()
Source:lib/public/Files/Storage/IStorage.php#439
Returns:\OCP\Files\Cache\ICache
Since:9.0.0
public OCP\Files\Storage\IStorage::getPropagator()
Source:lib/public/Files/Storage/IStorage.php#445
Returns:\OCP\Files\Cache\IPropagator
Since:9.0.0
public OCP\Files\Storage\IStorage::getScanner()
Source:lib/public/Files/Storage/IStorage.php#451
Returns:\OCP\Files\Cache\IScanner
Since:9.0.0
public OCP\Files\Storage\IStorage::getUpdater()
Source:lib/public/Files/Storage/IStorage.php#457
Returns:\OCP\Files\Cache\IUpdater
Since:9.0.0
public OCP\Files\Storage\IStorage::getWatcher()
Source:lib/public/Files/Storage/IStorage.php#463
Returns:\OCP\Files\Cache\IWatcher
Since:9.0.0