Пример #1
0
function reAllCache()
{
    global $arrSideModule;
    categories_recount();
    categories_recache();
    calendar_recache();
    statistics_recache();
    hottags_recache();
    archives_recache();
    links_recache();
    filters_recache();
    keywords_recache();
    recentLogs_recache();
    recentComments_recache();
    recentGbooks_recache();
    logsTitle_recache();
    modulesSetting_recache();
    download_recache();
    attachments_recache();
    members_recache();
    skinlist_recache();
    online_recache();
    logs_sidebar_recache($arrSideModule);
}
Пример #2
0
    if ($doit && ($cids = implode_ids($_POST['selectall']))) {
        if ($del) {
            $DB->unbuffered_query("DELETE FROM {$db_prefix}comments WHERE commentid IN ({$cids})");
        } else {
            $DB->unbuffered_query("UPDATE {$db_prefix}comments SET visible='{$visible}' WHERE commentid IN ({$cids})");
        }
        $comment_count = $DB->result($DB->query("SELECT COUNT(commentid) FROM {$db_prefix}comments c LEFT JOIN {$db_prefix}articles a ON (a.articleid=c.articleid) WHERE a.visible='1' AND c.visible='1'"), 0);
        $DB->query("UPDATE {$db_prefix}statistics SET comment_count='{$comment_count}'");
        $query = $DB->query("SELECT articleid FROM {$db_prefix}articles");
        while ($article = $DB->fetch_array($query)) {
            // 更新所有文章的评论数
            $total = $DB->result($DB->query("SELECT COUNT(commentid) FROM {$db_prefix}comments WHERE articleid='" . $article['articleid'] . "' AND visible='1'"), 0);
            $DB->unbuffered_query("UPDATE {$db_prefix}articles SET comments='{$total}' WHERE articleid='" . $article['articleid'] . "'");
        }
        newcomments_recache();
        statistics_recache();
    } else {
        $location = getlink('comment', 'list', array('message' => 11));
    }
    header("Location: {$location}");
    exit;
}
if ($action == 'mod') {
    $comment = $DB->fetch_one_array("SELECT c.articleid,c.commentid,c.author,c.url,c.email,c.dateline,c.content, a.title FROM {$db_prefix}comments c LEFT JOIN {$db_prefix}articles a ON (a.articleid=c.articleid) WHERE commentid='{$commentid}'");
    if (!$comment) {
        $message = '评论不存在';
        $action = 'list';
    } else {
        $comment['content'] = htmlspecialchars($comment['content']);
    }
    $subnav = '修改评论';
function rethestats($cachename = '')
{
    global $DB, $db_prefix;
    if (!$cachename || $cachename == 'settings') {
        settings_recache();
    }
    if (!$cachename || $cachename == 'statistics') {
        // 更新首页显示的文章数
        $article_count = $DB->result($DB->query("SELECT COUNT(articleid) FROM {$db_prefix}articles WHERE visible = '1'"), 0);
        // 更新首页显示的评论数
        $comment_count = $DB->result($DB->query("SELECT COUNT(commentid) FROM {$db_prefix}comments c LEFT JOIN {$db_prefix}articles a ON (a.articleid=c.articleid) WHERE a.visible='1' AND c.visible='1'"), 0);
        // 更新首页显示的标签(Tags)数
        $tag_count = $DB->result($DB->query("SELECT COUNT(mid) FROM {$db_prefix}metas WHERE type='tag'"), 0);
        $DB->unbuffered_query("UPDATE {$db_prefix}statistics SET article_count='{$article_count}', comment_count='{$comment_count}', tag_count='{$tag_count}'");
        //$DB->unbuffered_query("DELETE FROM {$db_prefix}metas WHERE type='tag' AND count=0");
        // 更新主人发表文章数
        $query = $DB->query("SELECT userid,articles FROM {$db_prefix}users WHERE groupid='1' OR groupid='2'");
        while ($user = $DB->fetch_array($query)) {
            $total = $DB->result($DB->query("SELECT COUNT(articleid) FROM {$db_prefix}articles WHERE visible = '1' AND uid='" . $user['userid'] . "'"), 0);
            if ($user['articles'] != $total) {
                $DB->unbuffered_query("UPDATE {$db_prefix}users SET articles='{$total}' WHERE userid='" . $user['userid'] . "'");
            }
        }
        statistics_recache();
    }
    if (!$cachename || $cachename == 'newarticles') {
        newarticles_recache();
    }
    if (!$cachename || $cachename == 'stick') {
        stick_recache();
    }
    if (!$cachename || $cachename == 'newcomments') {
        newcomments_recache();
    }
    if (!$cachename || $cachename == 'categories') {
        // 更新所有文章的评论数
        $query = $DB->query("SELECT mid,count FROM {$db_prefix}metas");
        while ($meta = $DB->fetch_array($query)) {
            $ctotal = get_meta_article_count($meta['mid']);
            if ($meta['count'] != $ctotal) {
                update_meta_count($meta['mid'], $ctotal);
            }
        }
        categories_recache();
    }
    if (!$cachename || $cachename == 'archives') {
        // 重建文章数据
        $query = $DB->query("SELECT articleid,comments FROM {$db_prefix}articles");
        while ($article = $DB->fetch_array($query)) {
            // 更新所有文章的评论数
            $ctotal = $DB->result($DB->query("SELECT COUNT(commentid) FROM {$db_prefix}comments WHERE articleid='" . $article['articleid'] . "' AND visible='1'"), 0);
            if ($article['comments'] != $ctotal) {
                $DB->unbuffered_query("UPDATE {$db_prefix}articles SET comments='{$ctotal}' WHERE articleid='" . $article['articleid'] . "'");
            }
        }
        archives_recache();
    }
    if (!$cachename || $cachename == 'hottags') {
        hottags_recache();
    }
    if (!$cachename || $cachename == 'links') {
        links_recache();
    }
    if (!$cachename || $cachename == 'stylevars') {
        stylevars_recache();
    }
    if (!$cachename || $cachename == 'allarticleids') {
        allarticleids_recache();
    }
}
Пример #4
0
function reAllCache()
{
    settings_recache();
    modules_recache();
    categories_recache();
    hottags_recache();
    archives_recache();
    links_recache();
    keywords_recache();
    filters_recache();
    recentLogs_recache();
    recentGbooks_recache();
    recentComments_recache();
    calendar_recache();
    statistics_recache();
    categories_recount();
}
function restats()
{
    allarticleids_recache();
    links_recache();
    newarticles_recache();
    newcomments_recache();
    settings_recache();
    categories_recache();
    statistics_recache();
    archives_recache();
    hottags_recache();
    stylevars_recache();
    stick_recache();
}