void cache_indexes_collection(char *coll) { int i; size_t *cached; cached = indexcachescached; for (i = 0; i <= NrOfDataDirectorys; i++) { char *types[] = { "Main", "acl_allow", "acl_denied", "attributes", NULL, }; char path[2048]; char name[2048]; int j; for (j = 0; types[j] != NULL; j++) { GetFilePathForIindex(path, name, i, types[j], "aa", coll); cache_indexes_handle(name, cached); GetFilePathForIDictionary(path, name, i, types[j], "aa", coll); cache_indexes_handle(name, cached); } } }
int bbdocument_deletecoll(char collection[]) { int LotNr; int i; char FilePath[512]; char IndexPath[512]; char DictionaryPath[512]; FILE *fh; debug("Deleting collection: \"%s\"\n",collection); LotNr = 1; while((fh =lotOpenFileNoCasheByLotNr(LotNr,"reposetory","r",'s',collection)) != NULL) { GetFilPathForLot(FilePath,LotNr,collection); fclose(fh); rrmdir(FilePath); ++LotNr; } for (i=0; i < 64; i++) { GetFilePathForIindex(FilePath,IndexPath,i,"Main","aa",collection); #ifdef DEBUG printf("FilePath: %s\nIndexPath: %s\n",FilePath,IndexPath); #endif if ((unlink(IndexPath) != 1) && (errno != ENOENT)) { //ENOENT=No such file or directory. Viser ikke feil hvis filen ikke fantes. Det er helt normalt perror("remove IndexPath"); } GetFilePathForIDictionary(FilePath,DictionaryPath,i,"Main","aa",collection); #ifdef DEBUG printf("FilePath: %s\nDictionaryPath: %s\n",FilePath,DictionaryPath); #endif if ((unlink(DictionaryPath) != 0) && (errno != ENOENT)) {//ENOENT=No such file or directory. Viser ikke feil hvis filen ikke fantes. Det er helt normalt perror("remove DictionaryPath"); } } //sletter i userToSubname.db struct userToSubnameDbFormat userToSubnameDb; if (!userToSubname_open(&userToSubnameDb,'w')) { printf("can't open users.db\n"); } else { userToSubname_deletecol(&userToSubnameDb,collection); userToSubname_close(&userToSubnameDb); } return 1; }