X-Git-Url: http://the.earth.li/gitweb/?a=blobdiff_plain;f=onak.c;h=ad86cb04bef6ff829c78034030ae314ccdb005f4;hb=99e631a4e7aa7a22d7c9ff0797f4ce690decd92a;hp=575e7bcbafdaa67501fd295e2804f3c4348bb0c8;hpb=ec38d8bd7e8a66645e75e3d6c8b9dadb5dd85ec7;p=onak.git diff --git a/onak.c b/onak.c index 575e7bc..ad86cb0 100644 --- a/onak.c +++ b/onak.c @@ -149,6 +149,7 @@ void usage(void) { puts("\tgetphoto - retrieves the first photoid on the given key and" " dumps to\n\t stdout"); puts("\tindex - search for a key and list it"); + puts("\treindex - retrieve and re-store a key in the backend db"); puts("\tvindex - search for a key and list it and its signatures"); } @@ -425,6 +426,16 @@ int main(int argc, char *argv[]) } else { puts("Key not found"); } + } else if (!strcmp("reindex", argv[optind])) { + dbctx->starttrans(dbctx); + if (dbctx->fetch_key_id(dbctx, keyid, &keys, true)) { + dbctx->delete_key(dbctx, keyid, true); + cleankeys(keys); + dbctx->store_key(dbctx, keys, true, false); + } else { + puts("Key not found"); + } + dbctx->endtrans(dbctx); } dbctx->cleanupdb(dbctx); } else {