<!-- #include file=../../inc/BBSSetup.asp -->
<!-- #include file=../../inc/Board_Popfun.asp -->
<!-- #include file=../inc/bbsmanage_Fun.asp -->
<%
DEF_BBS_HomeUrl = "../../"
Dim GBL_ID
initDatabase
GBL_CHK_TempStr = ""
GBL_ID = checkSupervisorPass

If GBL_CHK_Flag=1 Then
	GBL_CHK_TempStr = ""
	ExeCuteFullTEXTCommands
	Response.Write GBL_CHK_TempStr
Else
	Response.Write "<span style=""FONT-FAMILY: 宋体; FONT-SIZE: 12px;""><font color=ff0000 class=RedFont><b>操作失败!</b></font></span>"
End If
closeDataBase

Function ExeCuteFullTEXTCommands

	Dim Rs,SQL,DBName
	If DEF_UsedDataBase = 1 Then
		GBL_CHK_TempStr = "<span style=""FONT-FAMILY: 宋体; FONT-SIZE: 12px;color:ff0000"">Access数据库不支持全文索引服务!</span>"
		Exit Function
	End If

	On Error Resume Next
	Dim ExeFlag
	ExeFlag = Left(Request("ExeFlag"),14)
	If isNumeric(ExeFlag) = 0 Then ExeFlag = 0
	ExeFlag = cCur(ExeFlag)
	
	Select Case ExeFlag
		Case 1: Con.ExeCute("exec sp_fulltext_database N'enable'")
				GBL_DBNum = GBL_DBNum + 1
			GBL_CHK_TempStr = "成功为数据库启用全文索引!<br>" & VbCrLf
		Case 2: Con.ExeCute("exec sp_fulltext_database N'disable'")
				GBL_DBNum = GBL_DBNum + 1
			GBL_CHK_TempStr = "成功为数据库禁用全文索引!<br>" & VbCrLf
		Case 3: Con.ExeCute("exec sp_fulltext_table @tabname='LeadBBS_Announce',@action='start_change_tracking'")
				GBL_DBNum = GBL_DBNum + 1
			GBL_CHK_TempStr = "成功启动全文索引增量填充(更改跟踪)!<br>" & VbCrLf
		Case 4: Con.ExeCute("exec sp_fulltext_table @tabname='LeadBBS_Announce',@action='stop_change_tracking'")
				GBL_DBNum = GBL_DBNum + 1
			GBL_CHK_TempStr = "成功停止全文索引增量填充(更改跟踪)!<br>" & VbCrLf
		Case 5: Con.ExeCute("exec sp_fulltext_table @tabname='LeadBBS_Announce',@action='Start_background_updateindex'")
				GBL_DBNum = GBL_DBNum + 1
			GBL_CHK_TempStr = "成功启动更新后台中的索引!<br>" & VbCrLf
		Case 6: Con.ExeCute("exec sp_fulltext_table @tabname='LeadBBS_Announce',@action='Stop_background_updateindex'")
				GBL_DBNum = GBL_DBNum + 1
			GBL_CHK_TempStr = "成功停止更新后台中的索引!<br>" & VbCrLf
		Case 7: Con.ExeCute("exec sp_fulltext_table @tabname='LeadBBS_Announce',@action='update_index'")
				GBL_DBNum = GBL_DBNum + 1
			GBL_CHK_TempStr = "成功更新索引!<br>" & VbCrLf
		Case 8: 
				SQL = "Select DB_NAME(DB_ID())"
				Set Rs = Server.CreateObject("ADODB.RecordSet")
				Rs.Open SQL,con,1,1
				If Rs.Eof Then
					DBName = ""
				Else
					DBName = Rs(0)
				End If
				Rs.Close
				Set Rs = Nothing
				Con.ExeCute("backup log " & Replace(DBName,"'","''") & " with no_log")
				GBL_DBNum = GBL_DBNum + 1
				GBL_CHK_TempStr = "成功清除系统日志!<br>" & VbCrLf
		Case 9: 
				SQL = "Select DB_NAME(DB_ID())"
				Set Rs = Server.CreateObject("ADODB.RecordSet")
				Rs.Open SQL,con,1,1
				If Rs.Eof Then
					DBName = ""
				Else
					DBName = Rs(0)
				End If
				Rs.Close
				Set Rs = Nothing
				Con.ExeCute("DBCC SHRINKFILE (" & Replace(DBName,"'","''") & "_log)")
				GBL_DBNum = GBL_DBNum + 1
				GBL_CHK_TempStr = "成功收缩日志文件" & Replace(DBName,"'","''") & "_log!<br>" & VbCrLf
		Case 10:
				SQL = "Select DB_NAME(DB_ID())"
				Set Rs = Server.CreateObject("ADODB.RecordSet")
				Rs.Open SQL,con,1,1
				If Rs.Eof Then
					DBName = ""
				Else
					DBName = Rs(0)
				End If
				Rs.Close
				Set Rs = Nothing
				Con.ExeCute("DBCC SHRINKFILE (" & Replace(DBName,"'","''") & "_Data)")
				GBL_DBNum = GBL_DBNum + 1
				GBL_CHK_TempStr = "成功收缩数据库文件" & Replace(DBName,"'","''") & "_Data!<br>" & VbCrLf
	End Select
	if err.number<>0 Then
		GBL_CHK_TempStr = "<span style=""FONT-FAMILY: 宋体; FONT-SIZE: 12px;""><font color=ff0000 class=RedFont><b>数据库操作失败：</b></font>"&err.description & "</span>"
	Else
		GBL_CHK_TempStr = "<span style=""FONT-FAMILY: 宋体; FONT-SIZE: 12px;""><font color=008800 class=GreenFont><b>" & GBL_CHK_TempStr & "</b></font></span>" & VbCrLf
	End If

End Function
%>