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
24432b8a
Unverified
Commit
24432b8a
authored
Sep 16, 2018
by
Liang Ding
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
♻
#12509 升级子程序
parent
03d62008
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
39 additions
and
5 deletions
+39
-5
src/main/java/org/b3log/solo/cache/ArticleCache.java
src/main/java/org/b3log/solo/cache/ArticleCache.java
+9
-1
src/main/java/org/b3log/solo/cache/CommentCache.java
src/main/java/org/b3log/solo/cache/CommentCache.java
+8
-1
src/main/java/org/b3log/solo/service/UpgradeService.java
src/main/java/org/b3log/solo/service/UpgradeService.java
+22
-3
No files found.
src/main/java/org/b3log/solo/cache/ArticleCache.java
View file @
24432b8a
...
...
@@ -30,7 +30,7 @@ import org.json.JSONObject;
* Article cache.
*
* @author <a href="http://88250.b3log.org">Liang Ding</a>
* @version 1.
1.0.0, Aug 30, 2017
* @version 1.
2.0.0, Sep 16, 2018
* @since 2.3.0
*/
@Named
...
...
@@ -95,4 +95,12 @@ public class ArticleCache {
public
void
removeArticle
(
final
String
id
)
{
idCache
.
remove
(
id
);
}
/**
* Clears all cached articles.
*/
public
void
clear
()
{
idCache
.
removeAll
();
permalinkCache
.
removeAll
();
}
}
\ No newline at end of file
src/main/java/org/b3log/solo/cache/CommentCache.java
View file @
24432b8a
...
...
@@ -30,7 +30,7 @@ import org.json.JSONObject;
* Comment cache.
*
* @author <a href="http://88250.b3log.org">Liang Ding</a>
* @version 1.
0.0.0, Jul 16, 2017
* @version 1.
1.0.0, Sep 16, 2018
* @since 2.3.0
*/
@Named
...
...
@@ -74,4 +74,11 @@ public class CommentCache {
public
void
removeComment
(
final
String
id
)
{
cache
.
remove
(
id
);
}
/**
* Clears all cached comments.
*/
public
void
clear
()
{
cache
.
removeAll
();
}
}
src/main/java/org/b3log/solo/service/UpgradeService.java
View file @
24432b8a
...
...
@@ -27,11 +27,14 @@ import org.b3log.latke.mail.MailServiceFactory;
import
org.b3log.latke.model.User
;
import
org.b3log.latke.repository.Query
;
import
org.b3log.latke.repository.Transaction
;
import
org.b3log.latke.repository.jdbc.JdbcRepository
;
import
org.b3log.latke.repository.jdbc.util.Connections
;
import
org.b3log.latke.service.LangPropsService
;
import
org.b3log.latke.service.ServiceException
;
import
org.b3log.latke.service.annotation.Service
;
import
org.b3log.solo.SoloServletListener
;
import
org.b3log.solo.cache.ArticleCache
;
import
org.b3log.solo.cache.CommentCache
;
import
org.b3log.solo.model.Article
;
import
org.b3log.solo.model.Comment
;
import
org.b3log.solo.model.Option
;
...
...
@@ -130,6 +133,18 @@ public class UpgradeService {
@Inject
private
LangPropsService
langPropsService
;
/**
* Article cache.
*/
@Inject
private
ArticleCache
articleCache
;
/**
* Comment cache.
*/
@Inject
private
CommentCache
commentCache
;
/**
* Upgrades if need.
*/
...
...
@@ -178,8 +193,12 @@ public class UpgradeService {
alterTables
();
upgradeArticles
();
upgradeComments
();
JdbcRepository
.
dispose
();
// avoid to metadata lock
dropColumns
();
articleCache
.
clear
();
commentCache
.
clear
();
final
Transaction
transaction
=
optionRepository
.
beginTransaction
();
final
JSONObject
versionOpt
=
optionRepository
.
get
(
Option
.
ID_C_VERSION
);
versionOpt
.
put
(
Option
.
OPTION_VALUE
,
TO_VER
);
...
...
@@ -218,9 +237,9 @@ public class UpgradeService {
final
Statement
statement
=
connection
.
createStatement
();
final
String
tablePrefix
=
Latkes
.
getLocalProperty
(
"jdbc.tablePrefix"
)
+
"_"
;
statement
.
execute
(
"ALTER TABLE `"
+
tablePrefix
+
"article` DROP COLUMN `articleCreateDate`"
);
statement
.
execute
(
"ALTER TABLE `"
+
tablePrefix
+
"article` DROP COLUMN `articleUpdateDate`"
);
statement
.
execute
(
"ALTER TABLE `"
+
tablePrefix
+
"comment` DROP COLUMN `commentDate`"
);
statement
.
execute
Update
(
"ALTER TABLE `"
+
tablePrefix
+
"article` DROP COLUMN `articleCreateDate`"
);
statement
.
execute
Update
(
"ALTER TABLE `"
+
tablePrefix
+
"article` DROP COLUMN `articleUpdateDate`"
);
statement
.
execute
Update
(
"ALTER TABLE `"
+
tablePrefix
+
"comment` DROP COLUMN `commentDate`"
);
statement
.
close
();
connection
.
commit
();
connection
.
close
();
...
...
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