<%@ page contentType="text/html;charset=utf-8"%>
<%@ page import="com.redmoon.forum.person.*"%>
<%@ page import="java.util.*"%>
<%@ page import="java.io.*"%>
<%@ page import="org.jdom.*"%>
<%@ page import="org.jdom.output.*"%>
<%@ page import="org.jdom.input.*"%>
<%@ page import="java.util.Iterator"%>
<%@ page import="com.redmoon.forum.*"%>
<%@ page import="com.redmoon.forum.person.*"%>
<%@ page import="com.cloudwebsoft.framework.db.*"%>
<%@ page import="cn.js.fan.util.web.*"%>
<%@ page import="java.sql.*"%>
<%
JdbcTemplate jt = new JdbcTemplate(new com.cloudwebsoft.framework.db.Connection(cn.js.fan.web.Global.defaultDB));

out.print("清除counter信息<BR>");
String sql = "delete from bc";
jt.addBatch(sql);
sql = "delete from lastly";
jt.addBatch(sql);
sql = "delete from monthcount";
jt.addBatch(sql);
sql = "delete from daycount";
jt.addBatch(sql);
sql = "delete from os";
jt.addBatch(sql);
sql = "delete from yearcount";
jt.addBatch(sql);
sql = "update count set PageCount=0,DayMax=0,AllCount=0,ToDayCount=0";
jt.addBatch(sql);

out.print("清除blog信息<BR>");
sql = "update blog set blogCount=0,newBlogUserName='',topicCount=0,postCount=0,todayCount=0,yestodayCount=0,maxCount=0,star='',recommandBlogs=''";
jt.addBatch(sql);
sql = "delete from blog_user_dir";
jt.addBatch(sql);
sql = "delete from photo";
jt.addBatch(sql);
sql = "delete from blog_user_config";
jt.addBatch(sql);

out.print("清空用户组信息<BR>");
sql = "delete from sq_user_group";
jt.addBatch(sql);

out.print("清除CMS信息<BR>");
sql = "delete from cms_images";
jt.addBatch(sql);
sql = "delete from comment";
jt.addBatch(sql);
sql = "delete from document_attach";
jt.addBatch(sql);
sql = "delete from doc_content";
jt.addBatch(sql);
sql = "delete from document";
jt.addBatch(sql);

sql = "INSERT INTO doc_content (doc_id,content,page_num) VALUES (1,'<IMG height=150 src=\"upfile/webeditimg/2006/8/2357ddd8a4354a8b82292978ec6821f6.jpg\" width=554>',1)";
jt.addBatch(sql);
sql = "INSERT INTO doc_content (doc_id,content,page_num) VALUES (2,'<IMG height=104 src=\"upfile/webeditimg/2006/8/528e140122ca4930a85d31ca942a0ab3.jpg\" width=879>',1)";
jt.addBatch(sql);
sql = "INSERT INTO doc_content (doc_id,content,page_num) VALUES (3,'<IMG height=104 src=\"upfile/webeditimg/2006/8/96ede6606c104816bc9f7a6722929a9c.jpg\" width=879>',1)";
jt.addBatch(sql);
sql = "INSERT INTO doc_content (doc_id,content,page_num) VALUES (4,' ',1)";
jt.addBatch(sql);
sql = "INSERT INTO document (id,keywords,isrelateshow,title,class1,author,modifiedDate,can_comment,summary,isHome,voteoption,voteresult,type,examine,nick,hit,template_id,page_count,parent_code,isNew,flowTypeCode) VALUES (1,'ad',1,'公告旁的广告','blog_ad1','admin','1156735806937',1,NULL,0,'','',0,0,'admin',23,-1,1,'blog_ad',0,'')";
jt.addBatch(sql);
sql = "INSERT INTO document (id,keywords,isrelateshow,title,class1,author,modifiedDate,can_comment,summary,isHome,voteoption,voteresult,type,examine,nick,hit,template_id,page_count,parent_code,isNew,flowTypeCode) VALUES (2,'ad',1,'首页中部横幅','blog_ad2','admin','1156735913968',1,NULL,0,'','',0,0,'admin',0,-1,1,'blog_ad',0,'')";
jt.addBatch(sql);
sql = "INSERT INTO document (id,keywords,isrelateshow,title,class1,author,modifiedDate,can_comment,summary,isHome,voteoption,voteresult,type,examine,nick,hit,template_id,page_count,parent_code,isNew,flowTypeCode) VALUES (3,'',1,'首页底部横幅','blog_ad3','admin','1156735951062',1,NULL,0,'','',0,0,'admin',0,-1,1,'blog_ad',0,'')";
jt.addBatch(sql);
sql = "INSERT INTO document (id,keywords,isrelateshow,title,class1,author,modifiedDate,can_comment,summary,isHome,voteoption,voteresult,type,examine,nick,hit,template_id,page_count,parent_code,isNew,flowTypeCode) VALUES (4,'',1,'便民服务','bmfu','admin','1156736629718',1,NULL,0,'','',0,0,'admin',0,-1,1,'shop',0,'')";
jt.addBatch(sql);

sql = "delete from sq_id";
jt.addBatch(sql);

sql = "INSERT INTO sq_id (idType,id) VALUES (0,1)";
jt.addBatch(sql);
sql = "INSERT INTO sq_id (idType,id) VALUES (1,5)";
jt.addBatch(sql);
sql = "INSERT INTO sq_id (idType,id) VALUES (2,1)";
jt.addBatch(sql);
sql = "INSERT INTO sq_id (idType,id) VALUES (3,1)";
jt.addBatch(sql);
sql = "INSERT INTO sq_id (idType,id) VALUES (4,1)";
jt.addBatch(sql);
sql = "INSERT INTO sq_id (idType,id) VALUES (5,1)";
jt.addBatch(sql);
sql = "INSERT INTO sq_id (idType,id) VALUES (6,1)";
jt.addBatch(sql);
sql = "INSERT INTO sq_id (idType,id) VALUES (7,1)";
jt.addBatch(sql);
sql = "INSERT INTO sq_id (idType,id) VALUES (8,1)";
jt.addBatch(sql);
sql = "INSERT INTO sq_id (idType,id) VALUES (9,1)";
jt.addBatch(sql);
sql = "INSERT INTO sq_id (idType,id) VALUES (10,1)";
jt.addBatch(sql);
sql = "INSERT INTO sq_id (idType,id) VALUES (11,1)";
jt.addBatch(sql);
sql = "INSERT INTO sq_id (idType,id) VALUES (12,1)";
jt.addBatch(sql);
sql = "INSERT INTO sq_id (idType,id) VALUES (13,1)";
jt.addBatch(sql);
sql = "INSERT INTO sq_id (idType,id) VALUES (14,1)";
jt.addBatch(sql);
sql = "INSERT INTO sq_id (idType,id) VALUES (15,1)";
jt.addBatch(sql);

sql = "INSERT INTO cms_images (id,path,mainkey,kind,subkey) VALUES (10,'upfile/webeditimg/2006/8/2357ddd8a4354a8b82292978ec6821f6.jpg','1','document',1)";
jt.addBatch(sql);
sql = "INSERT INTO cms_images (id,path,mainkey,kind,subkey) VALUES (11,'upfile/webeditimg/2006/8/528e140122ca4930a85d31ca942a0ab3.jpg','2','document',1)";
jt.addBatch(sql);
sql = "INSERT INTO cms_images (id,path,mainkey,kind,subkey) VALUES (12,'upfile/webeditimg/2006/8/96ede6606c104816bc9f7a6722929a9c.jpg','3','document',1)";
jt.addBatch(sql);

// 清空留言簿（商铺）
sql = "delete from guestbook";
jt.addBatch(sql);

sql = "delete from sq_images";
jt.addBatch(sql);

sql = "delete from link";
jt.addBatch(sql);

// 短消息
sql = "delete from message";
jt.addBatch(sql);

sql = "update miniplugin_home set hot='', recommandBoard='', recommandMsg=''";
jt.addBatch(sql);

// 插件2
sql = "delete from plugin2_alipay";
jt.addBatch(sql);

sql = "delete from plugin_auction_bid";
jt.addBatch(sql);

sql = "delete from plugin_auction_order";
jt.addBatch(sql);

sql = "delete from plugin_auction_shop";
jt.addBatch(sql);

sql = "delete from plugin_auction_shop_dir";
jt.addBatch(sql);

sql = "delete from plugin_auction_worth";
jt.addBatch(sql);

sql = "delete from plugin_auction";
jt.addBatch(sql);

sql = "delete from plugin_entrance_vip_card";
jt.addBatch(sql);

sql = "delete from plugin_entrance_vip_user";
jt.addBatch(sql);

sql = "delete from plugin_info";
jt.addBatch(sql);

sql = "delete from plugin_sweet_life";
jt.addBatch(sql);

sql = "delete from plugin_sweet_sq_message";
jt.addBatch(sql);

sql = "delete from plugin_sweet_user";
jt.addBatch(sql);

sql = "delete from plugin_sweet_userinfo";
jt.addBatch(sql);

sql = "delete from plugin_sweet";
jt.addBatch(sql);

// sq
sql = "update sq_board set add_id=0";
jt.addBatch(sql);

sql = "delete from sq_board_entrance";
jt.addBatch(sql);

sql = "delete from sq_board_score";
jt.addBatch(sql);

sql = "delete from sq_boardmanager";
jt.addBatch(sql);

sql = "delete from sq_classmaster";
jt.addBatch(sql);

sql = "delete from sq_friend";
jt.addBatch(sql);

sql = "delete from sq_master";
jt.addBatch(sql);

sql = "delete from sq_message_attach";
jt.addBatch(sql);

sql = "delete from sq_thread";
jt.addBatch(sql);

sql = "delete from sq_message";
jt.addBatch(sql);

sql = "delete from sq_online";
jt.addBatch(sql);

sql = "delete from sq_roomemcee";
jt.addBatch(sql);

sql = "delete from sq_user";
jt.addBatch(sql);

sql = "delete from sq_user_treasure";
jt.addBatch(sql);

sql = "delete from user_group_priv";
jt.addBatch(sql);

sql = "delete from user_of_group";
jt.addBatch(sql);

sql = "delete from user_priv";
jt.addBatch(sql);

sql = "delete from users";
jt.addBatch(sql);

sql = "delete from sq_forbid_ip";
jt.addBatch(sql);

sql = "delete from sq_forbid_ip_range";
jt.addBatch(sql);

sql = "insert into users (name,pwd,realname,enter_count,enter_last) values ('admin', '96e79218965eb72c92a549dd5a330112','admin',0,0)";
jt.addBatch(sql);

jt.executeBatch();

out.print("清空论坛统计信息<BR>");

ForumDb forum = new ForumDb();
forum.setTopicCount(0);
forum.setPostCount(0);
forum.setUserCount(0);
forum.setUserNew("");
forum.setUserCount(0);
forum.setMaxCount(0);
forum.setMaxDate(null);
forum.setMaxOnlineCount(0);
forum.setMaxOnlineDate(null);
forum.setTodayCount(0);
forum.setYestodayCount(0);
forum.save();

out.print("清空版块统计<BR>");

LeafChildrenCacheMgr dlcm = new LeafChildrenCacheMgr("root");
java.util.Vector vt = dlcm.getChildren();
Iterator ir = vt.iterator();
while (ir.hasNext()) {
	Leaf leaf = (Leaf) ir.next();
	String parentCode = leaf.getCode();

	LeafChildrenCacheMgr dl = new LeafChildrenCacheMgr(parentCode);
	java.util.Vector v = dl.getChildren();
	Iterator ir1 = v.iterator();
	while (ir1.hasNext()) {
		Leaf lf = (Leaf) ir1.next();
		lf.setPostCount(0);
		lf.setTopicCount(0);
		lf.setTodayCount(0);
		lf.update();
	}
}

out.print("删除文件夹upfile<BR>");
cn.js.fan.util.file.FileUtil.del(application.getRealPath("/") + "upfile");
cn.js.fan.util.file.FileUtil.del(application.getRealPath("/") + "forum/upfile");

out.print("刷新缓存<BR>");
cn.js.fan.cache.jcs.RMCache rmcache = cn.js.fan.cache.jcs.RMCache.getInstance();
rmcache.clear();
%><title>清空数据</title>
清空操作结束！