This repository has been archived on 2024-04-08. You can view files and clone it, but cannot push or open issues or pull requests.
phptsmadmin/application/classes/Model/STATUS.php
2012-12-13 13:58:45 +11:00

50 lines
1.4 KiB
PHP

<?php defined('SYSPATH') or die('No direct access allowed.');
/**
*
* @package PTA
* @subpackage Server Status
* @category Models
* @author Deon George
* @copyright (c) 2010 phpTSMadmin Development Team
* @license http://phptsmadmin.sf.net/license.html
*/
class Model_STATUS extends ORM_TSM {
protected $_table_name = 'STATUS';
protected $_primary_key = 'SERVER_NAME';
protected $_sorting = array(
'SERVER_NAME'=>'ASC',
);
/**
* Get all the ACTIVITIY LOG for this SERVER
*/
private function _actlog() {
Log::instance()->add(LOG::DEBUG,'ENTER :method',array(':method'=>__METHOD__));
$k = sprintf('%s-%s',__METHOD__,$this->SERVER_NAME);
$c = Kohana::$config->load('config')->cache;
if (is_null($result = Cache::instance($c)->get($k))) {
// We cant load all records here, like we do with the others, there is too much data!
// Due to the volume of data that could be retrieved, we'll only get the last tsmserveractlog days
$result = ORM::factory('ACTLOG')
->ExcludeSERVER()
->where('ORIGINATOR','IN',array('SERVER'))
->and_where('DATE_TIME','>=',date('Y-m-d H:00:00',time()-3600*Kohana::$config->load('config')->tsmserveractlog))
->find_all();
// @todo Cache time should be configurble
Cache::instance($c)->set($k,$result,300);
}
Log::instance()->add(LOG::DEBUG,'EXIT :method',array(':method'=>__METHOD__));
return $result;
}
public function activity() {
return $this->_actlog();
}
}
?>