Only update forum posts if post id was found
This commit is contained in:
@@ -27,10 +27,12 @@ public class MatchesListForumUpdater {
|
|||||||
MatchesListCreator creator = new MatchesListCreator(league);
|
MatchesListCreator creator = new MatchesListCreator(league);
|
||||||
String content = creator.getMatchesBeautiful();
|
String content = creator.getMatchesBeautiful();
|
||||||
String contentWithCodeBBCode = "<r><CODE><s>[code]</s>" + content + "<e>[/code]</e></CODE></r>";
|
String contentWithCodeBBCode = "<r><CODE><s>[code]</s>" + content + "<e>[/code]</e></CODE></r>";
|
||||||
int postId = getPostId(creator.getCountry(), creator.getLeagueName());
|
Integer postId = getPostId(creator.getCountry(), creator.getLeagueName());
|
||||||
|
if(postId != null) {
|
||||||
TippligaSQLConnector con = TippligaSQLConnector.getInstance();
|
TippligaSQLConnector con = TippligaSQLConnector.getInstance();
|
||||||
con.updatePost(postId, contentWithCodeBBCode);
|
con.updatePost(postId, contentWithCodeBBCode);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private Integer getPostId(String country, String league) {
|
private Integer getPostId(String country, String league) {
|
||||||
String query = "SELECT post_id FROM phpbb_posts WHERE post_subject = '" + country + " " + league + "';";
|
String query = "SELECT post_id FROM phpbb_posts WHERE post_subject = '" + country + " " + league + "';";
|
||||||
|
|||||||
Reference in New Issue
Block a user