Beispiel #1
0
 /**
  * create the storage that is mounted
  *
  * @return \OC\Files\Storage\Storage
  */
 private function createStorage()
 {
     if (class_exists($this->class)) {
         try {
             return $this->loader->load($this->mountPoint, $this->class, $this->arguments);
         } catch (\Exception $exception) {
             \OC_Log::write('core', $exception->getMessage(), \OC_Log::ERROR);
             return null;
         }
     } else {
         \OC_Log::write('core', 'storage backend ' . $this->class . ' not found', \OC_Log::ERROR);
         return null;
     }
 }
Beispiel #2
0
 public function testWrapper()
 {
     $test = $this;
     $wrapper = function ($mountPoint, $storage) use(&$test) {
         $test->assertEquals('/foo/', $mountPoint);
         $test->assertInstanceOf('\\OC\\Files\\Storage\\Storage', $storage);
         return new Wrapper(array('storage' => $storage));
     };
     $loader = new Loader();
     $loader->addStorageWrapper('test_wrapper', $wrapper);
     $storage = $this->getMockBuilder('\\OC\\Files\\Storage\\Temporary')->disableOriginalConstructor()->getMock();
     $mount = new \OC\Files\Mount\Mount($storage, '/foo', array(), $loader);
     $this->assertInstanceOf('\\OC\\Files\\Storage\\Wrapper\\Wrapper', $mount->getStorage());
 }
Beispiel #3
0
 /**
  * create the storage that is mounted
  *
  * @return \OC\Files\Storage\Storage
  */
 private function createStorage()
 {
     if (class_exists($this->class)) {
         try {
             return $this->loader->load($this->mountPoint, $this->class, $this->arguments);
         } catch (\Exception $exception) {
             if ($this->mountPoint === '/') {
                 // the root storage could not be initialized, show the user!
                 throw new \Exception('The root storage could not be initialized. Please contact your local administrator.', $exception->getCode(), $exception);
             } else {
                 \OC_Log::write('core', $exception->getMessage(), \OC_Log::ERROR);
             }
             return null;
         }
     } else {
         \OC_Log::write('core', 'storage backend ' . $this->class . ' not found', \OC_Log::ERROR);
         return null;
     }
 }