Skip to content

Commit

Permalink
🔖 发布 v4.1.0
Browse files Browse the repository at this point in the history
  • Loading branch information
88250 committed May 19, 2020
1 parent d19b6e6 commit a9a836d
Show file tree
Hide file tree
Showing 6 changed files with 76 additions and 7 deletions.
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "solo",
"version": "4.0.0",
"version": "4.1.0",
"description": " 一款小而美的博客系统,专为程序员设计。",
"homepage": "https://github.com/88250/solo",
"repository": {
Expand Down
4 changes: 2 additions & 2 deletions pom.xml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
Description: Solo POM.
Version: 3.18.3.94, May 10, 2020
Version: 3.18.3.95, May 19, 2020
Author: <a href="http://88250.b3log.org">Liang Ding</a>
Author: <a href="http://www.annpeter.cn">Ann Peter</a>
Author: <a href="http://vanessa.b3log.org">Vanessa</a>
Expand All @@ -16,7 +16,7 @@
<artifactId>solo</artifactId>
<packaging>jar</packaging>
<name>Solo</name>
<version>4.0.0</version>
<version>4.1.0</version>
<description>
一款小而美的博客系统,专为程序员设计。
</description>
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/org/b3log/solo/Server.java
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
* Server.
*
* @author <a href="http://88250.b3log.org">Liang Ding</a>
* @version 3.0.1.5, Apr 30, 2020
* @version 3.0.1.6, May 19, 2020
* @since 1.2.0
*/
public final class Server extends BaseServer {
Expand All @@ -62,7 +62,7 @@ public final class Server extends BaseServer {
/**
* Solo version.
*/
public static final String VERSION = "4.0.0";
public static final String VERSION = "4.1.0";

/**
* In-Memory tail logger writer.
Expand Down
4 changes: 3 additions & 1 deletion src/main/java/org/b3log/solo/service/UpgradeService.java
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
* Upgrade service.
*
* @author <a href="http://88250.b3log.org">Liang Ding</a>
* @version 1.2.1.18, Mar 24, 2020
* @version 1.2.1.19, May 19, 2020
* @since 1.2.0
*/
@Service
Expand Down Expand Up @@ -98,6 +98,8 @@ public void upgrade() {
V380_390.perform();
case "3.9.0":
V390_400.perform();
case "4.0.0":
V400_410.perform();
break;
default:
LOGGER.log(Level.ERROR, "Please upgrade to v3.0.0 first");
Expand Down
67 changes: 67 additions & 0 deletions src/main/java/org/b3log/solo/upgrade/V400_410.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
/*
* Solo - A small and beautiful blogging system written in Java.
* Copyright (c) 2010-present, b3log.org
*
* Solo is licensed under Mulan PSL v2.
* You can use this software according to the terms and conditions of the Mulan PSL v2.
* You may obtain a copy of Mulan PSL v2 at:
* http://license.coscl.org.cn/MulanPSL2
* THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
* See the Mulan PSL v2 for more details.
*/
package org.b3log.solo.upgrade;

import org.apache.logging.log4j.Level;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.b3log.latke.ioc.BeanManager;
import org.b3log.latke.repository.Transaction;
import org.b3log.solo.model.Option;
import org.b3log.solo.repository.OptionRepository;
import org.json.JSONObject;

/**
* Upgrade script from v4.0.0 to v4.1.0.
*
* @author <a href="http://88250.b3log.org">Liang Ding</a>
* @version 1.0.0.0, May 19, 2020
* @since 4.1.0
*/
public final class V400_410 {

/**
* Logger.
*/
private static final Logger LOGGER = LogManager.getLogger(V400_410.class);

/**
* Performs upgrade from v4.0.0 to v4.1.0.
*
* @throws Exception upgrade fails
*/
public static void perform() throws Exception {
final String fromVer = "4.0.0";
final String toVer = "4.1.0";

LOGGER.log(Level.INFO, "Upgrading from version [" + fromVer + "] to version [" + toVer + "]....");

final BeanManager beanManager = BeanManager.getInstance();
final OptionRepository optionRepository = beanManager.getReference(OptionRepository.class);

try {
final Transaction transaction = optionRepository.beginTransaction();

final JSONObject versionOpt = optionRepository.get(Option.ID_C_VERSION);
versionOpt.put(Option.OPTION_VALUE, toVer);
optionRepository.update(Option.ID_C_VERSION, versionOpt);

transaction.commit();

LOGGER.log(Level.INFO, "Upgraded from version [" + fromVer + "] to version [" + toVer + "] successfully");
} catch (final Exception e) {
LOGGER.log(Level.ERROR, "Upgrade failed!", e);

throw new Exception("Upgrade failed from version [" + fromVer + "] to version [" + toVer + "]");
}
}
}

0 comments on commit a9a836d

Please sign in to comment.