Пример #1
0
 public function __construct($storage, $mountpoint, $arguments = null, $loader = null)
 {
     // first update the mount point before creating the parent
     $newMountPoint = $this->verifyMountPoint($arguments['share'], $arguments['user']);
     $absMountPoint = '/' . $arguments['user'] . '/files' . $newMountPoint;
     parent::__construct($storage, $absMountPoint, $arguments, $loader);
 }
Пример #2
0
 /**
  * @param string $storage
  * @param string $mountpoint
  * @param array|null $arguments
  * @param \OCP\Files\Storage\IStorageFactory $loader
  */
 public function __construct($storage, $mountpoint, $arguments = null, $loader = null)
 {
     $this->user = $arguments['user'];
     $this->recipientView = new View('/' . $this->user . '/files');
     $newMountPoint = $this->verifyMountPoint($arguments['share']);
     $absMountPoint = '/' . $this->user . '/files' . $newMountPoint;
     $arguments['ownerView'] = new View('/' . $arguments['share']['uid_owner'] . '/files');
     parent::__construct($storage, $absMountPoint, $arguments, $loader);
 }
Пример #3
0
 public function __construct($storage, $mountpoint, $arguments = null, $loader = null)
 {
     // first update the mount point before creating the parent
     $this->ownerPropagator = $arguments['propagator'];
     $this->recipientView = new View('/' . $arguments['user'] . '/files');
     $newMountPoint = $this->verifyMountPoint($arguments['share']);
     $absMountPoint = '/' . $arguments['user'] . '/files' . $newMountPoint;
     $arguments['ownerView'] = new View('/' . $arguments['share']['uid_owner'] . '/files');
     parent::__construct($storage, $absMountPoint, $arguments, $loader);
 }
Пример #4
0
 /**
  * @param string $storage
  * @param SharedMount[] $mountpoints
  * @param array|null $arguments
  * @param \OCP\Files\Storage\IStorageFactory $loader
  */
 public function __construct($storage, array $mountpoints, $arguments = null, $loader = null)
 {
     $this->user = $arguments['user'];
     $this->recipientView = new View('/' . $this->user . '/files');
     $this->share = $arguments['newShare'];
     $newMountPoint = $this->verifyMountPoint($this->share, $mountpoints);
     $absMountPoint = '/' . $this->user . '/files' . $newMountPoint;
     $arguments['ownerView'] = new View('/' . $this->share->getShareOwner() . '/files');
     parent::__construct($storage, $absMountPoint, $arguments, $loader);
 }
Пример #5
0
 /**
  * attach listeners to the scanner
  *
  * @param \OC\Files\Mount\MountPoint $mount
  */
 protected function attachListener($mount)
 {
     $scanner = $mount->getStorage()->getScanner();
     $emitter = $this;
     $scanner->listen('\\OC\\Files\\Cache\\Scanner', 'scanFile', function ($path) use($mount, $emitter) {
         $emitter->emit('\\OC\\Files\\Utils\\Scanner', 'scanFile', array($mount->getMountPoint() . $path));
     });
     $scanner->listen('\\OC\\Files\\Cache\\Scanner', 'scanFolder', function ($path) use($mount, $emitter) {
         $emitter->emit('\\OC\\Files\\Utils\\Scanner', 'scanFolder', array($mount->getMountPoint() . $path));
     });
     // propagate etag and mtimes when files are changed or removed
     $propagator = $this->propagator;
     $propagatorListener = function ($path) use($mount, $propagator) {
         $fullPath = Filesystem::normalizePath($mount->getMountPoint() . $path);
         $propagator->addChange($fullPath);
     };
     $scanner->listen('\\OC\\Files\\Cache\\Scanner', 'addToCache', $propagatorListener);
     $scanner->listen('\\OC\\Files\\Cache\\Scanner', 'removeFromCache', $propagatorListener);
 }
Пример #6
0
 public function testWrapperPriority()
 {
     $instance = new \OC\Files\Storage\StorageFactory();
     $mount = new MountPoint('\\OC\\Files\\Storage\\Temporary', '/foo', [[]], $instance);
     $instance->addStorageWrapper('dummy1', function ($mountPoint, IStorage $storage) {
         return new DummyWrapper(['storage' => $storage, 'data' => 1]);
     }, 1);
     $instance->addStorageWrapper('dummy2', function ($mountPoint, IStorage $storage) {
         return new DummyWrapper(['storage' => $storage, 'data' => 100]);
     }, 100);
     $instance->addStorageWrapper('dummy3', function ($mountPoint, IStorage $storage) {
         return new DummyWrapper(['storage' => $storage, 'data' => 50]);
     }, 50);
     /** @var \Test\Files\Storage\DummyWrapper $wrapped */
     $wrapped = $mount->getStorage();
     $this->assertInstanceOf('\\Test\\Files\\Storage\\DummyWrapper', $wrapped);
     $this->assertEquals(1, $wrapped->data);
     // lowest priority is applied last, called first
     $this->assertEquals(50, $wrapped->getWrapperStorage()->data);
     $this->assertEquals(100, $wrapped->getWrapperStorage()->getWrapperStorage()->data);
 }
Пример #7
0
 /**
  * attach listeners to the scanner
  *
  * @param \OC\Files\Mount\MountPoint $mount
  */
 protected function attachListener($mount)
 {
     $scanner = $mount->getStorage()->getScanner();
     $emitter = $this;
     $scanner->listen('\\OC\\Files\\Cache\\Scanner', 'scanFile', function ($path) use($mount, $emitter) {
         $emitter->emit('\\OC\\Files\\Utils\\Scanner', 'scanFile', array($mount->getMountPoint() . $path));
     });
     $scanner->listen('\\OC\\Files\\Cache\\Scanner', 'scanFolder', function ($path) use($mount, $emitter) {
         $emitter->emit('\\OC\\Files\\Utils\\Scanner', 'scanFolder', array($mount->getMountPoint() . $path));
     });
     $scanner->listen('\\OC\\Files\\Cache\\Scanner', 'postScanFile', function ($path) use($mount, $emitter) {
         $emitter->emit('\\OC\\Files\\Utils\\Scanner', 'postScanFile', array($mount->getMountPoint() . $path));
     });
     $scanner->listen('\\OC\\Files\\Cache\\Scanner', 'postScanFolder', function ($path) use($mount, $emitter) {
         $emitter->emit('\\OC\\Files\\Utils\\Scanner', 'postScanFolder', array($mount->getMountPoint() . $path));
     });
 }
Пример #8
0
 /**
  * @param string|\OC\Files\Storage\Storage $storage
  * @param string $mountpoint
  * @param array $options
  * @param \OCA\Files_Sharing\External\Manager $manager
  * @param \OC\Files\Storage\StorageFactory $loader
  */
 public function __construct($storage, $mountpoint, $options, $manager, $loader = null)
 {
     parent::__construct($storage, $mountpoint, $options, $loader);
     $this->manager = $manager;
 }
Пример #9
0
 /**
  * @param UserStoragesService $storagesService
  * @param int $storageId
  * @param string|\OC\Files\Storage\Storage $storage
  * @param string $mountpoint
  * @param array $arguments (optional) configuration for the storage backend
  * @param \OCP\Files\Storage\IStorageFactory $loader
  * @param array $mountOptions mount specific options
  */
 public function __construct(UserStoragesService $storagesService, $storageId, $storage, $mountpoint, $arguments = null, $loader = null, $mountOptions = null)
 {
     parent::__construct($storage, $mountpoint, $arguments, $loader, $mountOptions);
     $this->storagesService = $storagesService;
     $this->storageId = $storageId;
 }
Пример #10
0
 /**
  * @param MountPoint $mount
  */
 public function addMount(MountPoint $mount)
 {
     $this->mounts[$mount->getMountPoint()] = $mount;
 }