Commit 9be8840e authored by Liang Ding's avatar Liang Ding

056 升级程序

用户密码哈希;插件表加 setting 字段
parent 0671cd28
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<!-- <!--
Description: B3log Solo core. Description: B3log Solo core.
Version: 2.0.1.1, Nov 21, 2012 Version: 2.0.1.2, Feb 4, 2013
Author: Liang Ding Author: Liang Ding
--> -->
<project xmlns="http://maven.apache.org/POM/4.0.0" <project xmlns="http://maven.apache.org/POM/4.0.0"
...@@ -17,7 +17,7 @@ ...@@ -17,7 +17,7 @@
<parent> <parent>
<groupId>org.b3log</groupId> <groupId>org.b3log</groupId>
<artifactId>solo</artifactId> <artifactId>solo</artifactId>
<version>0.5.5</version> <version>0.5.6</version>
</parent> </parent>
<dependencies> <dependencies>
......
...@@ -55,7 +55,7 @@ import org.json.JSONObject; ...@@ -55,7 +55,7 @@ import org.json.JSONObject;
* B3log Solo servlet listener. * B3log Solo servlet listener.
* *
* @author <a href="mailto:DL88250@gmail.com">Liang Ding</a> * @author <a href="mailto:DL88250@gmail.com">Liang Ding</a>
* @version 1.0.7.6, Nov 21, 2012 * @version 1.0.7.7, Feb 4, 2013
* @since 0.3.1 * @since 0.3.1
*/ */
public final class SoloServletListener extends AbstractServletListener { public final class SoloServletListener extends AbstractServletListener {
...@@ -63,7 +63,7 @@ public final class SoloServletListener extends AbstractServletListener { ...@@ -63,7 +63,7 @@ public final class SoloServletListener extends AbstractServletListener {
/** /**
* B3log Solo version. * B3log Solo version.
*/ */
public static final String VERSION = "0.5.5"; public static final String VERSION = "0.5.6";
/** /**
* Logger. * Logger.
......
...@@ -17,13 +17,19 @@ package org.b3log.solo.processor; ...@@ -17,13 +17,19 @@ package org.b3log.solo.processor;
import java.io.IOException; import java.io.IOException;
import java.sql.Connection;
import java.sql.Statement;
import java.util.logging.Level; import java.util.logging.Level;
import java.util.logging.Logger; import java.util.logging.Logger;
import org.b3log.latke.Keys; import org.b3log.latke.Keys;
import org.b3log.latke.Latkes;
import org.b3log.latke.RuntimeEnv;
import org.b3log.latke.mail.MailService; import org.b3log.latke.mail.MailService;
import org.b3log.latke.mail.MailServiceFactory; import org.b3log.latke.mail.MailServiceFactory;
import org.b3log.latke.model.Plugin;
import org.b3log.latke.model.User; import org.b3log.latke.model.User;
import org.b3log.latke.repository.*; import org.b3log.latke.repository.*;
import org.b3log.latke.repository.jdbc.util.Connections;
import org.b3log.latke.service.LangPropsService; import org.b3log.latke.service.LangPropsService;
import org.b3log.latke.service.ServiceException; import org.b3log.latke.service.ServiceException;
import org.b3log.latke.servlet.HTTPRequestContext; import org.b3log.latke.servlet.HTTPRequestContext;
...@@ -47,7 +53,7 @@ import org.json.JSONObject; ...@@ -47,7 +53,7 @@ import org.json.JSONObject;
* *
* @author <a href="mailto:DL88250@gmail.com">Liang Ding</a> * @author <a href="mailto:DL88250@gmail.com">Liang Ding</a>
* @author <a href="mailto:dongxv.vang@gmail.com">Dongxu Wang</a> * @author <a href="mailto:dongxv.vang@gmail.com">Dongxu Wang</a>
* @version 1.1.1.5, Jan 4, 2013 * @version 1.1.1.6, Feb 4, 2013
* @since 0.3.1 * @since 0.3.1
*/ */
@RequestProcessor @RequestProcessor
...@@ -132,8 +138,8 @@ public final class UpgradeProcessor { ...@@ -132,8 +138,8 @@ public final class UpgradeProcessor {
return; return;
} }
if ("0.5.0".equals(version)) { if ("0.5.5".equals(version)) {
v050ToV055(); v055ToV056();
} else { } else {
LOGGER.log(Level.WARNING, "Attempt to skip more than one version to upgrade. Expected: 0.5.0; Actually: {0}", version); LOGGER.log(Level.WARNING, "Attempt to skip more than one version to upgrade. Expected: 0.5.0; Actually: {0}", version);
if (!sent) { if (!sent) {
...@@ -146,17 +152,18 @@ public final class UpgradeProcessor { ...@@ -146,17 +152,18 @@ public final class UpgradeProcessor {
LOGGER.log(Level.SEVERE, e.getMessage(), e); LOGGER.log(Level.SEVERE, e.getMessage(), e);
renderer.setContent( renderer.setContent(
"Upgrade failed [" + e.getMessage() + "], please contact the B3log Solo developers or reports this " "Upgrade failed [" + e.getMessage() + "], please contact the B3log Solo developers or reports this "
+ "issue directly (https://github.com/b3log/b3log-solo/issues/new) "); + "issue directly (<a href='https://github.com/b3log/b3log-solo/issues/new'>"
+ "https://github.com/b3log/b3log-solo/issues/new</a>) ");
} }
} }
/** /**
* Upgrades from version 050 to version 055. * Upgrades from version 055 to version 056.
* *
* @throws Exception upgrade fails * @throws Exception upgrade fails
*/ */
private void v050ToV055() throws Exception { private void v055ToV056() throws Exception {
LOGGER.info("Upgrading from version 050 to version 055...."); LOGGER.info("Upgrading from version 055 to version 056....");
articleRepository.setCacheEnabled(false); articleRepository.setCacheEnabled(false);
...@@ -168,10 +175,24 @@ public final class UpgradeProcessor { ...@@ -168,10 +175,24 @@ public final class UpgradeProcessor {
// Upgrades preference model // Upgrades preference model
final JSONObject preference = preferenceRepository.get(Preference.PREFERENCE); final JSONObject preference = preferenceRepository.get(Preference.PREFERENCE);
preference.put(Preference.VERSION, "0.5.5"); preference.put(Preference.VERSION, "0.5.6");
preferenceRepository.update(Preference.PREFERENCE, preference); preferenceRepository.update(Preference.PREFERENCE, preference);
upgradeUsers();
final RuntimeEnv runtimeEnv = Latkes.getRuntimeEnv();
if (RuntimeEnv.LOCAL == runtimeEnv || RuntimeEnv.BAE == runtimeEnv) {
final Connection connection = Connections.getConnection();
final Statement statement = connection.createStatement();
final String tableName = Latkes.getLocalProperty("jdbc.tablePrefix") + '_' + Plugin.PLUGIN;
statement.execute("ALTER TABLE " + tableName + " ADD setting text");
connection.commit();
}
transaction.commit(); transaction.commit();
LOGGER.log(Level.FINEST, "Updated preference"); LOGGER.log(Level.FINEST, "Updated preference");
...@@ -181,12 +202,12 @@ public final class UpgradeProcessor { ...@@ -181,12 +202,12 @@ public final class UpgradeProcessor {
} }
LOGGER.log(Level.SEVERE, "Upgrade failed.", e); LOGGER.log(Level.SEVERE, "Upgrade failed.", e);
throw new Exception("Upgrade failed from version 050 to version 055"); throw new Exception("Upgrade failed from version 055 to version 056");
} finally { } finally {
articleRepository.setCacheEnabled(true); articleRepository.setCacheEnabled(true);
} }
LOGGER.info("Upgraded from version 050 to version 055 successfully :-)"); LOGGER.info("Upgraded from version 055 to version 056 successfully :-)");
} }
/** /**
...@@ -206,7 +227,7 @@ public final class UpgradeProcessor { ...@@ -206,7 +227,7 @@ public final class UpgradeProcessor {
final String oldPwd = user.optString(User.USER_PASSWORD); final String oldPwd = user.optString(User.USER_PASSWORD);
user.put(User.USER_PASSWORD, MD5.hash(oldPwd)); user.put(User.USER_PASSWORD, MD5.hash(oldPwd));
userRepository.update(user.optString(Keys.OBJECT_ID), user); userRepository.update(user.optString(Keys.OBJECT_ID), user);
LOGGER.log(Level.INFO, "Hashed user[name={0}] password.", user.optString(User.USER_NAME)); LOGGER.log(Level.INFO, "Hashed user[name={0}] password.", user.optString(User.USER_NAME));
......
...@@ -16,11 +16,11 @@ ...@@ -16,11 +16,11 @@
# #
# Description: ease skin (mock for test). # Description: ease skin (mock for test).
# Version: 1.0.0.2, Nov 21, 2012 # Version: 1.0.0.3, Feb 4, 2013
# Author: Liang Ding # Author: Liang Ding
# #
name=ease name=ease
version=1.0.3 version=1.0.3
forSolo=0.5.5 forSolo=0.5.6
memo=\u56de\u5f52\u606c\u9759 memo=\u56de\u5f52\u606c\u9759
...@@ -11,7 +11,7 @@ ...@@ -11,7 +11,7 @@
<groupId>org.b3log</groupId> <groupId>org.b3log</groupId>
<artifactId>solo</artifactId> <artifactId>solo</artifactId>
<packaging>pom</packaging> <packaging>pom</packaging>
<version>0.5.5</version> <version>0.5.6</version>
<name>B3log Solo</name> <name>B3log Solo</name>
<url>https://github.com/b3log/b3log-solo</url> <url>https://github.com/b3log/b3log-solo</url>
<description> <description>
...@@ -28,7 +28,7 @@ ...@@ -28,7 +28,7 @@
<!-- Properties --> <!-- Properties -->
<properties> <properties>
<servlet.version>2.5</servlet.version> <servlet.version>2.5</servlet.version>
<org.b3log.solo.version>0.5.5</org.b3log.solo.version> <org.b3log.solo.version>0.5.6</org.b3log.solo.version>
<org.b3log.latke.version>0.5.0-SNAPSHOT</org.b3log.latke.version> <org.b3log.latke.version>0.5.0-SNAPSHOT</org.b3log.latke.version>
<org.b3log.latke-gae.version>0.5.0-SNAPSHOT</org.b3log.latke-gae.version> <org.b3log.latke-gae.version>0.5.0-SNAPSHOT</org.b3log.latke-gae.version>
<org.b3log.latke-bae.version>0.5.0-SNAPSHOT</org.b3log.latke-bae.version> <org.b3log.latke-bae.version>0.5.0-SNAPSHOT</org.b3log.latke-bae.version>
......
...@@ -19,7 +19,7 @@ ...@@ -19,7 +19,7 @@
<parent> <parent>
<groupId>org.b3log</groupId> <groupId>org.b3log</groupId>
<artifactId>solo-war</artifactId> <artifactId>solo-war</artifactId>
<version>0.5.5</version> <version>0.5.6</version>
</parent> </parent>
<properties> <properties>
......
...@@ -19,7 +19,7 @@ ...@@ -19,7 +19,7 @@
<parent> <parent>
<groupId>org.b3log</groupId> <groupId>org.b3log</groupId>
<artifactId>solo-war</artifactId> <artifactId>solo-war</artifactId>
<version>0.5.5</version> <version>0.5.6</version>
</parent> </parent>
<properties> <properties>
......
...@@ -19,7 +19,7 @@ ...@@ -19,7 +19,7 @@
<parent> <parent>
<groupId>org.b3log</groupId> <groupId>org.b3log</groupId>
<artifactId>solo-war</artifactId> <artifactId>solo-war</artifactId>
<version>0.5.5</version> <version>0.5.6</version>
</parent> </parent>
<properties> <properties>
......
...@@ -19,7 +19,7 @@ ...@@ -19,7 +19,7 @@
<parent> <parent>
<groupId>org.b3log</groupId> <groupId>org.b3log</groupId>
<artifactId>solo-war</artifactId> <artifactId>solo-war</artifactId>
<version>0.5.5</version> <version>0.5.6</version>
</parent> </parent>
<properties> <properties>
......
...@@ -19,7 +19,7 @@ ...@@ -19,7 +19,7 @@
<parent> <parent>
<groupId>org.b3log</groupId> <groupId>org.b3log</groupId>
<artifactId>solo</artifactId> <artifactId>solo</artifactId>
<version>0.5.5</version> <version>0.5.6</version>
</parent> </parent>
<modules> <modules>
......
...@@ -20,12 +20,12 @@ ...@@ -20,12 +20,12 @@
Description: Web deployment descriptor on GAE. See Description: Web deployment descriptor on GAE. See
http://code.google.com/intl/en/appengine/docs/java/config/appconfig.html http://code.google.com/intl/en/appengine/docs/java/config/appconfig.html
for more details. for more details.
Version: 1.0.3.10, Nov 21, 2012 Version: 1.0.3.11, Feb 4, 2013
Author: Liang Ding Author: Liang Ding
--> -->
<appengine-web-app xmlns="http://appengine.google.com/ns/1.0"> <appengine-web-app xmlns="http://appengine.google.com/ns/1.0">
<application>solo-demo</application> <application>solo-demo</application>
<version>055</version> <version>056</version>
<sessions-enabled>true</sessions-enabled> <sessions-enabled>true</sessions-enabled>
......
...@@ -16,12 +16,12 @@ ...@@ -16,12 +16,12 @@
# #
# Description: ease skin. # Description: ease skin.
# Version: 1.0.0.3, Nov 21, 2012 # Version: 1.0.0.4, Feb 4, 2013
# Author: Liyuan Li # Author: Liyuan Li
# Author: Liang Ding # Author: Liang Ding
# #
name=ease name=ease
version=1.0.3 version=1.0.4
forSolo=0.5.5 forSolo=0.5.6
memo=\u56de\u5f52\u606c\u9759 memo=\u56de\u5f52\u606c\u9759
...@@ -16,11 +16,11 @@ ...@@ -16,11 +16,11 @@
# #
# Description: Mobile skin. # Description: Mobile skin.
# Version: 1.0.0.5, Nov 21, 2012 # Version: 1.0.0.6, Feb 4, 2013
# Author: Liang Ding # Author: Liang Ding
# #
name=Mobile name=Mobile
version=0.1.4 version=0.1.5
forSolo=0.5.5 forSolo=0.5.6
memo=\u8bf7\u4e0d\u8981\u4ece\u90e8\u7f72\u76ee\u5f55\u4e2d\u5220\u9664\u8be5\u76ae\u80a4\uff0c\u5426\u5219\u79fb\u52a8\u8bbe\u5907\u8bbf\u95ee\u65f6\u535a\u5ba2\u5c06\u4e0d\u53ef\u7528\u3002 memo=\u8bf7\u4e0d\u8981\u4ece\u90e8\u7f72\u76ee\u5f55\u4e2d\u5220\u9664\u8be5\u76ae\u80a4\uff0c\u5426\u5219\u79fb\u52a8\u8bbe\u5907\u8bbf\u95ee\u65f6\u535a\u5ba2\u5c06\u4e0d\u53ef\u7528\u3002
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment