function a587_stats_addtruncate($params) { global $I18N; if (rex_request('func') == 'truncate') { $stats = new rexsearchStats(); $stats->truncate(); a587_stats_saveSettings(array('maxtopSearchitems' => '10', 'searchtermselect' => '', 'searchtermselectmonthcount' => '12')); $params['subject'] = rex_info($I18N->Msg('a587_stats_truncate_done')) . $params['subject']; } $params['subject'] .= '<p class="rex-tx1">' . $I18N->Msg('a587_stats_truncate') . '</p> <p class="rex-button"><a onclick="return confirm(\'' . $I18N->Msg('a587_stats_truncate_confirm') . '\');" href="index.php?page=rexsearch&subpage=generate&func=truncate" class="rex-button"><span>' . $I18N->Msg('a587_stats_truncate_button') . '</span></a></p>'; return $params['subject']; }
break; } } include $REX['INCLUDE_PATH'] . '/layout/top.php'; rex_title("rexsearch", $REX['ADDON'][$page]['SUBPAGES']); ?> <div class="rex-addon-output" id="a587-form"> <h2 class="rex-hl2" style="position: relative;"><?php echo $I18N->Msg('a587_stats_title'); ?> </h2> <div class="rex-form"> <form method="post" action="index.php?page=rexsearch&subpage=stats" id="a587_stats_form"> <?php $stats = new rexsearchStats(); #$stats->createTestData(); #error_reporting(E_ALL); // general stats $sql = new rex_sql(); $generalstats = $sql->getArray('SELECT ((SELECT COUNT(DISTINCT ftable,fid) as count FROM `' . $REX['TABLE_PREFIX'] . '587_searchindex` WHERE ftable IS NOT NULL) + (SELECT COUNT(DISTINCT fid) as count FROM `' . $REX['TABLE_PREFIX'] . '587_searchindex` WHERE ftable IS NULL)) AS 010_uniquedatasetcount, (SELECT AVG(resultcount) FROM `' . $REX['TABLE_PREFIX'] . '587_stats_searchterms`) AS 020_averageresultcount, (SELECT COUNT(*) FROM `' . $REX['TABLE_PREFIX'] . '587_stats_searchterms` WHERE resultcount > 0) AS 040_successfullsearchescount, (SELECT COUNT(*) FROM `' . $REX['TABLE_PREFIX'] . '587_stats_searchterms` WHERE resultcount = 0) AS 050_failedsearchescount, (SELECT COUNT(DISTINCT term) FROM `' . $REX['TABLE_PREFIX'] . '587_stats_searchterms`) AS 060_uniquesearchterms'); $generalstats = $generalstats[0]; $generalstats['030_searchescount'] = $generalstats['040_successfullsearchescount'] + $generalstats['050_failedsearchescount']; $generalstats['100_datalength'] = 0; $generalstats['110_indexlength'] = 0; foreach ($sql->getArray("SHOW TABLE STATUS LIKE '" . $REX['TABLE_PREFIX'] . "587_%'") as $table) {