⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 cleanup_monthly.jsp

📁 论坛软件系统亦称电子公告板(BBS)系统
💻 JSP
字号:
<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<jsp:directive.page import="cn.jsprun.utils.BeanFactory"/>
<%@page import="cn.jsprun.dao.CronsDao"%>
<%@page import="java.sql.Connection"%>
<%! 
	private String tablepre = "jrun_"; 
	private CronsDao cronsDao = ((CronsDao)BeanFactory.getBean("cronsSetDao"));
%>
<%
	int timestamp=(Integer)request.getAttribute("timestamp");
	Connection connection = (Connection)request.getAttribute("connection");
	String myrecorddaysValue = null;
	List<Map<String,String>> tempList = cronsDao.executeQuery(connection,"SELECT value FROM "+tablepre+"settings WHERE variable='myrecorddays'");
	if(tempList!=null&&tempList.size()!=0){
		Map<String,String> tempMap = tempList.get(0);
		if(tempMap!=null){
			myrecorddaysValue = tempMap.get("value");
		}
	}
	int myrecorddays = timestamp - Integer.valueOf(myrecorddaysValue) * 86400;
	cronsDao.execute(connection,"DELETE FROM "+tablepre+"mythreads WHERE dateline<"+myrecorddays);
	cronsDao.execute(connection,"DELETE FROM "+tablepre+"myposts WHERE dateline<"+myrecorddays);
	cronsDao.execute(connection,"DELETE FROM "+tablepre+"invites WHERE dateline<"+(timestamp - 2592000)+" AND status='4'");
	cronsDao.execute(connection,"TRUNCATE "+tablepre+"relatedthreads");

	RequestDispatcher dispatcher = request.getRequestDispatcher("/include/crons/setNextrun.jsp");
	try {
		dispatcher.include(request, response);
	} catch (Exception e) {
		e.printStackTrace();
	} 
	Map<String,String> crons = (Map<String,String>)request.getAttribute("crons");
	if("0".equals(crons.get("available"))){
		cronsDao.execute(connection,"UPDATE "+tablepre+"crons SET available='0' WHERE cronid="+crons.get("cronid"));
	}else{
		cronsDao.execute(connection,"UPDATE "+tablepre+"crons SET lastrun='"+timestamp+"',nextrun='"+crons.get("nextrun")+"' WHERE cronid="+crons.get("cronid"));
	}
%>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -