<?php

/**
 *
 * @see XenForo_Model_Counters
 */
class Waindigo_InstallUpgrade_Extend_XenForo_Model_Counters extends XFCP_Waindigo_InstallUpgrade_Extend_XenForo_Model_Counters
{

    public function getBoardTotalsCounter()
    {
        $output = parent::getBoardTotalsCounter();

        if (!isset($output['activeUsers'])) {
            $userModel = $this->getModelFromCache('XenForo_Model_User');

            $output['activeUsers'] = $userModel->countUsers(
                array(
                    'user_state' => 'valid',
                    'last_activity' => array(
                        '>',
                        XenForo_Application::$time - 365 * 86400
                    ),
                    'is_banned' => 0,
                    'is_discouraged' => 0
                ));
        }

        return $output;
    }
}