Merge "Merge branch 'stable-2.14'"
This commit is contained in:
@@ -28,9 +28,11 @@ The program will produce errors if there are accounts that have the
|
|||||||
same local username, but with different case. In this case the local
|
same local username, but with different case. In this case the local
|
||||||
username for these accounts is not converted to lower case.
|
username for these accounts is not converted to lower case.
|
||||||
|
|
||||||
This task can run in the background concurrently to the server if the
|
After all usernames have been migrated, the link:pgm-reindex.html[
|
||||||
database is MySQL or PostgreSQL. If the database is H2, this task
|
reindex] program is automatically invoked to reindex all accounts.
|
||||||
must be run by itself.
|
|
||||||
|
This task cannot run in the background concurrently to the server;
|
||||||
|
it must be run by itself.
|
||||||
|
|
||||||
== OPTIONS
|
== OPTIONS
|
||||||
|
|
||||||
|
|||||||
@@ -23,12 +23,14 @@ import com.google.gerrit.server.account.externalids.DisabledExternalIdCache;
|
|||||||
import com.google.gerrit.server.account.externalids.ExternalId;
|
import com.google.gerrit.server.account.externalids.ExternalId;
|
||||||
import com.google.gerrit.server.account.externalids.ExternalIds;
|
import com.google.gerrit.server.account.externalids.ExternalIds;
|
||||||
import com.google.gerrit.server.account.externalids.ExternalIdsBatchUpdate;
|
import com.google.gerrit.server.account.externalids.ExternalIdsBatchUpdate;
|
||||||
|
import com.google.gerrit.server.index.account.AccountSchemaDefinitions;
|
||||||
import com.google.gerrit.server.schema.SchemaVersionCheck;
|
import com.google.gerrit.server.schema.SchemaVersionCheck;
|
||||||
import com.google.inject.AbstractModule;
|
import com.google.inject.AbstractModule;
|
||||||
import com.google.inject.Inject;
|
import com.google.inject.Inject;
|
||||||
import com.google.inject.Injector;
|
import com.google.inject.Injector;
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.Locale;
|
import java.util.Locale;
|
||||||
|
import org.eclipse.jgit.lib.ProgressMonitor;
|
||||||
import org.eclipse.jgit.lib.TextProgressMonitor;
|
import org.eclipse.jgit.lib.TextProgressMonitor;
|
||||||
|
|
||||||
/** Converts the local username for all accounts to lower case */
|
/** Converts the local username for all accounts to lower case */
|
||||||
@@ -69,8 +71,10 @@ public class LocalUsernamesToLowerCase extends SiteProgram {
|
|||||||
|
|
||||||
externalIdsBatchUpdate.commit("Convert local usernames to lower case");
|
externalIdsBatchUpdate.commit("Convert local usernames to lower case");
|
||||||
monitor.endTask();
|
monitor.endTask();
|
||||||
|
|
||||||
|
int exitCode = reindexAccounts();
|
||||||
manager.stop();
|
manager.stop();
|
||||||
return 0;
|
return exitCode;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void convertLocalUserToLowerCase(ExternalId extId) {
|
private void convertLocalUserToLowerCase(ExternalId extId) {
|
||||||
@@ -89,4 +93,17 @@ public class LocalUsernamesToLowerCase extends SiteProgram {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private int reindexAccounts() throws Exception {
|
||||||
|
monitor.beginTask("Reindex accounts", ProgressMonitor.UNKNOWN);
|
||||||
|
String[] reindexArgs = {
|
||||||
|
"--site-path", getSitePath().toString(), "--index", AccountSchemaDefinitions.NAME
|
||||||
|
};
|
||||||
|
System.out.println("Migration complete, reindexing accounts with:");
|
||||||
|
System.out.println(" reindex " + String.join(" ", reindexArgs));
|
||||||
|
Reindex reindexPgm = new Reindex();
|
||||||
|
int exitCode = reindexPgm.main(reindexArgs);
|
||||||
|
monitor.endTask();
|
||||||
|
return exitCode;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -36,9 +36,10 @@ public class AccountSchemaDefinitions extends SchemaDefinitions<AccountState> {
|
|||||||
|
|
||||||
static final Schema<AccountState> V5 = schema(V4, AccountField.PREFERRED_EMAIL);
|
static final Schema<AccountState> V5 = schema(V4, AccountField.PREFERRED_EMAIL);
|
||||||
|
|
||||||
|
public static final String NAME = "accounts";
|
||||||
public static final AccountSchemaDefinitions INSTANCE = new AccountSchemaDefinitions();
|
public static final AccountSchemaDefinitions INSTANCE = new AccountSchemaDefinitions();
|
||||||
|
|
||||||
private AccountSchemaDefinitions() {
|
private AccountSchemaDefinitions() {
|
||||||
super("accounts", AccountState.class);
|
super(NAME, AccountState.class);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user