Remove statistics_aggregation_interval setting

This commit is contained in:
Dmitriy Simushev 2014-12-19 12:36:41 +00:00
parent 964e917f4a
commit 8b34ca34c7
5 changed files with 26 additions and 47 deletions

View File

@ -57,7 +57,6 @@ class PerformanceController extends AbstractController
'invitation_lifetime',
'tracking_lifetime',
'thread_lifetime',
'statistics_aggregation_interval',
'max_uploaded_file_size',
);
@ -76,10 +75,6 @@ class PerformanceController extends AbstractController
$page['formonehostconnections'] = $form->get('onehostconnections', $params['max_connections_from_one_host']);
$page['formthreadlifetime'] = $form->get('threadlifetime', $params['thread_lifetime']);
$page['formmaxuploadedfilesize'] = $form->get('maxuploadedfilesize', $params['max_uploaded_file_size']);
$page['formstatistics_aggregation_interval'] = $form->get(
'statistics_aggregation_interval',
$params['statistics_aggregation_interval']
);
if (Settings::get('enabletracking')) {
$page['formfrequencytracking'] = $form->get('frequencytracking', $params['updatefrequency_tracking']);
@ -144,11 +139,6 @@ class PerformanceController extends AbstractController
$errors[] = getlocal("\"Thread lifetime\" field should be a number");
}
$params['statistics_aggregation_interval'] = $request->request->get('statistics_aggregation_interval');
if (!is_numeric($params['statistics_aggregation_interval'])) {
$errors[] = wrong_field("Statistics aggregation interval");
}
if (Settings::get('enabletracking')) {
$params['updatefrequency_tracking'] = $request->request->get('frequencytracking');
if (!is_numeric($params['updatefrequency_tracking'])) {

View File

@ -104,7 +104,6 @@ class Settings
'connection_timeout' => 30, /* Timeout (in seconds) from the last ping when messaging window disconnects */
'updatefrequency_operator' => 2,
'updatefrequency_chat' => 2,
'statistics_aggregation_interval' => 24 * 60 * 60,
'updatefrequency_tracking' => 10,
'visitors_limit' => 20, /* Number of visitors to look over */
'invitation_lifetime' => 60, /* Lifetime for invitation to chat */

View File

@ -67,3 +67,8 @@ define('USERNAME_COOKIE_NAME', 'MIBEW_Data');
* Mailbox of the current installation
*/
define('MIBEW_MAILBOX', $configs['mailbox']);
/**
* Represents statistics aggregation interval in seconds.
*/
define('STATISTICS_AGGREGATION_INTERVAL', 24 * 60 * 60);

View File

@ -166,8 +166,6 @@ function calculate_thread_statistics()
$db = Database::getInstance();
$db_throw_exceptions = $db->throwExeptions(true);
$interval = Settings::get('statistics_aggregation_interval');
try {
// Start transaction
$db->query('START TRANSACTION');
@ -180,7 +178,7 @@ function calculate_thread_statistics()
);
$start = empty($result['start']) ? 0 : $result['start'];
$today = floor(time() / $interval) * $interval;
$today = floor(time() / STATISTICS_AGGREGATION_INTERVAL) * STATISTICS_AGGREGATION_INTERVAL;
// Calculate statistics
// Get base threads info
@ -211,7 +209,7 @@ function calculate_thread_statistics()
. "WHERE t.threadid = tmp.threadid "
. "AND (t.dtmcreated - :start) > :interval "
// Calculate statistics only for threads that older than
// statistics_aggregation_interval
// statistics aggregation interval
. "AND (:today - t.dtmcreated) > :interval "
// Ignore threads when operator does not start chat
. "AND t.dtmchatstarted <> 0 "
@ -222,7 +220,7 @@ function calculate_thread_statistics()
array(
':start' => $start,
':today' => $today,
':interval' => $interval,
':interval' => STATISTICS_AGGREGATION_INTERVAL,
':not_invited' => Thread::INVITATION_NOT_INVITED,
':invitation_accepted' => Thread::INVITATION_ACCEPTED,
':kind_agent' => Thread::KIND_AGENT,
@ -245,7 +243,7 @@ function calculate_thread_statistics()
. "FROM {thread} "
. "WHERE (dtmcreated - :start) > :interval "
// Calculate statistics only for threads that older than
// statistics_aggregation_interval
// statistics aggregation interval
. "AND (:today - dtmcreated) > :interval "
// Ignore threads when operator does not start chat
. "AND dtmchatstarted = 0 "
@ -255,7 +253,7 @@ function calculate_thread_statistics()
array(
':start' => $start,
':today' => $today,
':interval' => $interval,
':interval' => STATISTICS_AGGREGATION_INTERVAL,
':not_invited' => Thread::INVITATION_NOT_INVITED,
),
array('return_rows' => Database::RETURN_ALL_ROWS)
@ -275,7 +273,7 @@ function calculate_thread_statistics()
. "FROM {thread} "
. "WHERE (dtmcreated - :start) > :interval "
// Calculate statistics only for threads that older than
// statistics_aggregation_interval
// statistics aggregation interval
. "AND (:today - dtmcreated) > :interval "
// Ignore threads when operator does not start chat
. "AND dtmchatstarted <> 0 "
@ -285,7 +283,7 @@ function calculate_thread_statistics()
array(
':start' => $start,
':today' => $today,
':interval' => $interval,
':interval' => STATISTICS_AGGREGATION_INTERVAL,
':not_invited' => Thread::INVITATION_NOT_INVITED,
),
array('return_rows' => Database::RETURN_ALL_ROWS)
@ -308,7 +306,7 @@ function calculate_thread_statistics()
. "FROM {thread} "
. "WHERE (dtmcreated - :start) > :interval "
// Calculate statistics only for threads that older than
// statistics_aggregation_interval
// statistics aggregation interval
. "AND (:today - dtmcreated) > :interval "
. "AND (invitationstate = :invitation_accepted "
. "OR invitationstate = :invitation_rejected "
@ -317,7 +315,7 @@ function calculate_thread_statistics()
array(
':start' => $start,
':today' => $today,
':interval' => $interval,
':interval' => STATISTICS_AGGREGATION_INTERVAL,
':invitation_accepted' => Thread::INVITATION_ACCEPTED,
':invitation_rejected' => Thread::INVITATION_REJECTED,
':invitation_ignored' => Thread::INVITATION_IGNORED,
@ -402,8 +400,6 @@ function calculate_operator_statistics()
$db = Database::getInstance();
$db_throw_exceptions = $db->throwExeptions(true);
$interval = Settings::get('statistics_aggregation_interval');
try {
// Start transaction
$db->query('START TRANSACTION');
@ -416,7 +412,7 @@ function calculate_operator_statistics()
);
$start = empty($result['start']) ? 0 : $result['start'];
$today = floor(time() / $interval) * $interval;
$today = floor(time() / STATISTICS_AGGREGATION_INTERVAL) * STATISTICS_AGGREGATION_INTERVAL;
// Caclculate statistics
// Get base operator's info
@ -434,7 +430,7 @@ function calculate_operator_statistics()
. "AND m.threadid = t.threadid "
. "AND (m.dtmcreated - :start) > :interval "
// Calculate statistics only for messages that older
// statistics_aggregation_interval
// statistics aggregation interval
. "AND (:today - m.dtmcreated) > :interval "
// Ignore not accepted invitations
. "AND (t.invitationstate = :not_invited "
@ -443,7 +439,7 @@ function calculate_operator_statistics()
array(
':start' => $start,
':today' => $today,
':interval' => $interval,
':interval' => STATISTICS_AGGREGATION_INTERVAL,
':not_invited' => Thread::INVITATION_NOT_INVITED,
':invitation_accepted' => Thread::INVITATION_ACCEPTED,
':kind_agent' => Thread::KIND_AGENT,
@ -469,7 +465,7 @@ function calculate_operator_statistics()
. "FROM {thread} "
. "WHERE (dtmcreated - :start) > :interval "
// Calculate statistics only for threads that older than
// statistics_aggregation_interval
// statistics aggregation interval
. "AND (:today - dtmcreated) > :interval "
// Check if thread has related operator
. "AND agentid != 0 "
@ -481,7 +477,7 @@ function calculate_operator_statistics()
array(
':start' => $start,
':today' => $today,
':interval' => $interval,
':interval' => STATISTICS_AGGREGATION_INTERVAL,
':invitation_accepted' => Thread::INVITATION_ACCEPTED,
':invitation_rejected' => Thread::INVITATION_REJECTED,
':invitation_ignored' => Thread::INVITATION_IGNORED,
@ -561,8 +557,6 @@ function calculate_page_statistics()
$db = Database::getInstance();
$db_throw_exceptions = $db->throwExeptions(true);
$interval = Settings::get('statistics_aggregation_interval');
try {
// Start transaction
$db->query('START TRANSACTION');
@ -575,7 +569,7 @@ function calculate_page_statistics()
);
$start = empty($result['start']) ? 0 : $result['start'];
$today = floor(time() / $interval) * $interval;
$today = floor(time() / STATISTICS_AGGREGATION_INTERVAL) * STATISTICS_AGGREGATION_INTERVAL;
$statistics = array();
@ -593,7 +587,7 @@ function calculate_page_statistics()
array(
':start' => $start,
':today' => $today,
':interval' => $interval,
':interval' => STATISTICS_AGGREGATION_INTERVAL,
),
array('return_rows' => Database::RETURN_ALL_ROWS)
);
@ -632,7 +626,7 @@ function calculate_page_statistics()
array(
':start' => $start,
':today' => $today,
':interval' => $interval,
':interval' => STATISTICS_AGGREGATION_INTERVAL,
':not_invited' => Thread::INVITATION_NOT_INVITED,
':invitation_accepted' => Thread::INVITATION_ACCEPTED,
':kind_agent' => Thread::KIND_AGENT,
@ -665,7 +659,7 @@ function calculate_page_statistics()
array(
':start' => $start,
':today' => $today,
':interval' => $interval,
':interval' => STATISTICS_AGGREGATION_INTERVAL,
':invitation_accepted' => Thread::INVITATION_ACCEPTED,
),
array('return_rows' => Database::RETURN_ALL_ROWS)
@ -695,7 +689,7 @@ function calculate_page_statistics()
array(
':start' => $start,
':today' => $today,
':interval' => $interval,
':interval' => STATISTICS_AGGREGATION_INTERVAL,
':invitation_rejected' => Thread::INVITATION_REJECTED,
),
array('return_rows' => Database::RETURN_ALL_ROWS)
@ -725,7 +719,7 @@ function calculate_page_statistics()
array(
':start' => $start,
':today' => $today,
':interval' => $interval,
':interval' => STATISTICS_AGGREGATION_INTERVAL,
':invitation_ignored' => Thread::INVITATION_IGNORED,
),
array('return_rows' => Database::RETURN_ALL_ROWS)
@ -782,7 +776,7 @@ function calculate_page_statistics()
. "AND calculated = 0"),
array(
':today' => $today,
':interval' => $interval,
':interval' => STATISTICS_AGGREGATION_INTERVAL,
)
);

View File

@ -80,15 +80,6 @@
<br clear="all"/>
</div>
<div class="field">
<label for="statistics-aggregation-interval" class="field-label">{{l10n "Statistics aggregation interval"}}</label>
<div class="field-value">
<input id="statistics-aggregation-interval" type="text" name="statistics_aggregation_interval" size="40" value="{{formstatistics_aggregation_interval}}" class="field-input"/>
</div>
<label for="statistics-aggregation-interval" class="field-description"> &mdash; {{l10n "Specify interval for statistics aggregation in seconds. Default is 86400 (one day)"}}</label>
<br clear="all"/>
</div>
{{#if enabletracking}}
<div class="field">
<label for="tracking-frequency" class="field-label">{{l10n "Tracking refresh time"}}</label>