public function testSetOptionOverwrite() { $id = $this->addMount('/test', 'foo', 'bar', 100, DBConfigService::MOUNT_TYPE_ADMIN); $this->dbConfig->setOption($id, 'foo', 'bar'); $this->dbConfig->setOption($id, 'asd', '1'); $this->dbConfig->setOption($id, 'foo', 'qwerty'); $mount = $this->dbConfig->getMountById($id); $this->assertEquals(['foo' => 'qwerty', 'asd' => '1'], $mount['options']); }
public function testSetAuthBackend() { $id1 = $this->addMount('/test', 'foo', 'bar', 100, DBConfigService::MOUNT_TYPE_ADMIN); $id2 = $this->addMount('/foo', 'foo', 'bar', 100, DBConfigService::MOUNT_TYPE_ADMIN); $this->dbConfig->setAuthBackend($id1, 'none'); $mount = $this->dbConfig->getMountById($id1); $this->assertEquals('none', $mount['auth_backend']); // remains unchanged $mount = $this->dbConfig->getMountById($id2); $this->assertEquals('bar', $mount['auth_backend']); }
/** * Delete the storage with the given id. * * @param int $id storage id * * @throws NotFoundException if no storage was found with the given id */ public function removeStorage($id) { $existingMount = $this->dbConfig->getMountById($id); if (!is_array($existingMount)) { throw new NotFoundException('Storage with id "' . $id . '" not found'); } $this->dbConfig->removeMount($id); $deletedStorage = $this->getStorageConfigFromDBMount($existingMount); $this->triggerHooks($deletedStorage, Filesystem::signal_delete_mount); // delete oc_storages entries and oc_filecache try { $rustyStorageId = $this->getRustyStorageIdFromConfig($deletedStorage); \OC\Files\Cache\Storage::remove($rustyStorageId); } catch (\Exception $e) { // can happen either for invalid configs where the storage could not // be instantiated or whenever $user vars where used, in which case // the storage id could not be computed \OCP\Util::writeLog('files_external', 'Exception: "' . $e->getMessage() . '"', \OCP\Util::ERROR); } }