Merge "Add certificates expiration date checker"
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..2069abc
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,5 @@
+.idea
+*iml
+/lib
+/out
+.DS_Store
\ No newline at end of file
diff --git a/admin/warm-cache-1.0.groovy b/admin/warm-cache-1.0.groovy
index eb1df2c..02adccb 100644
--- a/admin/warm-cache-1.0.groovy
+++ b/admin/warm-cache-1.0.groovy
@@ -13,15 +13,13 @@
// limitations under the License.
import com.google.gerrit.common.data.GlobalCapability
+import com.google.gerrit.entities.AccountGroup
import com.google.gerrit.sshd.*
import com.google.gerrit.extensions.annotations.*
import com.google.gerrit.server.project.*
import com.google.gerrit.server.account.*
import com.google.gerrit.server.IdentifiedUser
-import com.google.gerrit.reviewdb.client.AccountGroup
-import com.google.gerrit.reviewdb.server.ReviewDb
import com.google.inject.*
-import org.kohsuke.args4j.*
abstract class BaseSshCommand extends SshCommand {
@@ -39,9 +37,6 @@
@Inject
ProjectCache cache
- @Inject
- GroupCache groupCache
-
public void run() {
println "Loading project list ..."
def start = System.currentTimeMillis()
@@ -75,8 +70,8 @@
private HashSet<AccountGroup.UUID> allGroupsUUIDs() {
def allGroupsUuids = new HashSet<AccountGroup.UUID>()
for (project in cache.all()) {
- def groupUuids = cache.get(project)?.getConfig()?.getAllGroupUUIDs()
- if (groupUuids != null) { allGroupsUuids.addAll(groupUuids) }
+ def groupUuids = cache.get(project).stream().flatMap { it.config.allGroupUUIDs.stream() }
+ allGroupsUuids.addAll(groupUuids.collect())
}
allGroupsUuids.addAll(groupIncludeCache.allExternalMembers())
return allGroupsUuids;
@@ -90,12 +85,11 @@
def groupsLoaded = 0
for (groupUuid in allGroupsUuids) {
- groupIncludeCache.subgroupsOf(groupUuid)
groupIncludeCache.parentGroupsOf(groupUuid)
def group = groupCache.get(groupUuid)
- if(group != null) {
- groupCache.get(group.getNameKey())
- groupCache.get(group.getId())
+ group.ifPresent { internalGroup ->
+ groupCache.get(internalGroup.getNameKey())
+ groupCache.get(internalGroup.getId())
}
groupsLoaded++
@@ -117,16 +111,16 @@
AccountCache cache
@Inject
- Provider<ReviewDb> db
+ Accounts accounts
public void run() {
println "Loading accounts ..."
def start = System.currentTimeMillis()
- def allAccounts = db.get().accounts().all()
+ def allAccounts = accounts.all()
def loaded = 0
for (account in allAccounts) {
- cache.get(account.accountId)
+ cache.get(account.account().id())
loaded++
if (loaded%1000==0) {
println "$loaded accounts"
@@ -148,13 +142,13 @@
public void run() {
println "Loading groups ..."
def start = System.currentTimeMillis()
- def allAccounts = db.get().accounts().all()
+ def allAccounts = accounts.all()
def loaded = 0
def allGroupsUUIDs = new HashSet<AccountGroup.UUID>()
def lastDisplay = 0
for (account in allAccounts) {
- def user = userFactory.create(account.accountId)
+ def user = userFactory.create(account.account().id())
def groupsUUIDs = user?.getEffectiveGroups()?.getKnownGroups()
if (groupsUUIDs != null) { allGroupsUUIDs.addAll(groupsUUIDs) }