Allow jail wrappers to lazily initialize the source storage
This commit is contained in:
parent
2a2f1b9a00
commit
a1fd9d275f
|
@ -68,7 +68,7 @@ class Jail extends Wrapper {
|
||||||
* @return bool
|
* @return bool
|
||||||
*/
|
*/
|
||||||
public function mkdir($path) {
|
public function mkdir($path) {
|
||||||
return $this->storage->mkdir($this->getSourcePath($path));
|
return $this->getWrapperStorage()->mkdir($this->getSourcePath($path));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -78,7 +78,7 @@ class Jail extends Wrapper {
|
||||||
* @return bool
|
* @return bool
|
||||||
*/
|
*/
|
||||||
public function rmdir($path) {
|
public function rmdir($path) {
|
||||||
return $this->storage->rmdir($this->getSourcePath($path));
|
return $this->getWrapperStorage()->rmdir($this->getSourcePath($path));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -88,7 +88,7 @@ class Jail extends Wrapper {
|
||||||
* @return resource
|
* @return resource
|
||||||
*/
|
*/
|
||||||
public function opendir($path) {
|
public function opendir($path) {
|
||||||
return $this->storage->opendir($this->getSourcePath($path));
|
return $this->getWrapperStorage()->opendir($this->getSourcePath($path));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -98,7 +98,7 @@ class Jail extends Wrapper {
|
||||||
* @return bool
|
* @return bool
|
||||||
*/
|
*/
|
||||||
public function is_dir($path) {
|
public function is_dir($path) {
|
||||||
return $this->storage->is_dir($this->getSourcePath($path));
|
return $this->getWrapperStorage()->is_dir($this->getSourcePath($path));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -108,7 +108,7 @@ class Jail extends Wrapper {
|
||||||
* @return bool
|
* @return bool
|
||||||
*/
|
*/
|
||||||
public function is_file($path) {
|
public function is_file($path) {
|
||||||
return $this->storage->is_file($this->getSourcePath($path));
|
return $this->getWrapperStorage()->is_file($this->getSourcePath($path));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -119,7 +119,7 @@ class Jail extends Wrapper {
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
public function stat($path) {
|
public function stat($path) {
|
||||||
return $this->storage->stat($this->getSourcePath($path));
|
return $this->getWrapperStorage()->stat($this->getSourcePath($path));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -129,7 +129,7 @@ class Jail extends Wrapper {
|
||||||
* @return bool
|
* @return bool
|
||||||
*/
|
*/
|
||||||
public function filetype($path) {
|
public function filetype($path) {
|
||||||
return $this->storage->filetype($this->getSourcePath($path));
|
return $this->getWrapperStorage()->filetype($this->getSourcePath($path));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -140,7 +140,7 @@ class Jail extends Wrapper {
|
||||||
* @return int
|
* @return int
|
||||||
*/
|
*/
|
||||||
public function filesize($path) {
|
public function filesize($path) {
|
||||||
return $this->storage->filesize($this->getSourcePath($path));
|
return $this->getWrapperStorage()->filesize($this->getSourcePath($path));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -150,7 +150,7 @@ class Jail extends Wrapper {
|
||||||
* @return bool
|
* @return bool
|
||||||
*/
|
*/
|
||||||
public function isCreatable($path) {
|
public function isCreatable($path) {
|
||||||
return $this->storage->isCreatable($this->getSourcePath($path));
|
return $this->getWrapperStorage()->isCreatable($this->getSourcePath($path));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -160,7 +160,7 @@ class Jail extends Wrapper {
|
||||||
* @return bool
|
* @return bool
|
||||||
*/
|
*/
|
||||||
public function isReadable($path) {
|
public function isReadable($path) {
|
||||||
return $this->storage->isReadable($this->getSourcePath($path));
|
return $this->getWrapperStorage()->isReadable($this->getSourcePath($path));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -170,7 +170,7 @@ class Jail extends Wrapper {
|
||||||
* @return bool
|
* @return bool
|
||||||
*/
|
*/
|
||||||
public function isUpdatable($path) {
|
public function isUpdatable($path) {
|
||||||
return $this->storage->isUpdatable($this->getSourcePath($path));
|
return $this->getWrapperStorage()->isUpdatable($this->getSourcePath($path));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -180,7 +180,7 @@ class Jail extends Wrapper {
|
||||||
* @return bool
|
* @return bool
|
||||||
*/
|
*/
|
||||||
public function isDeletable($path) {
|
public function isDeletable($path) {
|
||||||
return $this->storage->isDeletable($this->getSourcePath($path));
|
return $this->getWrapperStorage()->isDeletable($this->getSourcePath($path));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -190,7 +190,7 @@ class Jail extends Wrapper {
|
||||||
* @return bool
|
* @return bool
|
||||||
*/
|
*/
|
||||||
public function isSharable($path) {
|
public function isSharable($path) {
|
||||||
return $this->storage->isSharable($this->getSourcePath($path));
|
return $this->getWrapperStorage()->isSharable($this->getSourcePath($path));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -201,7 +201,7 @@ class Jail extends Wrapper {
|
||||||
* @return int
|
* @return int
|
||||||
*/
|
*/
|
||||||
public function getPermissions($path) {
|
public function getPermissions($path) {
|
||||||
return $this->storage->getPermissions($this->getSourcePath($path));
|
return $this->getWrapperStorage()->getPermissions($this->getSourcePath($path));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -211,7 +211,7 @@ class Jail extends Wrapper {
|
||||||
* @return bool
|
* @return bool
|
||||||
*/
|
*/
|
||||||
public function file_exists($path) {
|
public function file_exists($path) {
|
||||||
return $this->storage->file_exists($this->getSourcePath($path));
|
return $this->getWrapperStorage()->file_exists($this->getSourcePath($path));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -221,7 +221,7 @@ class Jail extends Wrapper {
|
||||||
* @return int
|
* @return int
|
||||||
*/
|
*/
|
||||||
public function filemtime($path) {
|
public function filemtime($path) {
|
||||||
return $this->storage->filemtime($this->getSourcePath($path));
|
return $this->getWrapperStorage()->filemtime($this->getSourcePath($path));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -231,7 +231,7 @@ class Jail extends Wrapper {
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
public function file_get_contents($path) {
|
public function file_get_contents($path) {
|
||||||
return $this->storage->file_get_contents($this->getSourcePath($path));
|
return $this->getWrapperStorage()->file_get_contents($this->getSourcePath($path));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -242,7 +242,7 @@ class Jail extends Wrapper {
|
||||||
* @return bool
|
* @return bool
|
||||||
*/
|
*/
|
||||||
public function file_put_contents($path, $data) {
|
public function file_put_contents($path, $data) {
|
||||||
return $this->storage->file_put_contents($this->getSourcePath($path), $data);
|
return $this->getWrapperStorage()->file_put_contents($this->getSourcePath($path), $data);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -252,7 +252,7 @@ class Jail extends Wrapper {
|
||||||
* @return bool
|
* @return bool
|
||||||
*/
|
*/
|
||||||
public function unlink($path) {
|
public function unlink($path) {
|
||||||
return $this->storage->unlink($this->getSourcePath($path));
|
return $this->getWrapperStorage()->unlink($this->getSourcePath($path));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -263,7 +263,7 @@ class Jail extends Wrapper {
|
||||||
* @return bool
|
* @return bool
|
||||||
*/
|
*/
|
||||||
public function rename($path1, $path2) {
|
public function rename($path1, $path2) {
|
||||||
return $this->storage->rename($this->getSourcePath($path1), $this->getSourcePath($path2));
|
return $this->getWrapperStorage()->rename($this->getSourcePath($path1), $this->getSourcePath($path2));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -274,7 +274,7 @@ class Jail extends Wrapper {
|
||||||
* @return bool
|
* @return bool
|
||||||
*/
|
*/
|
||||||
public function copy($path1, $path2) {
|
public function copy($path1, $path2) {
|
||||||
return $this->storage->copy($this->getSourcePath($path1), $this->getSourcePath($path2));
|
return $this->getWrapperStorage()->copy($this->getSourcePath($path1), $this->getSourcePath($path2));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -285,7 +285,7 @@ class Jail extends Wrapper {
|
||||||
* @return resource
|
* @return resource
|
||||||
*/
|
*/
|
||||||
public function fopen($path, $mode) {
|
public function fopen($path, $mode) {
|
||||||
return $this->storage->fopen($this->getSourcePath($path), $mode);
|
return $this->getWrapperStorage()->fopen($this->getSourcePath($path), $mode);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -296,7 +296,7 @@ class Jail extends Wrapper {
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
public function getMimeType($path) {
|
public function getMimeType($path) {
|
||||||
return $this->storage->getMimeType($this->getSourcePath($path));
|
return $this->getWrapperStorage()->getMimeType($this->getSourcePath($path));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -308,7 +308,7 @@ class Jail extends Wrapper {
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
public function hash($type, $path, $raw = false) {
|
public function hash($type, $path, $raw = false) {
|
||||||
return $this->storage->hash($type, $this->getSourcePath($path), $raw);
|
return $this->getWrapperStorage()->hash($type, $this->getSourcePath($path), $raw);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -318,7 +318,7 @@ class Jail extends Wrapper {
|
||||||
* @return int
|
* @return int
|
||||||
*/
|
*/
|
||||||
public function free_space($path) {
|
public function free_space($path) {
|
||||||
return $this->storage->free_space($this->getSourcePath($path));
|
return $this->getWrapperStorage()->free_space($this->getSourcePath($path));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -328,7 +328,7 @@ class Jail extends Wrapper {
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
public function search($query) {
|
public function search($query) {
|
||||||
return $this->storage->search($query);
|
return $this->getWrapperStorage()->search($query);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -340,7 +340,7 @@ class Jail extends Wrapper {
|
||||||
* @return bool
|
* @return bool
|
||||||
*/
|
*/
|
||||||
public function touch($path, $mtime = null) {
|
public function touch($path, $mtime = null) {
|
||||||
return $this->storage->touch($this->getSourcePath($path), $mtime);
|
return $this->getWrapperStorage()->touch($this->getSourcePath($path), $mtime);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -351,7 +351,7 @@ class Jail extends Wrapper {
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
public function getLocalFile($path) {
|
public function getLocalFile($path) {
|
||||||
return $this->storage->getLocalFile($this->getSourcePath($path));
|
return $this->getWrapperStorage()->getLocalFile($this->getSourcePath($path));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -365,7 +365,7 @@ class Jail extends Wrapper {
|
||||||
* returning true for other changes in the folder is optional
|
* returning true for other changes in the folder is optional
|
||||||
*/
|
*/
|
||||||
public function hasUpdated($path, $time) {
|
public function hasUpdated($path, $time) {
|
||||||
return $this->storage->hasUpdated($this->getSourcePath($path), $time);
|
return $this->getWrapperStorage()->hasUpdated($this->getSourcePath($path), $time);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -377,9 +377,9 @@ class Jail extends Wrapper {
|
||||||
*/
|
*/
|
||||||
public function getCache($path = '', $storage = null) {
|
public function getCache($path = '', $storage = null) {
|
||||||
if (!$storage) {
|
if (!$storage) {
|
||||||
$storage = $this;
|
$storage = $this->getWrapperStorage();
|
||||||
}
|
}
|
||||||
$sourceCache = $this->storage->getCache($this->getSourcePath($path), $storage);
|
$sourceCache = $this->getWrapperStorage()->getCache($this->getSourcePath($path), $storage);
|
||||||
return new CacheJail($sourceCache, $this->rootPath);
|
return new CacheJail($sourceCache, $this->rootPath);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -390,7 +390,7 @@ class Jail extends Wrapper {
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
public function getOwner($path) {
|
public function getOwner($path) {
|
||||||
return $this->storage->getOwner($this->getSourcePath($path));
|
return $this->getWrapperStorage()->getOwner($this->getSourcePath($path));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -404,7 +404,7 @@ class Jail extends Wrapper {
|
||||||
if (!$storage) {
|
if (!$storage) {
|
||||||
$storage = $this;
|
$storage = $this;
|
||||||
}
|
}
|
||||||
return $this->storage->getWatcher($this->getSourcePath($path), $storage);
|
return $this->getWrapperStorage()->getWatcher($this->getSourcePath($path), $storage);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -414,7 +414,7 @@ class Jail extends Wrapper {
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
public function getETag($path) {
|
public function getETag($path) {
|
||||||
return $this->storage->getETag($this->getSourcePath($path));
|
return $this->getWrapperStorage()->getETag($this->getSourcePath($path));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -422,7 +422,7 @@ class Jail extends Wrapper {
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
public function getMetaData($path) {
|
public function getMetaData($path) {
|
||||||
return $this->storage->getMetaData($this->getSourcePath($path));
|
return $this->getWrapperStorage()->getMetaData($this->getSourcePath($path));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -432,7 +432,7 @@ class Jail extends Wrapper {
|
||||||
* @throws \OCP\Lock\LockedException
|
* @throws \OCP\Lock\LockedException
|
||||||
*/
|
*/
|
||||||
public function acquireLock($path, $type, ILockingProvider $provider) {
|
public function acquireLock($path, $type, ILockingProvider $provider) {
|
||||||
$this->storage->acquireLock($this->getSourcePath($path), $type, $provider);
|
$this->getWrapperStorage()->acquireLock($this->getSourcePath($path), $type, $provider);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -441,7 +441,7 @@ class Jail extends Wrapper {
|
||||||
* @param \OCP\Lock\ILockingProvider $provider
|
* @param \OCP\Lock\ILockingProvider $provider
|
||||||
*/
|
*/
|
||||||
public function releaseLock($path, $type, ILockingProvider $provider) {
|
public function releaseLock($path, $type, ILockingProvider $provider) {
|
||||||
$this->storage->releaseLock($this->getSourcePath($path), $type, $provider);
|
$this->getWrapperStorage()->releaseLock($this->getSourcePath($path), $type, $provider);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -450,7 +450,7 @@ class Jail extends Wrapper {
|
||||||
* @param \OCP\Lock\ILockingProvider $provider
|
* @param \OCP\Lock\ILockingProvider $provider
|
||||||
*/
|
*/
|
||||||
public function changeLock($path, $type, ILockingProvider $provider) {
|
public function changeLock($path, $type, ILockingProvider $provider) {
|
||||||
$this->storage->changeLock($this->getSourcePath($path), $type, $provider);
|
$this->getWrapperStorage()->changeLock($this->getSourcePath($path), $type, $provider);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -460,7 +460,7 @@ class Jail extends Wrapper {
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
public function resolvePath($path) {
|
public function resolvePath($path) {
|
||||||
return [$this->storage, $this->getSourcePath($path)];
|
return [$this->getWrapperStorage(), $this->getSourcePath($path)];
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -473,7 +473,7 @@ class Jail extends Wrapper {
|
||||||
if ($sourceStorage === $this) {
|
if ($sourceStorage === $this) {
|
||||||
return $this->copy($sourceInternalPath, $targetInternalPath);
|
return $this->copy($sourceInternalPath, $targetInternalPath);
|
||||||
}
|
}
|
||||||
return $this->storage->copyFromStorage($sourceStorage, $sourceInternalPath, $this->getSourcePath($targetInternalPath));
|
return $this->getWrapperStorage()->copyFromStorage($sourceStorage, $sourceInternalPath, $this->getSourcePath($targetInternalPath));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -486,6 +486,6 @@ class Jail extends Wrapper {
|
||||||
if ($sourceStorage === $this) {
|
if ($sourceStorage === $this) {
|
||||||
return $this->rename($sourceInternalPath, $targetInternalPath);
|
return $this->rename($sourceInternalPath, $targetInternalPath);
|
||||||
}
|
}
|
||||||
return $this->storage->moveFromStorage($sourceStorage, $sourceInternalPath, $this->getSourcePath($targetInternalPath));
|
return $this->getWrapperStorage()->moveFromStorage($sourceStorage, $sourceInternalPath, $this->getSourcePath($targetInternalPath));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue