Skip to content

Distributed Peer-to-Peer Web Search Engine and Intranet Search Appliance

- added generation of news for blog entries - added display of blog banner in Network view - extended lifetime of blog, wiki and crawl news

orbiter19c6e6700359
diff --git a/htroot/Blog.java b/htroot/Blog.java
index b0920b3a1..ce685ebdd 100644
--- a/htroot/Blog.java
+++ b/htroot/Blog.java
@@ -50,6 +50,7 @@ import java.io.IOException;
import java.io.UnsupportedEncodingException;
import java.text.SimpleDateFormat;
import java.util.Date;
+import java.util.HashMap;
import java.util.Iterator;
import de.anomic.data.userDB;
@@ -59,6 +60,8 @@ import de.anomic.http.httpHeader;
import de.anomic.plasma.plasmaSwitchboard;
import de.anomic.server.serverObjects;
import de.anomic.server.serverSwitch;
+import de.anomic.yacy.yacyCore;
+import de.anomic.yacy.yacyNewsRecord;
public class Blog {
@@ -131,9 +134,21 @@ public class Blog {
date = page.date();
}
+ String subject = wikiCode.replaceHTML(post.get("subject",""));
+
try {
- switchboard.blogDB.write(switchboard.blogDB.newEntry(pagename, post.get("subject",""), author, ip, date, content));
+ switchboard.blogDB.write(switchboard.blogDB.newEntry(pagename, subject, author, ip, date, content));
} catch (IOException e) {}
+
+ // create a news message
+ HashMap map = new HashMap();
+ map.put("subject", subject);
+ map.put("page", pagename);
+ map.put("author", author);
+ map.put("ip", ip);
+ try {
+ yacyCore.newsPool.publishMyNews(new yacyNewsRecord("blog_add", map));
+ } catch (IOException e) {}
}
page = switchboard.blogDB.read(pagename); //maybe "if(page == null)"
diff --git a/htroot/Network.html b/htroot/Network.html
index 5bb2db84a..2d4e31d09 100644
--- a/htroot/Network.html
+++ b/htroot/Network.html
@@ -72,6 +72,7 @@
<a href="http://#[fullname]#.yacy/Wiki.html" class="small" title="Read and edit wiki on peer #[fullname]#">w</a>&nbsp;&nbsp;
#(updatedProfile)#::<a href="ViewProfile.html?hash=#[hash]#"><img border="0" src="/env/grafics/profile.gif" align="bottom"></a>#(/updatedProfile)#
#(updatedWikiPage)#::<a href="http://#[name]#.yacy/Wiki.html?page=#[page]#"><img border="0" src="/env/grafics/wiki.gif" align="bottom"></a>#(/updatedWikiPage)#
+ #(updatedBlog)#::<a href="http://#[name]#.yacy/Blog.html?page=#[page]#"><img border="0" src="/env/grafics/blog.gif" align="bottom"></a>#(/updatedBlog)#
#(isCrawling)#::<a href="#[page]#"><img border="0" src="/env/grafics/crawl.gif" align="bottom"></a>#(/isCrawling)#
</td>
<td class="small"><a href="http://www.#[fullname]#.yacy" class="small">#[shortname]#</a></td>
diff --git a/htroot/Network.java b/htroot/Network.java
index 793ad4a9a..d3e2b60a6 100644
--- a/htroot/Network.java
+++ b/htroot/Network.java
@@ -242,6 +242,7 @@ public class Network {
// find updated Information using YaCyNews
final HashSet updatedProfile = new HashSet();
final HashMap updatedWiki = new HashMap();
+ final HashMap updatedBlog = new HashMap();
final HashMap isCrawling = new HashMap();
int availableNews = yacyCore.newsPool.size(yacyNewsPool.INCOMING_DB);
if (availableNews > 300) { availableNews = 300; }
@@ -255,6 +256,8 @@ public class Network {
updatedProfile.add(record.originator());
} else if (record.category().equals("wiki_upd")) {
updatedWiki.put(record.originator(), record.attributes().get("page"));
+ } else if (record.category().equals("blog_add")) {
+ updatedBlog.put(record.originator(), record.attributes().get("page"));
} else if (record.category().equals("crwlstrt")) {
isCrawling.put(record.originator(), record.attributes().get("startURL"));
}
@@ -274,6 +277,7 @@ public class Network {
int p;
String startURL;
String wikiPage;
+ String blogPage;
String userAgent, location;
int PPM;
long myValue=0, nextValue=0, prevValue=0, nextPPM=0, myPPM=0;
@@ -282,6 +286,7 @@ public class Network {
if (seed != null) {
prop.put(STR_TABLE_LIST + conCount + "_updatedProfile", 0);
prop.put(STR_TABLE_LIST + conCount + "_updatedWikiPage", 0);
+ prop.put(STR_TABLE_LIST + conCount + "_updatedBlog", 0);
prop.put(STR_TABLE_LIST + conCount + "_isCrawling", 0);
if (conCount >= maxCount) { break; }
if (seed.hash.equals(yacyCore.seedDB.mySeed.hash)) {
@@ -317,6 +322,12 @@ public class Network {
prop.put(STR_TABLE_LIST + conCount + "_updatedWikiPage_page", wikiPage);
prop.put(STR_TABLE_LIST + conCount + "_updatedWikiPage_name", seed.get(yacySeed.NAME, "deadlink"));
}
+ if ((blogPage = (String) updatedBlog.get(seed.hash)) == null) {
+ prop.put(STR_TABLE_LIST + conCount + "_updatedBlog", 0);
+ } else {
+ prop.put(STR_TABLE_LIST + conCount + "_updatedBlog_page", blogPage);
+ prop.put(STR_TABLE_LIST + conCount + "_updatedBlog_name", seed.get(yacySeed.NAME, "deadlink"));
+ }
try {
PPM = Integer.parseInt(seed.get(yacySeed.ISPEED, "-"));
} catch (NumberFormatException ee) {
diff --git a/source/de/anomic/kelondro/kelondroAbstractRA.java b/source/de/anomic/kelondro/kelondroAbstractRA.java
index 976a2ec5f..a9405976c 100644
--- a/source/de/anomic/kelondro/kelondroAbstractRA.java
+++ b/source/de/anomic/kelondro/kelondroAbstractRA.java
@@ -44,11 +44,7 @@
package de.anomic.kelondro;
-import java.io.BufferedReader;
-import java.io.ByteArrayInputStream;
-import java.io.ByteArrayOutputStream;
import java.io.IOException;
-import java.io.InputStreamReader;
import java.util.Enumeration;
import java.util.Iterator;
import java.util.Map;
diff --git a/source/de/anomic/yacy/yacyNewsPool.java b/source/de/anomic/yacy/yacyNewsPool.java
index bab1d2fa9..c161c0105 100644
--- a/source/de/anomic/yacy/yacyNewsPool.java
+++ b/source/de/anomic/yacy/yacyNewsPool.java
@@ -79,8 +79,8 @@ public class yacyNewsPool {
"bkmrkdvt", // a vote and comment on a bookmark delete
"wiki_add", // a wiki page was created
"wiki_upd", // a wiki page was updated
- "wiki_del" // a wiki page das deleted
- // urlvotes
+ "wiki_del", // a wiki page das deleted
+ "blog_add" // a blog entry was added
};
public static HashSet categories;
static {
@@ -179,15 +179,19 @@ public class yacyNewsPool {
if (record == null) return false;
if (record.category() == null) return true;
if ((System.currentTimeMillis() - record.created().getTime()) > (1000 * 60 * 60 * 24 * 7) /* 1 Week */) {
- // remove everything after 1 week
+ // remove everything after 1 week
return true;
}
- if ((record.category().equals("wiki_upd")) &&
- ((System.currentTimeMillis() - record.created().getTime()) > (1000 * 60 * 60 * 24) /* 1 Day */)) {
+ if (((record.category().equals("wiki_add")) || (record.category().equals("wiki_upd"))) &&
+ ((System.currentTimeMillis() - record.created().getTime()) > (1000 * 60 * 60 * 24 * 3) /* 3 Days */)) {
return true;
}
+ if ((record.category().equals("blog_add")) &&
+ ((System.currentTimeMillis() - record.created().getTime()) > (1000 * 60 * 60 * 24 * 3) /* 3 Days */)) {
+ return true;
+ }
if ((record.category().equals("crwlstrt")) &&
- ((System.currentTimeMillis() - record.created().getTime()) > (1000 * 60 * 60 * 24) /* 1 Day */)) {
+ ((System.currentTimeMillis() - record.created().getTime()) > (1000 * 60 * 60 * 24 * 2) /* 2 Days */)) {
yacySeed seed = yacyCore.seedDB.get(record.originator());
if (seed == null) return false;
try {