Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
solo-1
Project overview
Project overview
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Administrator
solo-1
Commits
377c33b6
Commit
377c33b6
authored
Dec 20, 2017
by
Liang Ding
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
🔖
v2.5.0 升级程序
parent
dea06862
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
2 additions
and
49 deletions
+2
-49
src/main/java/org/b3log/solo/service/UpgradeService.java
src/main/java/org/b3log/solo/service/UpgradeService.java
+2
-49
No files found.
src/main/java/org/b3log/solo/service/UpgradeService.java
View file @
377c33b6
...
...
@@ -156,6 +156,8 @@ public class UpgradeService {
"Upgrade failed ["
+
e
.
getMessage
()
+
"], please contact the Solo developers or reports this "
+
"issue directly (<a href='https://github.com/b3log/solo/issues/new'>"
+
"https://github.com/b3log/solo/issues/new</a>) "
);
System
.
exit
(-
1
);
}
}
...
...
@@ -168,61 +170,12 @@ public class UpgradeService {
LOGGER
.
log
(
Level
.
INFO
,
"Upgrading from version [{0}] to version [{1}]...."
,
FROM_VER
,
TO_VER
);
final
Transaction
transaction
=
optionRepository
.
beginTransaction
();
final
boolean
isH2database
=
Latkes
.
getRuntimeDatabase
()
==
Latkes
.
RuntimeDatabase
.
H2
;
try
{
final
String
tablePrefix
=
Latkes
.
getLocalProperty
(
"jdbc.tablePrefix"
)
+
"_"
;
final
JSONObject
statistic
=
optionRepository
.
select
(
"SELECT * FROM `"
+
tablePrefix
+
"statistic`;"
).
get
(
0
);
final
JSONObject
versionOpt
=
optionRepository
.
get
(
Option
.
ID_C_VERSION
);
versionOpt
.
put
(
Option
.
OPTION_VALUE
,
TO_VER
);
optionRepository
.
update
(
Option
.
ID_C_VERSION
,
versionOpt
);
final
JSONObject
statisticBlogArticleCountOpt
=
new
JSONObject
();
statisticBlogArticleCountOpt
.
put
(
Keys
.
OBJECT_ID
,
Option
.
ID_C_STATISTIC_BLOG_ARTICLE_COUNT
);
statisticBlogArticleCountOpt
.
put
(
Option
.
OPTION_VALUE
,
statistic
.
optString
(
isH2database
?
Option
.
ID_C_STATISTIC_BLOG_ARTICLE_COUNT
.
toUpperCase
()
:
Option
.
ID_C_STATISTIC_BLOG_ARTICLE_COUNT
));
statisticBlogArticleCountOpt
.
put
(
Option
.
OPTION_CATEGORY
,
Option
.
CATEGORY_C_STATISTIC
);
optionRepository
.
add
(
statisticBlogArticleCountOpt
);
final
JSONObject
statisticBlogCommentCountOpt
=
new
JSONObject
();
statisticBlogCommentCountOpt
.
put
(
Keys
.
OBJECT_ID
,
Option
.
ID_C_STATISTIC_BLOG_COMMENT_COUNT
);
statisticBlogCommentCountOpt
.
put
(
Option
.
OPTION_VALUE
,
statistic
.
optString
(
isH2database
?
Option
.
ID_C_STATISTIC_BLOG_COMMENT_COUNT
.
toUpperCase
()
:
Option
.
ID_C_STATISTIC_BLOG_COMMENT_COUNT
));
statisticBlogCommentCountOpt
.
put
(
Option
.
OPTION_CATEGORY
,
Option
.
CATEGORY_C_STATISTIC
);
optionRepository
.
add
(
statisticBlogCommentCountOpt
);
final
JSONObject
statisticBlogViewCountOpt
=
new
JSONObject
();
statisticBlogViewCountOpt
.
put
(
Keys
.
OBJECT_ID
,
Option
.
ID_C_STATISTIC_BLOG_VIEW_COUNT
);
statisticBlogViewCountOpt
.
put
(
Option
.
OPTION_VALUE
,
statistic
.
optString
(
isH2database
?
Option
.
ID_C_STATISTIC_BLOG_VIEW_COUNT
.
toUpperCase
()
:
Option
.
ID_C_STATISTIC_BLOG_VIEW_COUNT
));
statisticBlogViewCountOpt
.
put
(
Option
.
OPTION_CATEGORY
,
Option
.
CATEGORY_C_STATISTIC
);
optionRepository
.
add
(
statisticBlogViewCountOpt
);
final
JSONObject
statisticPublishedBlogArticleCountOpt
=
new
JSONObject
();
statisticPublishedBlogArticleCountOpt
.
put
(
Keys
.
OBJECT_ID
,
Option
.
ID_C_STATISTIC_PUBLISHED_ARTICLE_COUNT
);
statisticPublishedBlogArticleCountOpt
.
put
(
Option
.
OPTION_VALUE
,
statistic
.
optString
(
isH2database
?
Option
.
ID_C_STATISTIC_PUBLISHED_ARTICLE_COUNT
.
toUpperCase
()
:
Option
.
ID_C_STATISTIC_PUBLISHED_ARTICLE_COUNT
));
statisticPublishedBlogArticleCountOpt
.
put
(
Option
.
OPTION_CATEGORY
,
Option
.
CATEGORY_C_STATISTIC
);
optionRepository
.
add
(
statisticPublishedBlogArticleCountOpt
);
final
JSONObject
statisticPublishedBlogCommentCountOpt
=
new
JSONObject
();
statisticPublishedBlogCommentCountOpt
.
put
(
Keys
.
OBJECT_ID
,
Option
.
ID_C_STATISTIC_PUBLISHED_BLOG_COMMENT_COUNT
);
statisticPublishedBlogCommentCountOpt
.
put
(
Option
.
OPTION_VALUE
,
statistic
.
optString
(
isH2database
?
Option
.
ID_C_STATISTIC_PUBLISHED_BLOG_COMMENT_COUNT
.
toUpperCase
()
:
Option
.
ID_C_STATISTIC_PUBLISHED_BLOG_COMMENT_COUNT
));
statisticPublishedBlogCommentCountOpt
.
put
(
Option
.
OPTION_CATEGORY
,
Option
.
CATEGORY_C_STATISTIC
);
optionRepository
.
add
(
statisticPublishedBlogCommentCountOpt
);
transaction
.
commit
();
dropTables
();
alterTables
();
}
catch
(
final
Exception
e
)
{
if
(
null
!=
transaction
&&
transaction
.
isActive
())
{
transaction
.
rollback
();
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment