diff options
author | Robin Appelman <icewind@owncloud.com> | 2015-12-15 13:24:30 +0100 |
---|---|---|
committer | Vincent Petry <pvince81@owncloud.com> | 2016-01-08 11:54:31 +0100 |
commit | ab549970cadc8557f55a32d802c608ddf44238c8 (patch) | |
tree | d376e6c0cd98812d44b7184b6f60c83547b146a8 /apps/files_external/service | |
parent | 88c4cba1f52a63da78da56e50ac9f22a643a5be0 (diff) | |
download | nextcloud-server-ab549970cadc8557f55a32d802c608ddf44238c8.tar.gz nextcloud-server-ab549970cadc8557f55a32d802c608ddf44238c8.zip |
fix setting mountpoint and auth backend of external storages
Diffstat (limited to 'apps/files_external/service')
-rw-r--r-- | apps/files_external/service/dbconfigservice.php | 28 | ||||
-rw-r--r-- | apps/files_external/service/storagesservice.php | 8 |
2 files changed, 36 insertions, 0 deletions
diff --git a/apps/files_external/service/dbconfigservice.php b/apps/files_external/service/dbconfigservice.php index 76f7052c4ed..810a57963f8 100644 --- a/apps/files_external/service/dbconfigservice.php +++ b/apps/files_external/service/dbconfigservice.php @@ -214,6 +214,34 @@ class DBConfigService { /** * @param int $mountId + * @param string $newMountPoint + */ + public function setMountPoint($mountId, $newMountPoint) { + $builder = $this->connection->getQueryBuilder(); + + $query = $builder->update('external_mounts') + ->set('mount_point', $builder->createNamedParameter($newMountPoint)) + ->where($builder->expr()->eq('mount_id', $builder->createNamedParameter($mountId, \PDO::PARAM_INT))); + + $query->execute(); + } + + /** + * @param int $mountId + * @param string $newAuthBackend + */ + public function setAuthBackend($mountId, $newAuthBackend) { + $builder = $this->connection->getQueryBuilder(); + + $query = $builder->update('external_mounts') + ->set('auth_backend', $builder->createNamedParameter($newAuthBackend)) + ->where($builder->expr()->eq('mount_id', $builder->createNamedParameter($mountId, \PDO::PARAM_INT))); + + $query->execute(); + } + + /** + * @param int $mountId * @param string $key * @param string $value */ diff --git a/apps/files_external/service/storagesservice.php b/apps/files_external/service/storagesservice.php index 97f79c13324..dd28c415cea 100644 --- a/apps/files_external/service/storagesservice.php +++ b/apps/files_external/service/storagesservice.php @@ -392,6 +392,14 @@ abstract class StoragesService { $this->dbConfig->setOption($id, $key, $value); } + if ($updatedStorage->getMountPoint() !== $oldStorage->getMountPoint()) { + $this->dbConfig->setMountPoint($id, $updatedStorage->getMountPoint()); + } + + if ($updatedStorage->getAuthMechanism()->getIdentifier() !== $oldStorage->getAuthMechanism()->getIdentifier()) { + $this->dbConfig->setAuthBackend($id, $updatedStorage->getAuthMechanism()->getIdentifier()); + } + $this->triggerChangeHooks($oldStorage, $updatedStorage); return $this->getStorage($id); |