Discuz.Data/DataProvider/PostTables.cs

(开头部分) 6KB

这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。

using System;
using System.Text;
using System.Data;

using Discuz.Config;
using Discuz.Cache;

namespace Discuz.Data
{
    public class PostTables
    {   
        /// <summary>
        /// 得到当前所用帖子表分表ID
        /// </summary>
        /// <returns>分表ID</returns>
        public static string GetPostTableId()
        {
            DNTCache cache = DNTCache.GetCacheService();
            string postTableId = cache.RetrieveObject("/Forum/PostTableId") as string;
            if (postTableId == null)
            {
                DataTable dt = GetAllPostTableName();
                if (dt != null && dt.Rows.Count > 0)
                {
                    postTableId = dt.Rows[0]["id"].ToString();
                    cache.AddObject("/Forum/PostTableId", postTableId);
                }
            }
            return postTableId;
        }

        /// <summary>
        /// 得到用户帖子分表信息
        /// </summary>
        /// <returns>分表记录集</returns>
        public static DataTable GetAllPostTableName()
        {
            DNTCache cache = DNTCache.GetCacheService();
            DataTable postTables = cache.RetrieveObject("/Forum/PostTables") as DataTable;
            if (postTables == null)
            {
                DataSet ds = DatabaseProvider.GetInstance().GetAllPostTableName();
                if (ds != null && ds.Tables.Count > 0)
                {
                    postTables = ds.Tables[0];
                    cache.AddObject("/Forum/PostTables", postTables);
                }
            }
            return postTables;
        }

        /// <summary>
        /// .重置分表信息(仅限管理后台新建分表时使用
        /// </summary>
        public static void ResetPostTables()
        {
            //如果新建分表后当前IIS站点为多web园且net版本低于4.0, 则重启iis站点
            if (GeneralConfigs.GetConfig().Webgarden > 1 && Environment.Version.Major < 4)
            {
                Discuz.Common.Utils.RestartIISProcess();
后面还有 116 行代码,解锁后查看完整代码

24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明

AI 解读 AI

登录后可用,每次 10 算力,解读结果公开显示在下面。

还没有人解读过这个文件。