| | |
| | | import java.text.MessageFormat;
|
| | | import java.util.ArrayList;
|
| | | import java.util.Arrays;
|
| | | import java.util.Collection;
|
| | | import java.util.Collections;
|
| | | import java.util.HashMap;
|
| | | import java.util.List;
|
| | |
| | | import com.gitblit.models.Metric;
|
| | | import com.gitblit.models.ObjectCache;
|
| | | import com.gitblit.models.RepositoryModel;
|
| | | import com.gitblit.models.ServerSettings;
|
| | | import com.gitblit.models.ServerStatus;
|
| | | import com.gitblit.models.SettingModel;
|
| | | import com.gitblit.models.ServerSettings;
|
| | | import com.gitblit.models.UserModel;
|
| | | import com.gitblit.utils.ByteFormat;
|
| | | import com.gitblit.utils.FederationUtils;
|
| | |
| | | */
|
| | | public static boolean isDebugMode() {
|
| | | return self().settings.getBoolean(Keys.web.debugMode, false);
|
| | | }
|
| | |
|
| | | /**
|
| | | * Updates the list of server settings.
|
| | | * |
| | | * @param settings
|
| | | * @return true if the update succeeded
|
| | | */
|
| | | public boolean updateSettings(Collection<SettingModel> settings) {
|
| | | // TODO update the settings
|
| | | return false;
|
| | | }
|
| | |
|
| | | public ServerStatus getStatus() {
|
| | |
| | | */
|
| | | public void updateUserModel(String username, UserModel user, boolean isCreate)
|
| | | throws GitBlitException {
|
| | | if (!username.equalsIgnoreCase(user.username)) {
|
| | | if (userService.getUserModel(user.username) != null) {
|
| | | throw new GitBlitException(MessageFormat.format(
|
| | | "Failed to rename ''{0}'' because ''{1}'' already exists.", username,
|
| | | user.username));
|
| | | }
|
| | | }
|
| | | if (!userService.updateUserModel(username, user)) {
|
| | | throw new GitBlitException(isCreate ? "Failed to add user!" : "Failed to update user!");
|
| | | }
|
| | |
| | | model.isFrozen = getConfig(config, "isFrozen", false);
|
| | | model.showReadme = getConfig(config, "showReadme", false);
|
| | | model.skipSizeCalculation = getConfig(config, "skipSizeCalculation", false);
|
| | | model.skipSummaryMetrics = getConfig(config, "skipSummaryMetrics", false);
|
| | | model.federationStrategy = FederationStrategy.fromName(getConfig(config,
|
| | | "federationStrategy", null));
|
| | | model.federationSets = new ArrayList<String>(Arrays.asList(config.getStringList(
|
| | |
| | | } else {
|
| | | // rename repository
|
| | | if (!repositoryName.equalsIgnoreCase(repository.name)) {
|
| | | if (!repository.name.toLowerCase().endsWith(
|
| | | org.eclipse.jgit.lib.Constants.DOT_GIT_EXT)) {
|
| | | repository.name += org.eclipse.jgit.lib.Constants.DOT_GIT_EXT;
|
| | | }
|
| | | if (new File(repositoriesFolder, repository.name).exists()) {
|
| | | throw new GitBlitException(MessageFormat.format(
|
| | | "Failed to rename ''{0}'' because ''{1}'' already exists.",
|
| | | repositoryName, repository.name));
|
| | | }
|
| | | closeRepository(repositoryName);
|
| | | File folder = new File(repositoriesFolder, repositoryName);
|
| | | File destFolder = new File(repositoriesFolder, repository.name);
|
| | |
| | | config.setBoolean("gitblit", null, "isFrozen", repository.isFrozen);
|
| | | config.setBoolean("gitblit", null, "showReadme", repository.showReadme);
|
| | | config.setBoolean("gitblit", null, "skipSizeCalculation", repository.skipSizeCalculation);
|
| | | config.setBoolean("gitblit", null, "skipSummaryMetrics", repository.skipSummaryMetrics);
|
| | | config.setStringList("gitblit", null, "federationSets", repository.federationSets);
|
| | | config.setString("gitblit", null, "federationStrategy",
|
| | | repository.federationStrategy.name());
|