public function testDeleteMount()
 {
     $id = $this->addMount('/test', 'foo', 'bar', 100, DBConfigService::MOUNT_TYPE_ADMIN);
     $this->dbConfig->removeMount($id);
     $mount = $this->dbConfig->getMountById($id);
     $this->assertEquals(null, $mount);
 }
示例#2
0
 /**
  * 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);
     }
 }