Пример #1
0
 /**
  * Add new storage to the configuration
  *
  * @param StorageConfig $newStorage storage attributes
  *
  * @return StorageConfig storage config, with added id
  */
 public function addStorage(StorageConfig $newStorage)
 {
     $allStorages = $this->readConfig();
     $configId = $this->dbConfig->addMount($newStorage->getMountPoint(), $newStorage->getBackend()->getIdentifier(), $newStorage->getAuthMechanism()->getIdentifier(), $newStorage->getPriority(), $this->getType());
     $newStorage->setId($configId);
     foreach ($newStorage->getApplicableUsers() as $user) {
         $this->dbConfig->addApplicable($configId, DBConfigService::APPLICABLE_TYPE_USER, $user);
     }
     foreach ($newStorage->getApplicableGroups() as $group) {
         $this->dbConfig->addApplicable($configId, DBConfigService::APPLICABLE_TYPE_GROUP, $group);
     }
     foreach ($newStorage->getBackendOptions() as $key => $value) {
         $this->dbConfig->setConfig($configId, $key, $value);
     }
     foreach ($newStorage->getMountOptions() as $key => $value) {
         $this->dbConfig->setOption($configId, $key, $value);
     }
     if (count($newStorage->getApplicableUsers()) === 0 && count($newStorage->getApplicableGroups()) === 0) {
         $this->dbConfig->addApplicable($configId, DBConfigService::APPLICABLE_TYPE_GLOBAL, null);
     }
     // add new storage
     $allStorages[$configId] = $newStorage;
     $this->triggerHooks($newStorage, Filesystem::signal_create_mount);
     $newStorage->setStatus(StorageNotAvailableException::STATUS_SUCCESS);
     return $newStorage;
 }
Пример #2
0
 public function addMount($mountPoint, $storageBackend, $authBackend, $priority, $type)
 {
     $id = parent::addMount($mountPoint, $storageBackend, $authBackend, $priority, $type);
     // TODO: Change the autogenerated stub
     $this->mountIds[] = $id;
     return $id;
 }
 private function addMount($mountPoint, $storageBackend, $authBackend, $priority, $type)
 {
     $id = $this->dbConfig->addMount($mountPoint, $storageBackend, $authBackend, $priority, $type);
     $this->mounts[] = $id;
     return $id;
 }