當前位置: 首頁>>代碼示例>>PHP>>正文


PHP qa_should_update_counts函數代碼示例

本文整理匯總了PHP中qa_should_update_counts函數的典型用法代碼示例。如果您正苦於以下問題:PHP qa_should_update_counts函數的具體用法?PHP qa_should_update_counts怎麽用?PHP qa_should_update_counts使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。


在下文中一共展示了qa_should_update_counts函數的11個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: qa_db_hotness_update

function qa_db_hotness_update($firstpostid, $lastpostid = null, $viewincrement = false)
{
    if (qa_should_update_counts()) {
        if (!isset($lastpostid)) {
            $lastpostid = $firstpostid;
        }
        $query = 'UPDATE ^posts AS x, (SELECT parents.postid, parents.created AS qcreated, COALESCE(MAX(children.created), parents.created) as acreated, COUNT(children.postid) AS acount, parents.netvotes, parents.views FROM ^posts AS parents LEFT JOIN ^posts AS children ON parents.postid=children.parentid AND children.type=\'A\' WHERE parents.postid>=# AND parents.postid<=# AND parents.type=\'Q\' GROUP BY postid) AS a SET x.hotness=(' . '((TO_DAYS(a.qcreated)-734138)*86400.0+TIME_TO_SEC(a.qcreated))*# + ' . '((TO_DAYS(a.acreated)-734138)*86400.0+TIME_TO_SEC(a.acreated))*# + ' . '(a.acount+0.0)*# + ' . '(a.netvotes+0.0)*# + ' . '(a.views+0.0+#)*#' . ')' . ($viewincrement ? ', x.views=x.views+1, x.lastviewip=INET_ATON($)' : '') . ' WHERE x.postid=a.postid';
        //	Additional multiples based on empirical analysis of activity on Q2A meta site to give approx equal influence for all factors
        $arguments = array($firstpostid, $lastpostid, qa_opt('hot_weight_q_age'), qa_opt('hot_weight_a_age'), qa_opt('hot_weight_answers') * 160000, qa_opt('hot_weight_votes') * 160000, $viewincrement ? 1 : 0, qa_opt('hot_weight_views') * 4000);
        if ($viewincrement) {
            $arguments[] = qa_remote_ip_address();
        }
        qa_db_query_raw(qa_db_apply_sub($query, $arguments));
    }
}
開發者ID:TheProjecter,項目名稱:microprobe,代碼行數:15,代碼來源:qa-db-hotness.php

示例2: qa_db_queuedcount_update

function qa_db_queuedcount_update()
{
    if (qa_should_update_counts()) {
        qa_db_query_sub("REPLACE ^options (title, content) SELECT 'cache_queuedcount', COUNT(*) FROM ^posts WHERE type IN ('Q_QUEUED', 'A_QUEUED', 'C_QUEUED')");
    }
}
開發者ID:mostafiz93,項目名稱:PrintfScanf,代碼行數:6,代碼來源:qa-db-post-create.php

示例3: qa_db_post_recount_flags

function qa_db_post_recount_flags($postid)
{
    if (qa_should_update_counts()) {
        qa_db_query_sub('UPDATE ^posts AS x, (SELECT COALESCE(SUM(IF(flag, 1, 0)),0) AS flagcount FROM ^uservotes WHERE postid=#) AS a SET x.flagcount=a.flagcount WHERE x.postid=#', $postid, $postid);
    }
}
開發者ID:bafio89,項目名稱:qea-u,代碼行數:6,代碼來源:votes.php

示例4: qa_db_uapprovecount_update

function qa_db_uapprovecount_update()
{
    if (qa_should_update_counts() && !QA_FINAL_EXTERNAL_USERS) {
        qa_db_query_sub("REPLACE ^options (title, content) SELECT 'cache_uapprovecount', COUNT(*) FROM ^users WHERE level<# AND NOT (flags&#)", QA_USER_LEVEL_APPROVED, QA_USER_FLAGS_USER_BLOCKED);
    }
}
開發者ID:bafio89,項目名稱:qea-u,代碼行數:6,代碼來源:qa-db-users.php

示例5: qa_db_unupaqcount_update

function qa_db_unupaqcount_update()
{
    if (qa_should_update_counts()) {
        qa_db_query_sub("REPLACE ^options (title, content) SELECT 'cache_unupaqcount', COUNT(*) FROM ^posts WHERE type='Q' AND amaxvote=0");
    }
}
開發者ID:ramo01,項目名稱:1kapp,代碼行數:6,代碼來源:qa-db-post-create.php

示例6: qa_db_userpointscount_update

function qa_db_userpointscount_update()
{
    if (qa_should_update_counts()) {
        qa_db_query_sub("REPLACE ^options (title, content) SELECT 'cache_userpointscount', COUNT(*) FROM ^userpoints");
    }
}
開發者ID:kosmoluna,項目名稱:question2answer,代碼行數:6,代碼來源:points.php

示例7: qa_db_queuedcount_update

function qa_db_queuedcount_update()
{
    if (qa_should_update_counts()) {
        qa_db_query_sub("INSERT INTO ^options (title, content) " . "SELECT 'cache_queuedcount', COUNT(*) FROM ^posts " . "WHERE type IN ('Q_QUEUED', 'A_QUEUED', 'C_QUEUED') " . "ON DUPLICATE KEY UPDATE content = VALUES(content)");
    }
}
開發者ID:nikhilkumar80,項目名稱:question2answer,代碼行數:6,代碼來源:post-create.php

示例8: qa_db_flaggedcount_update

function qa_db_flaggedcount_update()
{
    if (qa_should_update_counts()) {
        qa_db_query_sub("REPLACE ^options (title, content) SELECT 'cache_flaggedcount', COUNT(*) FROM ^posts WHERE flagcount>0 AND type IN ('Q', 'A', 'C')");
    }
}
開發者ID:mostafiz93,項目名稱:PrintfScanf,代碼行數:6,代碼來源:qa-db-post-update.php

示例9: qa_db_user_recount_posts

function qa_db_user_recount_posts($userid)
{
    if (qa_should_update_counts()) {
        qa_db_query_sub("UPDATE ^users AS x, (SELECT COUNT(*) AS wallposts FROM ^messages WHERE touserid=# AND type='PUBLIC') AS a SET x.wallposts=a.wallposts WHERE x.userid=#", $userid, $userid);
    }
}
開發者ID:gogupe,項目名稱:question2answer-releases,代碼行數:6,代碼來源:qa-db-messages.php

示例10: qa_db_uapprovecount_update

function qa_db_uapprovecount_update()
{
    if (qa_should_update_counts() && !QA_FINAL_EXTERNAL_USERS) {
        qa_db_query_sub("INSERT INTO ^options (title, content) " . "SELECT 'cache_uapprovecount', COUNT(*) FROM ^users " . "WHERE level < # AND NOT (flags & #) " . "ON DUPLICATE KEY UPDATE content = VALUES(content)", QA_USER_LEVEL_APPROVED, QA_USER_FLAGS_USER_BLOCKED);
    }
}
開發者ID:nikhilkumar80,項目名稱:question2answer,代碼行數:6,代碼來源:users.php

示例11: qa_db_userpointscount_update

function qa_db_userpointscount_update()
{
    if (qa_should_update_counts()) {
        qa_db_query_sub("INSERT INTO ^options (title, content) " . "SELECT 'cache_userpointscount', COUNT(*) FROM ^userpoints " . "ON DUPLICATE KEY UPDATE content = VALUES(content)");
    }
}
開發者ID:nikhilkumar80,項目名稱:question2answer,代碼行數:6,代碼來源:points.php


注:本文中的qa_should_update_counts函數示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。