Esempio n. 1
0
    exit;
}
require_once QA_INCLUDE_DIR . 'db/recalc.php';
require_once QA_INCLUDE_DIR . 'app/admin.php';
require_once QA_INCLUDE_DIR . 'db/admin.php';
//	Check admin privileges (do late to allow one DB query)
if (!qa_admin_check_privileges($qa_content)) {
    return $qa_content;
}
//	Get the information to display
$qcount = (int) qa_opt('cache_qcount');
$qcount_anon = qa_db_count_posts('Q', false);
$acount = (int) qa_opt('cache_acount');
$acount_anon = qa_db_count_posts('A', false);
$ccount = (int) qa_opt('cache_ccount');
$ccount_anon = qa_db_count_posts('C', false);
//	Prepare content for theme
$qa_content = qa_content_prepare();
$qa_content['title'] = qa_lang_html('admin/admin_title') . ' - ' . qa_lang_html('admin/stats_title');
$qa_content['error'] = qa_admin_page_error();
$qa_content['form'] = array('style' => 'wide', 'fields' => array('q2a_version' => array('label' => qa_lang_html('admin/q2a_version'), 'value' => qa_html(QA_VERSION)), 'q2a_date' => array('label' => qa_lang_html('admin/q2a_build_date'), 'value' => qa_html(QA_BUILD_DATE)), 'q2a_latest' => array('label' => qa_lang_html('admin/q2a_latest_version'), 'type' => 'custom', 'html' => '<iframe src="http://www.question2answer.org/question2answer-latest.php?version=' . urlencode(QA_VERSION) . '&language=' . urlencode(qa_opt('site_language')) . '" width="100" height="16" style="vertical-align:middle; border:0; background:transparent;" allowTransparency="true" scrolling="no" frameborder="0"></iframe>'), 'break0' => array('type' => 'blank'), 'db_version' => array('label' => qa_lang_html('admin/q2a_db_version'), 'value' => qa_html(qa_opt('db_version'))), 'db_size' => array('label' => qa_lang_html('admin/q2a_db_size'), 'value' => qa_html(number_format(qa_db_table_size() / 1048576, 1) . ' MB')), 'break1' => array('type' => 'blank'), 'php_version' => array('label' => qa_lang_html('admin/php_version'), 'value' => qa_html(phpversion())), 'mysql_version' => array('label' => qa_lang_html('admin/mysql_version'), 'value' => qa_html(qa_db_mysql_version())), 'break2' => array('type' => 'blank'), 'qcount' => array('label' => qa_lang_html('admin/total_qs'), 'value' => qa_html(number_format($qcount))), 'qcount_users' => array('label' => qa_lang_html('admin/from_users'), 'value' => qa_html(number_format($qcount - $qcount_anon))), 'qcount_anon' => array('label' => qa_lang_html('admin/from_anon'), 'value' => qa_html(number_format($qcount_anon))), 'break3' => array('type' => 'blank'), 'acount' => array('label' => qa_lang_html('admin/total_as'), 'value' => qa_html(number_format($acount))), 'acount_users' => array('label' => qa_lang_html('admin/from_users'), 'value' => qa_html(number_format($acount - $acount_anon))), 'acount_anon' => array('label' => qa_lang_html('admin/from_anon'), 'value' => qa_html(number_format($acount_anon))), 'break4' => array('type' => 'blank'), 'ccount' => array('label' => qa_lang_html('admin/total_cs'), 'value' => qa_html(number_format($ccount))), 'ccount_users' => array('label' => qa_lang_html('admin/from_users'), 'value' => qa_html(number_format($ccount - $ccount_anon))), 'ccount_anon' => array('label' => qa_lang_html('admin/from_anon'), 'value' => qa_html(number_format($ccount_anon))), 'break5' => array('type' => 'blank'), 'users' => array('label' => qa_lang_html('admin/users_registered'), 'value' => QA_FINAL_EXTERNAL_USERS ? '' : qa_html(number_format(qa_db_count_users()))), 'users_active' => array('label' => qa_lang_html('admin/users_active'), 'value' => qa_html(number_format((int) qa_opt('cache_userpointscount')))), 'users_posted' => array('label' => qa_lang_html('admin/users_posted'), 'value' => qa_html(number_format(qa_db_count_active_users('posts')))), 'users_voted' => array('label' => qa_lang_html('admin/users_voted'), 'value' => qa_html(number_format(qa_db_count_active_users('uservotes'))))));
if (QA_FINAL_EXTERNAL_USERS) {
    unset($qa_content['form']['fields']['users']);
} else {
    unset($qa_content['form']['fields']['users_active']);
}
foreach ($qa_content['form']['fields'] as $index => $field) {
    if (empty($field['type'])) {
        $qa_content['form']['fields'][$index]['type'] = 'static';
    }
}
Esempio n. 2
0
function qa_recalc_stage_length($operation)
{
    switch ($operation) {
        case 'doreindexcontent_pagereindex':
            $length = qa_db_count_pages();
            break;
        case 'doreindexcontent_postreindex':
            $length = qa_opt('cache_qcount') + qa_opt('cache_acount') + qa_opt('cache_ccount');
            break;
        case 'doreindexposts_wordcount':
            $length = qa_db_count_words();
            break;
        case 'dorecalcpoints_recalc':
            $length = qa_opt('cache_userpointscount');
            break;
        case 'dorecountposts_votecount':
        case 'dorecountposts_acount':
        case 'dorecalccategories_postupdate':
            $length = qa_db_count_posts();
            break;
        case 'dorefillevents_refill':
            $length = qa_opt('cache_qcount') + qa_db_count_posts('Q_HIDDEN');
            break;
        case 'dorecalccategories_recount':
        case 'dorecalccategories_backpaths':
            $length = qa_db_count_categories();
            break;
        case 'dodeletehidden_comments':
            $length = count(qa_db_posts_get_for_deleting('C'));
            break;
        case 'dodeletehidden_answers':
            $length = count(qa_db_posts_get_for_deleting('A'));
            break;
        case 'dodeletehidden_questions':
            $length = count(qa_db_posts_get_for_deleting('Q'));
            break;
        case 'doblobstodisk_move':
            $length = qa_db_count_blobs_in_db();
            break;
        case 'doblobstodb_move':
            $length = qa_db_count_blobs_on_disk();
            break;
        default:
            $length = 0;
            break;
    }
    return $length;
}
Esempio n. 3
0
function qa_recalc_stage_length($operation)
{
    switch ($operation) {
        case 'doreindexposts_reindex':
            $length = qa_opt('cache_qcount') + qa_opt('cache_acount') + qa_opt('cache_ccount');
            break;
        case 'doreindexposts_wordcount':
            $length = qa_db_count_words();
            break;
        case 'dorecalcpoints_recalc':
            $length = qa_opt('cache_userpointscount');
            break;
        case 'dorecountposts_recount':
        case 'dorecalccategories_postupdate':
            $length = qa_db_count_posts();
            break;
        case 'dorecalccategories_recount':
        case 'dorecalccategories_backpaths':
            $length = qa_db_count_categories();
            break;
        case 'dodeletehidden_comments':
            $length = count(qa_db_posts_get_for_deleting('C'));
            break;
        case 'dodeletehidden_answers':
            $length = count(qa_db_posts_get_for_deleting('A'));
            break;
        case 'dodeletehidden_questions':
            $length = count(qa_db_posts_get_for_deleting('Q'));
            break;
        default:
            $length = 0;
            break;
    }
    return $length;
}