Ejemplo n.º 1
0
 /**
  * Get the personal mount points of the current user
  *
  * @return array
  *
  * @deprecated 8.2.0 use UserStoragesService::getStorages()
  */
 public static function getPersonalMountPoints()
 {
     $mountPoints = [];
     $service = self::$app->getContainer()->query('OCA\\Files_External\\Service\\UserStoragesService');
     foreach ($service->getStorages() as $storage) {
         $mountPoints[] = self::prepareMountPointEntry($storage, true);
     }
     return $mountPoints;
 }
Ejemplo n.º 2
0
 /**
  * Get storage id from the numeric storage id and set
  * it into the given options argument. Only do this
  * if there was no storage id set yet.
  *
  * This might also fail if a storage wasn't fully configured yet
  * and couldn't be mounted, in which case this will simply return false.
  *
  * @param array $options storage options
  *
  * @return bool true if the storage id was added, false otherwise
  */
 private static function addStorageId(&$options)
 {
     if (isset($options['storage_id'])) {
         return false;
     }
     $service = self::$app->getContainer()->query('OCA\\Files_External\\Service\\BackendService');
     $class = $service->getBackend($options['backend'])->getStorageClass();
     try {
         /** @var \OC\Files\Storage\Storage $storage */
         $storage = new $class($options['options']);
         // TODO: introduce StorageConfigException
     } catch (\Exception $e) {
         // storage might not be fully configured yet (ex: Dropbox)
         // note that storage instances aren't supposed to open any connections
         // in the constructor, so this exception is likely to be a config exception
         return false;
     }
     $options['storage_id'] = $storage->getCache()->getNumericStorageId();
     return true;
 }