当前位置: 首页>>代码示例>>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;未经允许,请勿转载。