// guesses about what kind of data format changes need to be applied, and
// we apply them transparently.
//
-// Copyright (c) 1987-2022 by the citadel.org team
+// Copyright (c) 1987-2023 by the citadel.org team
//
// This program is open source software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License version 3.
#include "../../control.h"
#include "../../database.h"
#include "../../user_ops.h"
+#include "../../makeuserkey.h"
#include "../../msgbase.h"
#include "serv_upgrade.h"
#include "../../euidindex.h"
}
-// Back end processing function for reindex_uids()
-void reindex_uids_backend(char *username, void *data) {
-
- struct ctdluser us;
-
- if (CtdlGetUserLock(&us, username) == 0) {
- syslog(LOG_DEBUG, "Processing <%s> (%d)", us.fullname, us.uid);
- if (us.uid == CTDLUID) {
- us.uid = NATIVE_AUTH_UID;
- }
- CtdlPutUserLock(&us);
- if ((us.uid > 0) && (us.uid != NATIVE_AUTH_UID)) { // if non-native auth , index by uid
- StrBuf *claimed_id = NewStrBuf();
- StrBufPrintf(claimed_id, "uid:%d", us.uid);
- attach_extauth(&us, claimed_id);
- FreeStrBuf(&claimed_id);
- }
- }
-}
-
-
-// Build extauth index of all users with uid-based join (system auth, LDAP auth)
-// Also changes all users with a uid of CTDLUID to NATIVE_AUTH_UID (-1)
-void reindex_uids(void) {
- syslog(LOG_WARNING, "upgrade: reindexing and applying uid changes");
- ForEachUser(reindex_uids_backend, NULL);
- return;
-}
-
-
// These accounts may have been created by code that ran between mid 2008 and early 2011.
// If present they are no longer in use and may be deleted.
void remove_thread_users(void) {
CtdlSetConfigInt("c_enable_fulltext", 1);
}
- if (oldver < 652) {
- CtdlSetConfigInt("c_auto_cull", 1);
- }
-
if (oldver < 725) {
CtdlSetConfigInt("c_xmpp_c2s_port", 5222);
CtdlSetConfigInt("c_xmpp_s2s_port", 5269);
}
+void regenerate_secondary_indices(void) {
+ syslog(LOG_INFO, "regenerate_secondary_indices has been activated.");
+
+ rebuild_usersbynumber();
+ rebuild_euid_index();
+ CtdlRebuildDirectoryIndex();
+ // we also need to trigger the fulltext foo
+
+ CtdlSetConfigInt("regenerate_secondary_indices", 0);
+}
+
+
// Based on the server version number reported by the existing database,
// run in-place data format upgrades until everything is up to date.
void pre_startup_upgrades(void) {
syslog(LOG_EMERG, "This database is too old to be upgraded. Citadel server will exit.");
exit(EXIT_FAILURE);
}
- if ((oldver > 000) && (oldver < 913)) {
- reindex_uids();
- }
if ((oldver > 000) && (oldver < 659)) {
rebuild_euid_index();
}
CtdlPutRoom(&QRoom);
}
}
-
if ((oldver > 000) && (oldver < 902)) {
ingest_old_roominfo_and_roompic_files();
}
+ if ((oldver > 000) && (oldver < 973)) { // This was the old extauth table.
+ cdb_trunc(CDB_UNUSED1); // We will do this better someday.
+ }
+ if ((oldver > 000) && (oldver < 975)) { // An unrepairable defect was found in this table.
+ cdb_trunc(CDB_USETABLE); // We have to discard it and start over.
+ }
CtdlSetConfigInt("MM_hosted_upgrade_level", REV_LEVEL);
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();
+ }
}
-
}