citserver: regenerate secondary indices if the regenerate_secondary_indices config...
authorArt Cancro <ajc@citadel.org>
Mon, 17 Jul 2023 21:25:20 +0000 (12:25 -0900)
committerArt Cancro <ajc@citadel.org>
Mon, 17 Jul 2023 21:25:20 +0000 (12:25 -0900)
citadel/server/modules/upgrade/serv_upgrade.c
citadel/server/modules_init.h
citadel/server/server_main.c

index b06e19d19db198a9528005f7360725bb028b022a..2c662245f62a51d6bc3f9d4b722716c4212b15b5 100644 (file)
@@ -520,13 +520,6 @@ void pre_startup_upgrades(void) {
        if (oldver == 0) {
                create_default_admin_account();
        }
-
-       // Setting this key to nonzero causes the server to regenerate all data that can be derived
-       // from other tables: usersbynumber, directory, fulltext.
-       // The import utility (ctdlload) sets this key.
-       if (CtdlGetConfigInt("regenerate_secondary_indices") != 0) {
-               regenerate_secondary_indices();
-       }
 }
 
 
@@ -538,23 +531,19 @@ void post_startup_upgrades(void) {
 
        if (oldver < REV_LEVEL) {
                syslog(LOG_WARNING, "Running post-startup database upgrades.");
-       }
-       else {
-               return;
-       }
-
-       if ((oldver > 000) && (oldver < 912)) {
-               move_inet_addrs_from_vcards_to_user_records();
-       }
 
-       if ((oldver > 000) && (oldver < 922)) {
-               ProcessOldStyleAdjRefCountQueue();
-       }
-
-       if ((oldver > 000) && (oldver < 930)) {
-               migrate_inbox_filter_msgnums();
+               if ((oldver > 000) && (oldver < 912)) {
+                       move_inet_addrs_from_vcards_to_user_records();
+               }
+       
+               if ((oldver > 000) && (oldver < 922)) {
+                       ProcessOldStyleAdjRefCountQueue();
+               }
+       
+               if ((oldver > 000) && (oldver < 930)) {
+                       migrate_inbox_filter_msgnums();
+               }
        }
-
 }
 
 
index c29f74cd303dad98898cc5b8e5cd86fd50981cd9..85139ba154c1198cc074fe520852d5c8b0022cf3 100644 (file)
@@ -17,6 +17,7 @@
 extern size_t nSizErrmsg;
 void initialize_modules (int threading);
 void pre_startup_upgrades(void);
+void regenerate_secondary_indices(void);
 char *ctdl_module_init_control(void);
 char *ctdl_module_init_euidindex(void);
 char *ctdl_module_init_msgbase(void);
index 294df3a5ceb631031fdaff92bb47921cda88f156..4858c85ea54ca2d9e1f73c45144497ad656577b6 100644 (file)
@@ -228,6 +228,14 @@ int main(int argc, char **argv) {
        syslog(LOG_INFO, "main: upgrading modules");            // Run any upgrade entry points
        pre_startup_upgrades();
 
+       // Setting this key to nonzero causes the server to regenerate all data that can be derived
+       // from other tables: usersbynumber, directory, fulltext.
+       // The import utility (ctdlload) sets this key.
+       if (CtdlGetConfigInt("regenerate_secondary_indices") != 0) {
+               regenerate_secondary_indices();
+       }
+
+
        // Load the user for the masterCC or create them if they don't exist
        if (CtdlGetUser(&masterCC.user, "SYS_Citadel")) {
                // User doesn't exist. We can't use create user here as the user number needs to be 0