/** * Construct a Home storage instance * @param array $arguments array with "user" containing the * storage owner and "legacy" containing "true" if the storage is * a legacy storage with "local::" URL instead of the new "home::" one. */ public function __construct($arguments) { $this->user = $arguments['user']; $datadir = $this->user->getHome(); if (isset($arguments['legacy']) && $arguments['legacy']) { // legacy home id (<= 5.0.12) $this->id = 'local::' . $datadir . '/'; } else { $this->id = 'home::' . $this->user->getUID(); } parent::__construct(array('datadir' => $datadir)); }
/** * @param $handle * @return mixed */ public function readdir($handle) { $fsLocal = new Storage\Local(array('datadir' => '/')); return $fsLocal->readdir($handle); }
public function touch($path, $mtime = null) { return $this->storage->touch($path, $mtime); }
/** * @param \OCP\Files\Storage $sourceStorage * @param string $sourceInternalPath * @param string $targetInternalPath * @return bool */ public function moveFromStorage(\OCP\Files\Storage $sourceStorage, $sourceInternalPath, $targetInternalPath) { if ($sourceStorage->instanceOfStorage('\\OC\\Files\\Storage\\Local')) { /** * @var \OC\Files\Storage\Local $sourceStorage */ $rootStorage = new Local(['datadir' => '/']); return $rootStorage->rename($sourceStorage->getSourcePath($sourceInternalPath), $this->getSourcePath($targetInternalPath)); } else { return parent::moveFromStorage($sourceStorage, $sourceInternalPath, $targetInternalPath); } }