Initial commit

This commit is contained in:
Deon George 2014-10-06 21:57:54 +11:00
commit 62992c1a0e
35 changed files with 2412 additions and 0 deletions

6
.gitmodules vendored Normal file
View File

@ -0,0 +1,6 @@
[submodule "includes/kohana"]
path = includes/kohana
url = /afs/local/git/lnkohana
[submodule "modules/lnapp"]
path = modules/lnapp
url = /afs/local/git/lnapp

21
.htaccess Normal file
View File

@ -0,0 +1,21 @@
# Turn on URL rewriting
RewriteEngine On
# Installation directory
RewriteBase /tsmac
# Protect hidden files from being viewed
<Files .*>
Order Deny,Allow
Deny From All
</Files>
# Protect application and system files from being viewed
RewriteRule ^(?:application|modules|includes/kohana)\b.* index.php/$0 [L]
# Allow any files or directories that exist to be displayed directly
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
# Rewrite all other URLs to index.php/URL
RewriteRule .* index.php/$0 [PT]

187
application/bootstrap.php Normal file
View File

@ -0,0 +1,187 @@
<?php defined('SYSPATH') or die('No direct script access.');
// -- Environment setup --------------------------------------------------------
$SERVER_NAMES = array(
'dev.leenooks.vpn',
);
// Load the core Kohana class
require SYSPATH.'classes/Kohana/Core'.EXT;
if (is_file(APPPATH.'classes/Kohana'.EXT))
{
// Application extends the core
require APPPATH.'classes/Kohana'.EXT;
}
else
{
// Load empty core extension
require SYSPATH.'classes/Kohana'.EXT;
}
/**
* Set the default time zone.
*
* @link http://kohanaframework.org/guide/using.configuration
* @link http://www.php.net/manual/timezones
*/
date_default_timezone_set('Australia/Melbourne');
/**
* Set the default locale.
*
* @link http://kohanaframework.org/guide/using.configuration
* @link http://www.php.net/manual/function.setlocale
*/
setlocale(LC_ALL, 'en_US.utf-8');
/**
* Enable the Kohana auto-loader.
*
* @link http://kohanaframework.org/guide/using.autoloading
* @link http://www.php.net/manual/function.spl-autoload-register
*/
spl_autoload_register(array('Kohana', 'auto_load'));
/**
* Optionally, you can enable a compatibility auto-loader for use with
* older modules that have not been updated for PSR-0.
*
* It is recommended to not enable this unless absolutely necessary.
*/
//spl_autoload_register(array('Kohana', 'auto_load_lowercase'));
/**
* Enable the Kohana auto-loader for unserialization.
*
* @link http://www.php.net/manual/function.spl-autoload-call
* @link http://www.php.net/manual/var.configuration#unserialize-callback-func
*/
ini_set('unserialize_callback_func', 'spl_autoload_call');
// -- Configuration and initialization -----------------------------------------
/**
* Set the default language
*/
I18n::lang('en-us');
/**
* Set Kohana::$environment if a 'KOHANA_ENV' environment variable has been supplied.
*
* Note: If you supply an invalid environment name, a PHP warning will be thrown
* saying "Couldn't find constant Kohana::<INVALID_ENV_NAME>"
*/
/**
* Set the environment status by the domain.
*/
Kohana::$environment = (! isset($_SERVER['SERVER_NAME']) OR in_array($_SERVER['SERVER_NAME'],$SERVER_NAMES)) ? Kohana::PRODUCTION : Kohana::DEVELOPMENT;
if (isset($_SERVER['KOHANA_ENV']))
{
Kohana::$environment = constant('Kohana::'.strtoupper($_SERVER['KOHANA_ENV']));
}
/**
* Initialize Kohana, setting the default options.
*
* The following options are available:
*
* - string base_url path, and optionally domain, of your application NULL
* - string index_file name of your index file, usually "index.php" index.php
* - string charset internal character set used for input and output utf-8
* - string cache_dir set the internal cache directory APPPATH/cache
* - integer cache_life lifetime, in seconds, of items cached 60
* - boolean errors enable or disable error handling TRUE
* - boolean profile enable or disable internal profiling TRUE
* - boolean caching enable or disable internal caching FALSE
* - boolean expose set the X-Powered-By header FALSE
*/
Kohana::init(array(
'base_url' => Kohana::$environment === Kohana::PRODUCTION ? '/tsmac' : '/tsmac',
'caching' => Kohana::$environment === Kohana::PRODUCTION,
'profile' => Kohana::$environment !== Kohana::PRODUCTION,
'index_file' => FALSE,
));
/**
* Attach the file write to logging. Multiple writers are supported.
*/
Kohana::$log->attach(new Log_File(APPPATH.'logs'));
/**
* Attach a file reader to config. Multiple readers are supported.
*/
Kohana::$config->attach(new Config_File);
/**
* Enable modules. Modules are referenced by a relative or absolute path.
*/
Kohana::modules(array(
'tsm' => MODPATH.'tsm', // TSM Module
// 'lnauth' => MODPATH.'lnauth', // lnAuth Base Authentication Tools
'lnapp' => MODPATH.'lnapp', // lnApp Base Application Tools
// 'oauth' => MODPATH.'oauth', // OAuth Module for External Authentication
'auth' => SMDPATH.'auth', // Basic authentication
// 'cache' => SMDPATH.'cache', // Caching with multiple backends
// 'cron' => SMDPATH.'cron', // Kohana Cron Module
// 'codebench' => SMDPATH.'codebench', // Benchmarking tool
'database' => SMDPATH.'database', // Database access
// 'gchart' => MODPATH.'gchart', // Google Chart Module
// 'highchart' => MODPATH.'highchart', // Highcharts Chart Module
// 'image' => SMDPATH.'image', // Image manipulation
'khemail' => SMDPATH.'khemail', // Email module for Kohana 3 PHP Framework
// 'minion' => SMDPATH.'minion', // CLI Tasks
'orm' => SMDPATH.'orm', // Object Relationship Mapping
// 'pagination' => SMDPATH.'pagination', // Kohana Pagination module for Kohana 3 PHP Framework
// 'unittest' => SMDPATH.'unittest', // Unit testing
// 'userguide' => SMDPATH.'userguide', // User guide and API documentation
// 'xml' => SMDPATH.'xml', // XML module for Kohana 3 PHP Framework
));
/**
* Load our modules defined in the DB
*/
#Kohana::modules(array_merge(Kohana::modules(),Config::modules()));
/**
* Enable specalised interfaces
*/
Route::set('sections', '<directory>/<controller>(/<action>(/<id>(/<sid>)))',
array(
'directory' => '('.implode('|',array_values(URL::$method_directory)).')'
))
->defaults(array(
'action' => 'index',
));
// Static file serving (CSS, JS, images)
Route::set('default/media', 'media(/<file>)', array('file' => '.+'))
->defaults(array(
'controller' => 'media',
'action' => 'get',
));
/**
* Set the routes. Each route must have a minimum of a name, a URI and a set of
* defaults for the URI.
*/
Route::set('default', '(<controller>(/<action>(/<id>)))', array('id'=>'[a-zA-Z0-9_.-]+'))
->defaults(array(
'controller' => 'welcome',
'action' => 'index',
));
/**
* If APC is enabled, and we need to clear the cache
*/
if (file_exists(APPPATH.'cache/CLEAR_APC_CACHE') AND function_exists('apc_clear_cache') AND (PHP_SAPI !== 'cli')) {
if (! apc_clear_cache() OR ! unlink(APPPATH.'cache/CLEAR_APC_CACHE'))
throw new Kohana_Exception('Unable to clear the APC cache.');
}
// If we are a CLI, set our session dir
if (PHP_SAPI === 'cli')
session_save_path('tmp/');
?>

View File

@ -0,0 +1,65 @@
<?php defined('SYSPATH') or die('No direct access allowed.');
/**
* This class extends the core Kohana class by adding some core application
* specific functions, and configuration.
*
* @package TSM Access Management
* @category Helpers
* @author Deon George
* @copyright (c) 2014 Deon George
* @license http://dev.leenooks.net/license.html
*/
class Config extends Kohana_Config {
/**
* Some early initialisation
*
* At this point, KH hasnt been fully initialised either, so we cant rely on
* too many KH functions yet.
*
* NOTE: Kohana doesnt provide a parent construct for the Kohana_Config class.
*/
public function __construct() {
}
/**
* Get the singleton instance of Config.
*
* $config = Config::instance();
*
* @return Config
* @compat Restore KH 3.1 functionality
*/
public static function instance() {
if (Config::$_instance === NULL)
// Create a new instance
Config::$_instance = new Config;
return Config::$_instance;
}
public static function Copywrite($html=FALSE) {
return ($html ? '&copy;' : '(c)').' 2014 Deon George';
}
public static function version() {
// @todo Work out our versioning
return 'TBA';
}
/**
* See if our emails for the template should be sent to configured admin(s)
*
* @param string template - Template to test for
* @return mixed|array - Email to send test emails to
*/
public static function testmail($template) {
$config = Kohana::$config->load('debug')->email_admin_only;
if (is_null($config) OR ! is_array($config) OR empty($config[$template]))
return FALSE;
else
return $config[$template];
}
}
?>

View File

@ -0,0 +1,71 @@
<?php defined('SYSPATH') or die('No direct access allowed.');
/**
* Main home page
*
* @package TSM Access Management
* @category Controllers/User
* @author Deon George
* @copyright (c) 2014 Deon George
* @license http://dev.leenooks.net/license.html
*/
class Controller_User_Welcome extends Controller_Welcome {
protected $auth_required = TRUE;
public function action_index() {
$n = ORM::factory('ADMIN')->where('EMAIL_ADDRESS','=',$this->ao->email)->find_all();
if (! $n->count())
$output = 'You have no currently registered ADMINs, would you like to '.HTML::anchor(URL::link('user','admin/add'),'Register').' one?';
else
$output = Table::factory()
->data($n)
->columns(array(
'ADMIN_NAME'=>'Admin',
'REG_TIME'=>'Registered',
'PWSET_TIME'=>'PW Reset',
'LASTACC_TIME'=>'Last Access',
'LOCKED'=>'Locked',
))
->prepend(array(
'id'=>array('url'=>URL::link('user','admin/edit/')),
));
Block::factory()
->title(sprintf('Your ADMINs in TSMs : %s',$this->ao->name()))
->title_icon('icon-info-sign')
->span(9)
->body($output);
$n = ORM::factory('NODE')->where('EMAIL_ADDRESS','=',$this->ao->email)->find_all();
if (! $n->count())
$output = 'You have no currently registered NODES, would you like to '.HTML::anchor(URL::link('user','node/add'),'Register').' one?';
else
$output = Table::factory()
->data($n)
->columns(array(
'NODE_NAME'=>'Node',
'REG_TIME'=>'Registered',
'version()'=>'Version',
'PWSET_TIME'=>'PW Reset',
'LASTACC_TIME'=>'Last Access',
))
->prepend(array(
'id'=>array('url'=>URL::link('user','node/edit/')),
));
Block::factory()
->title(sprintf('Your NODES in TSMs : %s',$this->ao->name()))
->title_icon('icon-info-sign')
->span(9)
->body($output);
/*
Block::factory()
->title('Quick Shortcuts')
->title_icon('icon-bookmark')
->span(3)
->body(View::factory('welcome/user/shortcuts'));
*/
}
}
?>

View File

@ -0,0 +1,19 @@
<?php defined('SYSPATH') or die('No direct script access.');
class Controller_Welcome extends Controller_TemplateDefault {
protected $auth_required = FALSE;
public function action_index() {
if (! Kohana::$config->load('config')->appname)
throw HTTP_Exception::factory(500,'Site not setup!');
$output = '';
$output = View::factory('pages/welcome');
Style::factory()
->type('file')
->data('media/css/pages/welcome.css');
$this->template->content = $output;
}
} // End Welcome

View File

@ -0,0 +1,15 @@
<?php defined('SYSPATH') or die('No direct access allowed.');
/**
* This class overrides Kohana's Cookie
*
* @package TSM Access Management
* @category Modifications
* @author Deon George
* @copyright (c) 2014 Deon George
* @license http://dev.leenooks.net/license.html
*/
class Cookie extends Kohana_Cookie {
public static $salt = 'TSM';
}
?>

View File

@ -0,0 +1,150 @@
<?php defined('SYSPATH') or die('No direct access allowed.');
/**
* Setup Model
*
* This module must remain in applications/ as it is used very early in the
* Database initialisation.
*
* @package TSM Access Management
* @category Models
* @author Deon George
* @copyright (c) 2014 Deon George
* @license http://dev.leenooks.net/license.html
*/
class Model_Setup extends ORM {
// Setup doesnt use the update column
protected $_updated_column = FALSE;
protected $_has_one = array(
'account'=>array('foreign_key'=>'id','far_key'=>'admin_id'),
'country'=>array('foreign_key'=>'id','far_key'=>'country_id'),
'language'=>array('foreign_key'=>'id','far_key'=>'language_id'),
);
protected $_has_many = array(
'dates'=>array('model'=>'Site_Dates','far_key'=>'id','foreign_key'=>'site_id'),
'rooms'=>array('far_key'=>'id','foreign_key'=>'site_id'),
);
protected $_compress_column = array(
'module_config',
'site_details',
);
// Validation rules
public function rules() {
$x = Arr::merge(parent::rules(), array(
'url' => array(
array('not_empty'),
array('min_length', array(':value', 8)),
array('max_length', array(':value', 127)),
array('url'),
),
));
// This module doesnt use site_id.
unset($x['site_id']);
return $x;
}
/**
* Get/Set Module Configuration
*
* @param $key Module name.
* @param $value Values to store. If NULL, retrieves the value stored, otherwise stores value.
*/
public function module_config($key,array $value=NULL) {
// If we are not loaded, we dont have any config.
if (! $this->loaded() OR (is_null($value) AND ! $this->module_config))
return array();
$mo = ORM::factory('Module',array('name'=>$key));
if (! $mo->loaded())
throw new Kohana_Exception('Unknown module :name',array(':name'=>$key));
$mc = $this->module_config ? $this->module_config : array();
// If $value is NULL, we are a getter
if ($value === NULL)
return empty($mc[$mo->id]) ? array() : $mc[$mo->id];
// Store new value
$mc[$mo->id] = $value;
$this->module_config = $mc;
return $this;
}
public function module_config_id($key=NULL) {
$result = array();
foreach (array_keys($this->module_config) as $mid) {
if (is_null($key) OR $key == $mid) {
$result[$mid] = array(
'object'=>ORM::factory('Module',$mid),
'data'=>$this->module_config[$mid],
);
// If we are just after our key, we can continue here
if ($key AND $key==$mid)
break;
}
}
return $result;
}
public function open_dates($date,$days=0) {
$result = array();
$date_end = $date+$days*86400;
foreach ($this->dates->where('code','=','O')->where_startstop($date,$date_end)->find_all() as $o)
while ($date<$date_end) {
// If we havent made the start date yet, we need to advance
if ($o->date_start > $date AND $o->date_stop > $date_end) {
$result[$date] = FALSE;
$date += 86400;
continue;
}
// Check that this record covers our current date
if ($o->date_stop < $date)
break;
$result[$date] = $o->open(date('w',$date)) ? TRUE : FALSE;
$date += 86400;
}
// If we broke out and our date $days hasnt ben evaluated, we are closed
while ($date<$date_end) {
$result[$date] = FALSE;
$date += 86400;
}
return $result;
}
/**
* Get/Set our Site Configuration from the DB
*
* @param $key Key
* @param $value Values to store. If NULL, retrieves the value stored, otherwise stores value.
*/
public function site_details($key,array $value=NULL) {
if (! in_array($key,array('name','address1','address2','city','state','pcode','phone','fax','email','faqurl')))
throw new Kohana_Exception('Unknown Site Configuration Key :key',array(':key'=>$key));
// If $value is NULL, we are a getter
if ($value === NULL)
return empty($this->site_details[$key]) ? '' : $this->site_details[$key];
// Store new value
$sc[$key] = $value;
return $this;
}
}
?>

View File

@ -0,0 +1,21 @@
<?php defined('SYSPATH') or die('No direct access allowed.');
/**
* This class is for Site Information
*
* @package TSM Access Management
* @category Helpers
* @author Deon George
* @copyright (c) 2014 Deon George
* @license http://dev.leenooks.net/license.html
*/
class Site extends lnApp_Site {
/**
* Enable a different theme between LOGGED IN and not logged in interfaces
*/
public static function Theme() {
// If we are using user admin pages (and login), we'll choose the admin theme.
return 'theme/'.(URL::admin_url() ? Kohana::$config->load('config')->theme_admin : Kohana::$config->load('config')->theme);
}
}
?>

View File

@ -0,0 +1,8 @@
<?php defined('SYSPATH') OR die('No direct access allowed.');
return array
(
'appname' => 'TSM Access Request',
'theme' => 'bootstrap',
'theme_admin' => 'baseadmin',
);

View File

@ -0,0 +1,31 @@
<?php defined('SYSPATH') OR die('No direct access allowed.');
return array
(
'default' => array
(
'type' => 'MySQL',
'connection' => array(
/**
* The following options are available for MySQL:
*
* string hostname server hostname, or socket
* string database database name
* string username database username
* string password database password
* boolean persistent use persistent connections?
* array variables system variables as "key => value" pairs
*
* Ports and sockets may be appended to the hostname.
*/
'hostname' => 'mysql.leenooks.vpn',
'database' => 'weblntsmac',
'username' => 'ln-tsmac',
'password' => 'TSM',
'persistent' => TRUE,
),
'table_prefix' => 'tac_',
'charset' => 'utf8',
'caching' => TRUE,
),
);

View File

@ -0,0 +1,18 @@
<?php defined('SYSPATH') or die('No direct access allowed.');
/**
* Configuration - Session Configuration
*
* @package TSM Access Management
* @category Configuration
* @author Deon George
* @copyright (c) 2014 Deon George
* @license http://dev.leenooks.net/license.html
*/
return array(
'native' => array(
'name'=>'TSMAC',
),
);
?>

View File

@ -0,0 +1,61 @@
<fieldset>
<legend>Account Details</legend>
<?php echo Form::input('email',$o->display('email'),array('label'=>'Email','class'=>'col-md-3','placeholder'=>'Email Address','type'=>'email','required','data-error'=>'Invalid EMAIL address')); ?>
<?php echo Form::input('company',$o->display('company'),array('label'=>'Company','class'=>'col-md-3','placeholder'=>'Company Name','required')); ?>
<div class="form-group">
<label class="col-md-2 control-label" for="Title">Name</label>
<div class="row">
<div class="col-md-1">
<?php echo Form::select('title',StaticList_Title::table(),$o->display('title'),array('class'=>'form-control','required','nocg'=>TRUE)); ?>
</div>
<div class="col-md-2">
<?php echo Form::input('first_name',$o->display('first_name'),array('class'=>'form-control col-md-2','placeholder'=>'First Name','required','nocg'=>TRUE)); ?>
</div>
<div class="col-md-3">
<?php echo Form::input('last_name',$o->display('last_name'),array('class'=>'form-control col-md-2','placeholder'=>'Last Name','required','nocg'=>TRUE)); ?>
</div>
</div>
</div>
<div class="form-group">
<label class="col-md-2 control-label" for="address1">Address</label>
<?php echo Form::input('address1',$o->display('address1'),array('class'=>'col-md-6','placeholder'=>'Address Line 1','required')); ?>
<label class="col-md-2 control-label" for="address2"></label>
<?php echo Form::input('address2',$o->display('address2'),array('class'=>'col-md-6','placeholder'=>'Address Line 2')); ?>
<label class="col-md-2 control-label" for="city"></label>
<div class="row">
<div class="col-md-3">
<?php echo Form::input('city',$o->display('city'),array('label'=>'City','placeholder'=>'City','required','nocg'=>TRUE)); ?>
</div>
<div class="col-md-1">
<?php echo Form::input('state',$o->display('state'),array('label'=>'','class'=>'input-mini','placeholder'=>'State','required','nocg'=>TRUE)); ?>
</div>
<div class="col-md-1">
<?php echo Form::input('zip',$o->display('zip'),array('label'=>'','class'=>'input-mini','placeholder'=>'Post Code','required','nocg'=>TRUE)); ?>
</div>
</div>
</div>
<div class="form-group">
<label class="col-md-2 control-label" for="address1">Country</label>
<div class="col-md-3">
<?php echo Form::select('country_id',ORM::factory('Country')->list_select(),$o->country_id,array('class'=>'form-control','required','nocg'=>TRUE)); ?>
</div>
</div>
<?php echo Form::hidden('language_id',Site::language()); ?>
</fieldset>
<div class="row">
<div class="col-md-offset-1">
<button type="submit" class="btn btn-primary">Save changes</button>
<button type="button" class="btn btn-default">Cancel</button>
</div>
</div>

View File

@ -0,0 +1,11 @@
<!-- @todo Move this content into the DB -->
<div id="container">
<hr class="row-divider" />
<div class="col-md-6">
<h3><i class="fa fa-edit"></i>Request Access</h3>
<p>To be able to use this server, you need to request access. Once your access is activated, you will be able to use this TSM server with your TSM client.</p>
<p><a href="<?php echo URL::site('login'); ?>" class="">Login »</a></p>
</div>
</div> <!-- /container -->

1
includes/kohana Submodule

@ -0,0 +1 @@
Subproject commit 3291c7d850d9d031a367f24523255d2ec5e96e0b

131
index.php Normal file
View File

@ -0,0 +1,131 @@
<?php
/**
* The directory in which your application specific resources are located.
* The application directory must contain the bootstrap.php file.
*
* @link http://kohanaframework.org/guide/about.install#application
*/
$application = 'application';
/**
* The directory in which your modules are located.
*
* @link http://kohanaframework.org/guide/about.install#modules
*/
$modules = 'modules';
/**
* The directory in which upstream Kohana resources (modules) are located.
*/
$sysmodules = 'includes/kohana/modules';
/**
* The directory in which the Kohana resources are located. The system
* directory must contain the classes/kohana.php file.
*
* @link http://kohanaframework.org/guide/about.install#system
*/
$system = 'includes/kohana/system';
/**
* The default extension of resource files. If you change this, all resources
* must be renamed to use the new extension.
*
* @link http://kohanaframework.org/guide/about.install#ext
*/
define('EXT', '.php');
/**
* Set the PHP error reporting level. If you set this in php.ini, you remove this.
* @link http://www.php.net/manual/errorfunc.configuration#ini.error-reporting
*
* When developing your application, it is highly recommended to enable notices
* and strict warnings. Enable them by using: E_ALL | E_STRICT
*
* In a production environment, it is safe to ignore notices and strict warnings.
* Disable them by using: E_ALL ^ E_NOTICE
*
* When using a legacy application with PHP >= 5.3, it is recommended to disable
* deprecated notices. Disable with: E_ALL & ~E_DEPRECATED
*/
error_reporting(E_ALL | E_STRICT);
/**
* End of standard configuration! Changing any of the code below should only be
* attempted by those with a working knowledge of Kohana internals.
*
* @link http://kohanaframework.org/guide/using.configuration
*/
// Set the full path to the docroot
define('DOCROOT', realpath(dirname(__FILE__)).DIRECTORY_SEPARATOR);
// Make the application relative to the docroot, for symlink'd index.php
if ( ! is_dir($application) AND is_dir(DOCROOT.$application))
$application = DOCROOT.$application;
// Make the modules relative to the docroot, for symlink'd index.php
if ( ! is_dir($modules) AND is_dir(DOCROOT.$modules))
$modules = DOCROOT.$modules;
// Make the system relative to the docroot, for symlink'd index.php
if ( ! is_dir($sysmodules) AND is_dir(DOCROOT.$sysmodules))
$sysmodules = DOCROOT.$sysmodules;
// Make the system relative to the docroot, for symlink'd index.php
if ( ! is_dir($system) AND is_dir(DOCROOT.$system))
$system = DOCROOT.$system;
// Define the absolute paths for configured directories
define('APPPATH', realpath($application).DIRECTORY_SEPARATOR);
define('MODPATH', realpath($modules).DIRECTORY_SEPARATOR);
define('SMDPATH', realpath($sysmodules).DIRECTORY_SEPARATOR);
define('SYSPATH', realpath($system).DIRECTORY_SEPARATOR);
// Clean up the configuration vars
unset($application, $modules, $sysmodules, $system);
if (file_exists('install'.EXT))
{
// Load the installation check
return include 'install'.EXT;
}
/**
* Define the start time of the application, used for profiling.
*/
if ( ! defined('KOHANA_START_TIME'))
{
define('KOHANA_START_TIME', microtime(TRUE));
}
/**
* Define the memory usage at the start of the application, used for profiling.
*/
if ( ! defined('KOHANA_START_MEMORY'))
{
define('KOHANA_START_MEMORY', memory_get_usage());
}
// Bootstrap the application
require APPPATH.'bootstrap'.EXT;
if (PHP_SAPI == 'cli') // Try and load minion
{
class_exists('Minion_Task') OR die('Please enable the Minion module for CLI support.');
set_exception_handler(array('Minion_Exception', 'handler'));
Minion_Task::factory(Minion_CLI::options())->execute();
}
else
{
/**
* Execute the main request. A source of the URI can be passed, eg: $_SERVER['PATH_INFO'].
* If no source is specified, the URI will be automatically detected.
*/
echo Request::factory(TRUE, array(), FALSE)
->execute()
->send_headers(TRUE)
->body();
}

1
modules/lnapp Submodule

@ -0,0 +1 @@
Subproject commit a7ed6672e18773ff07eb1c01fcf8e38b4828de11

View File

@ -0,0 +1,4 @@
<?php defined('SYSPATH') or die('No direct access allowed.');
class Database_Result extends lnApp_Database_Result {}
?>

View File

@ -0,0 +1,4 @@
<?php defined('SYSPATH') or die('No direct access allowed.');
abstract class Database_TSM extends lnApp_Database_TSM {}
?>

View File

@ -0,0 +1,4 @@
<?php defined('SYSPATH') or die('No direct access allowed.');
class Database_TSM_Result extends lnApp_Database_TSM_Result {}
?>

View File

@ -0,0 +1,4 @@
<?php defined('SYSPATH') or die('No direct access allowed.');
class Database_Tsm_dsmadmc extends lnApp_Database_Tsm_dsmadmc {}
?>

View File

@ -0,0 +1,4 @@
<?php defined('SYSPATH') or die('No direct access allowed.');
class Model_ADMIN extends lnApp_Model_ADMIN {}
?>

View File

@ -0,0 +1,4 @@
<?php defined('SYSPATH') or die('No direct access allowed.');
class Model_NODE extends lnApp_Model_NODE {}
?>

View File

@ -0,0 +1,174 @@
<?php defined('SYSPATH') or die('No direct access allowed.');
/**
* This class extends Kohana's [ORM] class to create defaults for TSM.
*
* @package TSM Database Module
* @category Helpers
* @author Deon George
* @copyright (c) 2010-2014 Deon George
* @license http://dev.leenooks.net/license.html
*/
abstract class ORM_TSM extends ORM {
protected $_created_column = NULL;
protected $_updated_column = NULL;
// Suppress ORMs inclusion of <table_name>.*
protected $_disable_wild_select = TRUE;
// Suppress ORMs inclusion of <table_name>. to column joins
protected $_disable_join_table_name = TRUE;
// Suppress ORMs use of limit
protected $_disable_limit = TRUE;
// To enable effective caching, this must disabled.
protected $_reload_on_wakeup = FALSE;
// Enable the formating of columns
protected $_object_formated = array();
protected $_formated = FALSE;
protected $_formats = array();
protected $_tsm = array();
/**
*
* Configuration to enable PLA to work with DSMADMC & DB2 connections
* This is required, because the schema is different between each
* connection?
*/
protected function _initialize() {
// Set out DB connection configuration.
$this->_db_group = Kohana::$config->load('tsm')->client_type;
// Adjustments for DSMADMC or DB2 connections
if (array_key_exists($this->_db_group,$this->_tsm))
foreach ($this->_tsm[$this->_db_group] as $k => $v)
if (preg_match('/^_/',$k))
$this->{$k} = $v;
if ($this->_db_group == 'db2')
$this->_disable_join_table_name = FALSE;
parent::_initialize();
}
public function __get($column) {
// Get a substited column name - need for DB2/DSMADMC schema differences
if (isset($this->_tsm[$this->_db_group]['translate']) AND array_key_exists($column,$this->_tsm[$this->_db_group]['translate']))
return is_null($c=$this->_tsm[$this->_db_group]['translate'][$column]) ? NULL : parent::__get($c);
else
return parent::__get($column);
}
public function find() {
Log::instance()->add(LOG::DEBUG,'ENTER :method',array(':method'=>__METHOD__));
Log::instance()->add(LOG::DEBUG,'METHOD :method: isCacheable: :cable, table: :table',array(':method'=>__METHOD__,':cable'=>($x=$this->isCacheable()) ? $x : 'N',':table'=>$this->_table_name));
// Check if we can preload our data and havent already done it
// Kohana uses Kohana::cache here, instead of Cache()
if ($time = $this->isCacheable() AND is_null(Kohana::cache($cache_key = 'PRELOAD:'.$this->_table_name))) {
Log::instance()->add(LOG::DEBUG,'PRELOADING :method: table: :table',array(':method'=>__METHOD__,':table'=>$this->_table_name));
// Firstly set our cache, so that we dont get in a loop
Kohana::cache($cache_key,TRUE,$time-1);
// Find all records of this type
$c = get_class($this);
$x = new $c;
foreach ($x->find_all() as $record) {
// Simulate loading the record so that we can get the SQL to use as our cache key
$y = new $c;
$y->where($y->_primary_key,'=',(string)$record);
// Code, as extracted from ORM to complete building the SQL
$y->_build(Database::SELECT);
$y->_db_builder->from(array($y->_table_name,$y->_object_name));
if (! isset($y->_db_applied['order_by']) AND ! empty($y->_sorting))
foreach ($y->_sorting as $column => $direction) {
if (strpos($column, '.') === FALSE)
// Sorting column for use in JOINs
$column = ($y->_disable_join_table_name ? '' : $y->_table_name.'.').$column;
$y->_db_builder->order_by($column, $direction);
}
// Set the cache key based on the database instance name and SQL
$cache_key = 'Database::query("'.$y->_db.'", "'.(string)$y->_db_builder.'")';
unset($y);
// Cache the record, our subsequent find should get a cache hit now.
Kohana::cache($cache_key, array($record->as_array()), $time);
Log::instance()->add(LOG::DEBUG,'Cache SET for TIME: :time, KEY: :cache_key',array(':cache_key'=>$cache_key,':time'=>$time));
}
unset($x);
}
Log::instance()->add(LOG::DEBUG,'LEAVE :method',array(':method'=>__METHOD__));
// Contiue as normal
return parent::find();
}
private function isCacheable() {
$config = Kohana::$config->load('database')->{Kohana::$config->load('tsm')->client_type};
if ($config['caching'] AND isset($config['cachepreload'][$this->_table_name]) AND count($this->_db_pending) == 1 AND $this->_db_pending[0]['name'] == 'where' AND $this->_db_pending[0]['args'][0] == $this->_primary_key AND $this->_db_pending[0]['args'][1] == '=')
return $config['cachepreload'][$this->_table_name];
else
return FALSE;
}
protected function _load_result($multiple = FALSE) {
// We'll cache our query results
if ($c = $this->_db->caching($this->_table_name))
$this->_db_builder->cached($c);
return parent::_load_result($multiple);
}
/**
* Proxy method to Database list_columns.
* This enables caching of the list_columns queries. Since this doesnt
* we hard code the cache to 7 days.
*
* @return array
* @todo This cache time needs to be better integrated with other caching times.
*/
public function list_columns() {
// We'll cache our query results
if ($this->_db->caching('SCHEMA')) {
// Set the cache key based on the database instance name and SQL
$cache_key = 'Database::query(LC:'.$this->_table_name.')';
if (! is_null($result = Cache::instance()->get($cache_key)))
// Return a cached result
return $result;
}
// Proxy to database
$result = $this->_db->list_columns($this->_table_name);
// Cache the result array
if (isset($cache_key))
Cache::instance()->set($cache_key, $result, 604800);
return $result;
}
// Load our values into the ORM object
public function load_object(array $values) {
return parent::_load_values($values);
}
public static function date($date,$format) {
return $date ? date($format,strtotime($date)) : '';
}
protected function datatypemap($type) {
$x = Kohana::$config->load('tsm')->datatypes;
return array_key_exists($type,$x) ? $x[$type] : $x;
}
}
?>

View File

@ -0,0 +1,21 @@
<?php defined('SYSPATH') or die('No direct access allowed.');
/**
* TSM System Messages.
*
* @package TSM Database Module
* @category Helpers
* @author Deon George
* @copyright (c) 2010-2014 Deon George
* @license http://dev.leenooks.net/license.html
*/
class SystemMessage extends lnApp_SystemMessage {
static public function TSM($type,$error,$sql=NULL) {
SystemMessage::add(array(
'title'=>_('While talking to TSM'),
'body'=>($sql ? _('Running SQL').': <b>'.$sql.'</b><br/><br/>' : '').(is_array($error) ? implode('<br/>',$error) : $error),
'type'=>$type,
));
}
}
?>

View File

@ -0,0 +1,4 @@
<?php defined('SYSPATH') or die('No direct access allowed.');
class TSM extends lnApp_TSM {}
?>

View File

@ -0,0 +1,62 @@
<?php defined('SYSPATH') or die('No direct access allowed.');
/**
* TSM database show result. See [Results](/database/results) for usage and examples.
*
* @package TSM Database Module
* @category Database
* @author Deon George
* @copyright (c) 2010-2014 Deon George
* @license http://dev.leenooks.net/license.html
*/
abstract class lnApp_Database_Result extends Kohana_Database_Result {
protected $_internal_row = 0;
protected $_rows;
// Required Abstract Classes
public function __destruct() {}
public function seek($offset) {
if ($this->offsetExists($offset)) {
// Set the current row to the offset
$this->_current_row = $this->_internal_row = $offset;
return TRUE;
} else {
return FALSE;
}
}
public function current() {
if ($this->_current_row !== $this->_internal_row AND ! $this->seek($this->_current_row))
return FALSE;
// Return an stdClass
if ($this->_as_object === TRUE) {
return $this;
} elseif (is_string($this->_as_object)) {
// Return an object of given class name
$o = new $this->_as_object;
return $o->load_object($this->_rows[$this->_current_row]);
// Return an array of the row
} else {
return $this->_rows[$this->_current_row];
}
}
/**
* Get a row value from the query
*
* TSM returns all columns in upper case
*/
public function get($name, $default = NULL) {
$name = strtoupper($name);
return parent::get($name,$default);
}
}
?>

View File

@ -0,0 +1,113 @@
<?php defined('SYSPATH') or die('No direct access allowed.');
/**
* TSM database connection.
*
* @package TSM Database Module
* @category Drivers
* @author Deon George
* @copyright (c) 2010-2014 Deon George
* @license http://dev.leenooks.net/license.html
*/
abstract class lnApp_Database_TSM extends Database {
// Database in use by each connection
protected static $_current_databases = array();
// Use SET NAMES to set the character set
protected static $_set_names;
// Identifier for this connection within the PHP driver
protected $_connection_id;
// TSM does not use a backtick for identifiers
protected $_identifier = '';
// Our TSM Message Format
protected $msg_format = '[A-Z]{3}[0-9]{4}[I|E|W|S]';
// Our Message Codes stored in the last query
protected $_query_msg_codes = array();
// Our return code error messages we can ignore
protected $ignore_codes = array(
'ANS8001I', // Return code %s.
);
// Our return code error messages we can ignore
protected $nodata_codes = array(
'ANR2034E', // SELECT: No match found using this criteria.
);
protected $execute_stdout = '';
protected $execute_stderr = '';
protected $execute_rc = NULL;
// Our required abstract methods
public function begin($mode = NULL) {}
public function commit() {}
public function rollback() {}
public function set_charset($charset) {}
public function list_tables($like = NULL) {}
// Required methods
abstract protected function execute($sql);
/**
* Return the caching defined in the current configuration.
*
* $cache_time = $db->caching("table");
*
* @return string
*/
public function caching($table) {
return (array_key_exists('cache',Kohana::modules()) AND $this->_config['caching'] AND isset($this->_config['cache'][$table])) ? $this->_config['cache'][$table] : FALSE;
}
private function clear() {
$this->_query_msg_codes = array();
}
public function escape($value) {
// SQL standard is to use single-quotes for all values
return "'$value'";
}
public function query($type, $sql, $as_object = FALSE, array $params = NULL) {
// Make sure the database is connected
if (! $this->_connection && ! $this->connect())
return new Database_TSM_Result(array(),'',$as_object,$params);
$this->clear();
if ( ! empty($this->_config['profiling']))
// Benchmark this query for the current instance
$benchmark = Profiler::start("Database ({$this->_instance})", $sql);
// Execute the query
$result = $this->execute($sql);
if ($this->execute_stderr AND $this->execute_rc) {
// This benchmark is worthless
if (isset($benchmark))
Profiler::delete($benchmark);
SystemMessage::TSM('error',sprintf('%s (%s)',$this->execute_stdout,$this->execute_stderr),$sql);
}
if (isset($benchmark))
Profiler::stop($benchmark);
// Set the last query
$this->last_query = $sql;
if ($type === Database::SELECT)
// Return an iterator of results
return new Database_TSM_Result($result, $sql, $as_object, $params);
elseif ($type === Database::INSERT)
throw new Kohana_Exception('Database INSERTS are not supported');
elseif ($type === Database::SHOW)
return new Database_TSM_Show($result, $sql, $as_object, $params);
elseif ($type === Database::SET)
return new Database_TSM_Set($result, $sql, $as_object, $params);
}
}
?>

View File

@ -0,0 +1,48 @@
<?php defined('SYSPATH') or die('No direct access allowed.');
/**
* TSM database result. See [Results](/database/results) for usage and examples.
*
* @package TSM Database Module
* @category Database
* @author Deon George
* @copyright (c) 2010-2014 Deon George
* @license http://dev.leenooks.net/license.html
*/
abstract class lnApp_Database_TSM_Result extends Database_Result {
public function __construct($result, $sql, $as_object = FALSE, array $params = NULL) {
parent::__construct($result, $sql, $as_object, $params);
$start = FALSE;
// Is this a DB2 result?
if (is_resource($result) AND function_exists('db2_fetch_object')) {
// If we are running a DB2 set command, we can return
if (preg_match('/^SET/',$sql))
return;
while ($r = db2_fetch_object($result))
$this->_rows[$this->_internal_row++] = (array)$r;
// Is this an DSMADMC result?
} elseif (is_array($result))
foreach ($result as $line) {
if (! trim($line)) {
if ($start)
$this->_internal_row++;
continue;
}
list($k,$v) = explode(':',$line,2);
$this->_rows[$this->_internal_row][trim($k)] = trim($v);
$start = TRUE;
}
else
throw new Kohana_Exception('Unknown result :result',array(':result'=>$result));
$this->_total_rows = $this->_internal_row;
$this->_internal_row = 0;
}
}
?>

View File

@ -0,0 +1,185 @@
<?php defined('SYSPATH') or die('No direct access allowed.');
/**
* TSM database connection using DSMADMC.
*
* @package TSM Database Module
* @category Drivers
* @author Deon George
* @copyright (c) 2010-2014 Deon George
* @license http://dev.leenooks.net/license.html
*/
abstract class lnApp_Database_Tsm_dsmadmc extends Database_TSM {
public function connect() {
// Extract the connection parameters, adding required variabels
extract($this->_config['connection'] + array(
'database' => '',
'hostname' => '',
'username' => '',
'password' => '',
'persistent' => FALSE,
));
// Get user login details from user session - these are set by login
if (! $username)
$username = Session::instance()->get_once(Kohana::$config->load('auth')->session_key);
if (! $password)
$password = Session::instance()->get_once('password');
// Prevent this information from showing up in traces
unset($this->_config['connection']['username'], $this->_config['connection']['password']);
if (! file_exists(Kohana::$config->load('tsm')->client)) {
SystemMessage::TSM('error',sprintf('Unable to find the dsmadmc at <b>%s</b>',Kohana::$config->load('tsm')->client),'');
return FALSE;
}
if (! $username OR ! $password)
HTTP::redirect('login');
try {
if ($persistent) {
// Create a persistent connection
throw new Kohana_Exception('Cant do persistant connections');
} else {
// Create a connection and force it to be a new link
$this->_connection = sprintf('%s %s -id=%s -password=%s -displ=list -editor=no -dataonly=YES %s %s ',
Kohana::$config->load('tsm')->client,
$database ? '-server='.$database : '',
$username,
$password,
Kohana::$config->load('tsm')->client_errorlogname ? sprintf('-errorlogname=%s',Kohana::$config->load('tsm')->client_errorlogname) : '',
$database ? sprintf('-se=%s',$database) : ''
);
$result = $this->query(Database::SELECT,'SELECT server_name,platform,version,release,level,sublevel FROM status');
if ($result->count()) {
return TSM::instance()->set($username,$password,$result);
} else {
$this->_connection = FALSE;
// @todo Get ANS8034E (ID not recognised), or ??????E (invalid password)
SystemMessage::add(array(
'title'=>_('Login Failed'),
'type'=>'error',
'body'=>_('Invalid Username and/or Password.')
));
return FALSE;
}
}
} catch (ErrorException $e) {
// No connection exists
$this->_connection = NULL;
throw new Database_Exception(':error', array(
':error' => sprintf('%s error in %s (%s)',$e->getMessage(),$e->getFile(),$e->getLine()),
),
$e->getCode());
}
}
protected function execute($sql) {
$this->execute_stdout = '';
// We need to escape any back slashes, since the exec will transpose them
// @todo Is there a better way of doing this?
$sql = str_replace('\\','\\\\',$sql);
$this->execute_stderr = exec($this->_connection.'"'.$sql.'"',$this->execute_stdout,$this->execute_rc);
if (Kohana::$config->load('config.site.mode') == Kohana::DEVELOPMENT)
SystemMessage::TSM('info',sprintf('%s (%s) [%s]',$this->_connection.'"'.$sql.'"',join("\n",$this->execute_stdout),$this->execute_rc),$sql);
// Work out our message codes
$result = array();
foreach ($this->execute_stdout as $line)
if (! preg_match('/^('.$this->msg_format.')\s+/',$line,$matches))
array_push($result,$line);
elseif (! in_array($matches[1],$this->ignore_codes))
array_push($this->_query_msg_codes,$matches[1]);
// If we got a no data code
if (array_intersect($this->_query_msg_codes,$this->nodata_codes)) {
$result = array();
$this->execute_rc = 0;
}
return $result;
}
public function list_columns($table, $like = NULL, $add_prefix = TRUE) {
// Quote the table name
$table = ($add_prefix === TRUE) ? $this->quote_table($table) : $table;
if (is_string($like))
// Search for column names
throw new Kohana_Exception('Like queries not implemented');
else
// Find all column names
$result = $this->query(Database::SELECT, sprintf('SELECT * FROM SYSCAT.COLUMNS WHERE TABNAME=\'%s\'',$table), FALSE);
$count = 0;
$columns = array();
foreach ($result as $row) {
list($type, $length) = $this->_parse_type($row['TYPENAME']);
$column = $this->datatype($type);
$column['column_name'] = $row['COLNAME'];
$column['data_type'] = $type;
$column['is_nullable'] = ($row['NULLS'] == 'TRUE');
$column['ordinal_position'] = ++$count;
switch (strtolower($column['data_type'])) {
case 'float':
if (isset($length))
list($column['numeric_precision'], $column['numeric_scale']) = explode(',', $length);
break;
case 'int':
if (isset($length))
// MySQL attribute
$column['display'] = $length;
break;
case 'string':
switch ($column['data_type']) {
case 'binary':
case 'varbinary':
$column['character_maximum_length'] = $length;
break;
case 'char':
case 'varchar':
$column['character_maximum_length'] = $length;
case 'text':
case 'tinytext':
case 'mediumtext':
case 'longtext':
$column['collation_name'] = $row['Collation'];
break;
case 'enum':
case 'set':
$column['collation_name'] = $row['Collation'];
$column['options'] = explode('\',\'', substr($length, 1, -1));
break;
}
break;
}
// TSM attributes
$column['comment'] = $row['REMARKS'];
$columns[$row['COLNAME']] = $column;
}
return $columns ? $columns : array('');
}
}
?>

View File

@ -0,0 +1,32 @@
<?php defined('SYSPATH') or die('No direct access allowed.');
/**
* TSM Administrator Model
*
* @package TSM Database Module
* @category Models
* @author Deon George
* @copyright (c) 2010-2014 Deon George
* @license http://dev.leenooks.net/license.html
*/
abstract class lnApp_Model_ADMIN extends ORM_TSM {
protected $_table_name = 'ADMINS';
protected $_primary_key = 'ADMIN_NAME';
protected $_display_filters = array(
'LASTACC_TIME'=>array(
array('ORM_TSM::Date',array(':value','d-M-Y')),
),
'PWSET_TIME'=>array(
array('ORM_TSM::Date',array(':value','d-M-Y')),
),
'REG_TIME'=>array(
array('ORM_TSM::Date',array(':value','d-M-Y')),
),
);
public function name() {
return $this->ADMIN_NAME;
}
}
?>

View File

@ -0,0 +1,798 @@
<?php defined('SYSPATH') or die('No direct access allowed.');
/**
* Obtain TSM details on NODES
*
* @package TSM Database Module
* @category Models
* @author Deon George
* @copyright (c) 2010-2014 Deon George
* @license http://dev.leenooks.net/license.html
*/
abstract class lnApp_Model_NODE extends ORM_TSM {
protected $_table_name = 'NODES';
protected $_primary_key = 'NODE_NAME';
protected $_sorting = array(
'NODE_NAME'=>'ASC',
);
protected $_has_one = array(
'DOMAIN'=>array('foreign_key'=>'DOMAIN_NAME','far_key'=>'DOMAIN_NAME'),
);
protected $_has_many = array(
'ACTLOG'=>array('foreign_key'=>'NODENAME','far_key'=>'NODE_NAME'),
'FILESPACE'=>array('foreign_key'=>'NODE_NAME','far_key'=>'NODE_NAME'),
'VOLUMEUSAGE'=>array('foreign_key'=>'NODE_NAME','far_key'=>'NODE_NAME'),
'ASSOCIATION'=>array('foreign_key'=>'NODE_NAME','far_key'=>'NODE_NAME'),
'MGMTCLASS'=>array('foreign_key'=>'DOMAIN_NAME','far_key'=>'DOMAIN_NAME'),
'CLIENTOPT'=>array('foreign_key'=>'OPTIONSET_NAME','far_key'=>'OPTION_SET'),
'SUMMARY'=>array('foreign_key'=>'ENTITY','far_key'=>'NODE_NAME'),
'EVENT'=>array('foreign_key'=>'NODE_NAME','far_key'=>'NODE_NAME'),
'OCC'=>array('foreign_key'=>'NODE_NAME','far_key'=>'NODE_NAME'),
);
protected $_display_filters = array(
'REG_TIME'=>array(
array('ORM_TSM::Date',array(':value','d-M-Y')),
),
'PWSET_TIME'=>array(
array('ORM_TSM::Date',array(':value','d-M-Y')),
),
'LASTACC_TIME'=>array(
array('ORM_TSM::Date',array(':value','d-M-Y')),
),
'LASTSESS_SENT'=>array(
array('number_format',array(':value',0)),
),
'LASTSESS_RECVD'=>array(
array('number_format',array(':value',0)),
),
'LASTSESS_DURATION'=>array(
array('number_format',array(':value',2)),
),
'LASTSESS_IDLEWAIT'=>array(
array('number_format',array(':value',2)),
),
'LASTSESS_COMMWAIT'=>array(
array('number_format',array(':value',2)),
),
'LASTSESS_MEDIAWAIT'=>array(
array('number_format',array(':value',2)),
),
);
/**
* Get all the ACTIVITIY LOG for this NODE
*/
private function _actlog() {
Log::instance()->add(LOG::DEBUG,'ENTER :method',array(':method'=>__METHOD__));
$k = sprintf('%s-%s',__METHOD__,$this->NODE_NAME);
$c = Kohana::$config->load('tsm')->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!
$result = $this->ACTLOG->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;
}
/**
* Get all the ACTIVITY SUMMARY for this NODE
*/
private function _actsum() {
Log::instance()->add(LOG::DEBUG,'ENTER :method',array(':method'=>__METHOD__));
$k = sprintf('%s-%s',__METHOD__,$this->NODE_NAME);
$c = Kohana::$config->load('tsm')->cache;
if (is_null($result = Cache::instance($c)->get($k))) {
$result = array();
// In the interest of performance, we load all the records and get PHP to process it.
// Our ORM caching we reduce the hit on TSM.
foreach (ORM::factory('ACTSUM')->find_all() as $o)
if ($o->ENTITY == $this->NODE_NAME)
array_push($result,$o);
// @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;
}
/**
* Get all the FILESPACES for this NODE
*/
private function _filespaces() {
$result = array();
// In the interest of performance, we load all the records and get PHP to process it.
// Our ORM caching we reduce the hit on TSM.
foreach (ORM::factory('FILESPACE')->find_all() as $o)
if ($o->NODE_NAME == $this->NODE_NAME)
array_push($result,$o);
return $result;
}
/**
* Get all the OCCUPANCY for this NODE
*/
private function _occupancy() {
Log::instance()->add(LOG::DEBUG,'ENTER :method',array(':method'=>__METHOD__));
$k = sprintf('%s-%s',__METHOD__,$this->NODE_NAME);
$c = Kohana::$config->load('tsm')->cache;
if (is_null($result = Cache::instance($c)->get($k))) {
$result = array();
// In the interest of performance, we load all the records and get PHP to process it.
// Our ORM caching we reduce the hit on TSM.
foreach (ORM::factory('OCC')->find_all() as $o)
if ($o->NODE_NAME == $this->NODE_NAME)
array_push($result,$o);
// @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;
}
/**
* Get all the VOLUMES for this NODE
*/
private function _volumeusage() {
Log::instance()->add(LOG::DEBUG,'ENTER :method',array(':method'=>__METHOD__));
$k = sprintf('%s-%s',__METHOD__,$this->NODE_NAME);
$c = Kohana::$config->load('tsm')->cache;
if (is_null($result = Cache::instance($c)->get($k))) {
$result = array();
// In the interest of performance, we load all the records and get PHP to process it.
// Our ORM caching we reduce the hit on TSM.
foreach (ORM::factory('VOLUMEUSAGE')->find_all() as $o)
if ($o->NODE_NAME == $this->NODE_NAME)
array_push($result,$o);
// @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;
}
/**
* Return the version of the TSM client
*/
public function version() {
if ($this->CLIENT_VERSION)
return sprintf('%s.%s.%s.%s',$this->CLIENT_VERSION,$this->CLIENT_RELEASE,$this->CLIENT_LEVEL,$this->CLIENT_SUBLEVEL);
else
return '';
}
/**
* Return the OS version for the TSM client
*/
public function platform() {
return sprintf('%s %s',$this->PLATFORM_NAME,$this->CLIENT_OS_LEVEL ? '('.$this->CLIENT_OS_LEVEL.')' : '');
}
// @todo This needs to return the global configuration.
public function passexp() {
if ($this->PASSEXP)
return 'TBA';
else
return _('No Set');
}
// @todo This needs to be validated as a correct calculation
public function lasttransferpercent() {
$x = 100-($this->LASTSESS_IDLEWAIT+$this->LASTSESS_COMMWAIT+$this->LASTSESS_MEDIAWAIT);
return $x < 0 ? 0 : $x;
}
// @todo This needs to be validated as a correct calculation
public function lasttransfertime() {
if ($this->LASTSESS_DURATION)
return $this->LASTSESS_DURATION*($this->lasttransferpercent()/100);
else
return 0;
}
// @todo This needs to be validated as a correct calculation
public function lastsendperformance() {
if ($this->lasttransfertime())
return $this->LASTSESS_SENT/$this->lasttransfertime()/1024/1024;
else
return 0;
}
// @todo This needs to be validated as a correct calculation
public function lastreceiveperformance() {
if ($this->lasttransfertime())
return $this->LASTSESS_RECVD/$this->lasttransfertime()/1024/1024;
else
return 0;
}
/**
* The last sent aggregate performance
*/
public function lastsendaggperformance() {
if ((real)$this->LASTSESS_DURATION)
return $this->LASTSESS_SENT/$this->LASTSESS_DURATION/1024/1024;
else
return 0;
}
/**
* The last receive aggregate performance
*/
public function lastreceiveaggperformance() {
if ((real)$this->LASTSESS_DURATION)
return $this->LASTSESS_RECVD/$this->LASTSESS_DURATION/1024/1024;
else
return 0;
}
// @todo This should return the system setting (cloptset), if the node setting is not configured.
public function txngroupmax() {
return $this->TXNGROUPMAX;
}
// Test to see if a node has any data of type
// @param $type is BACKUP/ARCHIVE/SPACE MANAGED
public function hasData($type) {
return $this->vols_byctype($type) ? TRUE : FALSE;
}
public function activity() {
Log::instance()->add(LOG::DEBUG,'ENTER :method',array(':method'=>__METHOD__));
$k = sprintf('%s-%s',__METHOD__,$this->NODE_NAME);
$c = Kohana::$config->load('tsm')->cache;
if (is_null($result = Cache::instance($c)->get($k))) {
$result = array();
$result = $this->ACTLOG->ExcludeBA()->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;
}
/**
* Get all the ACTIVITY LOG information for a SESSION
* @param $sid Session ID
* @param $start Session Start Time (to illiminate any duplication session data)
*/
public function actlog_session($sid,$start) {
$result = array();
foreach ($this->_actlog() as $alo)
if ($alo->SESSION == $sid AND $alo->start() >= $start)
array_push($result,$alo);
return $result;
}
/**
* Return the ACTIVITY of this NODE
* @param $type is Bkup/Arch/SpMg
*/
public function act_bybtype($type) {
Log::instance()->add(LOG::DEBUG,'ENTER :method',array(':method'=>__METHOD__));
$k = sprintf('%s-%s-%s',__METHOD__,$this->NODE_NAME,$type);
$c = Kohana::$config->load('tsm')->cache;
if (is_null($result = Cache::instance($c)->get($k))) {
$result = array();
foreach ($this->_actsum() as $aso)
if ($aso->ACTIVITY == $this->datatypemap($type))
array_push($result,$aso);
Sort::MASort($result,'SCHEDULE_NAME,START_TIME');
// @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;
}
/**
* Return the Schedules used for all activites of type
* @param $type is Bkup/Arch/SpMg
*/
public function act_schedules($type) {
$result = array();
foreach ($this->act_bybtype($type) as $ao)
if (! in_array($ao->SCHEDULE_NAME,$result))
array_push($result,$ao->SCHEDULE_NAME);
return $result;
}
/**
* Return the BACKUP TYPES used by this NODE
* ie: Bkup/Arch/SpMg
*/
public function btypes() {
Log::instance()->add(LOG::DEBUG,'ENTER :method',array(':method'=>__METHOD__));
$k = sprintf('%s-%s',__METHOD__,$this->NODE_NAME);
$c = Kohana::$config->load('tsm')->cache;
if (is_null($result = Cache::instance($c)->get($k))) {
$result = array();
foreach ($this->_occupancy() as $oo)
if (! in_array($oo->TYPE,$result))
array_push($result,$oo->TYPE);
// @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;
}
/**
* Return the total of a field for this NODE has by backup TYPE
* @param $field the field to check
* @param $data the value of that field to match
* @param $metric is metric of the storpage pool, eg: NUM_FILES
*/
private function _data_int($field,$data,$metric) {
Log::instance()->add(LOG::DEBUG,'ENTER :method',array(':method'=>__METHOD__));
$k = sprintf('%s-%s-%s-%s-%s',__METHOD__,$this->NODE_NAME,$field,$data,$metric);
$c = Kohana::$config->load('tsm')->cache;
if (is_null($result = Cache::instance($c)->get($k))) {
$result = 0;
foreach ($this->_occupancy() as $oo)
if ($oo->{$field} == $data)
$result += $oo->{$metric};
// @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;
}
/**
* Return the data that this NODE has in a STORAGE POOL by backup TYPE
* @param $pool is STORAGE POOL NAME
* @param $metric is metric of the storpage pool, eg: NUM_FILES
* @param $type is Bkup/Arch/SpMg
*/
private function _data_bypoolbybtype($pool,$metric,$type) {
Log::instance()->add(LOG::DEBUG,'ENTER :method',array(':method'=>__METHOD__));
$k = sprintf('%s-%s-%s-%s-%s',__METHOD__,$this->NODE_NAME,$pool,$metric,$type);
$c = Kohana::$config->load('tsm')->cache;
if (is_null($result = Cache::instance($c)->get($k))) {
$result = 0;
foreach ($this->_occupancy() as $oo)
if ($oo->STGPOOL_NAME == $pool AND $oo->TYPE == $type)
$result += $oo->{$metric};
// @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;
}
/**
* Return the FILES that this NODE has by backup TYPE
* @param $type is Bkup/Arch/SpMg
*/
public function file_bybtype($type) {
Log::instance()->add(LOG::DEBUG,'FLYBY :method',array(':method'=>__METHOD__));
return $this->_data_int('TYPE',$type,'NUM_FILES');
}
/**
* Return the FILES that this NODE has in a STORAGE POOL
* @param $pool is STORAGE POOL NAME
*/
public function file_bypool($pool) {
Log::instance()->add(LOG::DEBUG,'FLYBY :method',array(':method'=>__METHOD__));
return $this->_data_int('STGPOOL_NAME',$pool,'NUM_FILES');
}
public function file_bypoolbybtype($pool,$type) {
Log::instance()->add(LOG::DEBUG,'FLYBY :method',array(':method'=>__METHOD__));
return $this->_data_bypoolbybtype($pool,'NUM_FILES',$type);
}
/**
* Return the FILES that this NODE has in a STORAGE POOL TYPE
* @param $type is ACTIVEDATA/PRIMARY/COPY
*/
public function file_byptype($type) {
Log::instance()->add(LOG::DEBUG,'ENTER :method',array(':method'=>__METHOD__));
$result = 0;
foreach ($this->stgpools_byptype($type) as $spo)
$result += $this->file_bypool($spo);
Log::instance()->add(LOG::DEBUG,'EXIT :method',array(':method'=>__METHOD__));
return $result;
}
public function file_active() {
return $this->file_byptype('ACTIVE') == 0 ? 'Unknown' : (int)$this->file_byptype('ACTIVE')/(int)$this->file_byptype('PRIMARY');
}
public function file_mediaprotection() {
return number_format((int)$this->file_byptype('COPY')/(int)$this->file_byptype('PRIMARY')*100,2);
}
public function fs() {
return $this->_filespaces();
}
public function fs_capacity() {
$result = 0;
foreach ($this->_filespaces() as $fso)
$result += $fso->CAPACITY;
return (int)$result;
}
public function fs_data() {
$result = 0;
foreach ($this->_filespaces() as $fso)
$result += $fso->utilsation();
return (int)$result;
}
public function fs_logical() {
$result = 0;
foreach ($this->_filespaces() as $fso)
$result += $fso->data_logical();
return (int)$result;
}
public function fs_utilisation() {
return round($this->fs_data()/$this->fs_capacity()*100,2);
}
public function fs_vol($vol) {
Log::instance()->add(LOG::DEBUG,'ENTER :method',array(':method'=>__METHOD__));
$k = sprintf('%s-%s-%s',__METHOD__,$this->NODE_NAME,$vol);
$c = Kohana::$config->load('tsm')->cache;
if (is_null($result = Cache::instance($c)->get($k))) {
$result = array();
foreach ($this->_volumeusage() as $vuo)
if ($vuo->VOLUME_NAME == $vol AND ! in_array($vuo->FILESPACE_NAME,$result))
array_push($result,$vuo->FILESPACE);
Sort::MASort($result,'FILESPACE_NAME');
// @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;
}
/**
* Return a Graph of the BA Client Sessions
* @param $type is Bkup/Arch/SpMg
* @see [node/ajaxjson_basessions]
*/
public function graph_basessions($type='Bkup',$schedule='') {
$chart = 'ComboChart';
$google = GoogleChart::factory($chart)
->div(sprintf('bas_%s_%s',$type,$schedule))
->dataurl(URL::site(sprintf('node/ajaxjson_basessions/%s?c=%s&s=%s&t=%s',$this->NODE_NAME,$chart,$schedule,$type)));
return (string)$google;
}
/**
* Return a Graph of the Schedule Backup Activity
* @param $type is Bkup/Arch/SpMg
* @see [node/ajaxjson_schedules]
*/
public function graph_schedules($type='Bkup',$schedule='') {
$chart = 'ComboChart';
$google = GoogleChart::factory($chart)
->div(sprintf('sch_%s_%s',$type,$schedule))
->dataurl(URL::site(sprintf('node/ajaxjson_schedules/%s?c=%s&s=%s&t=%s',$this->NODE_NAME,$chart,$schedule,$type)));
return (string)$google;
}
/**
* Return the LOGICAL_MB that this NODE has by backup TYPE
* @param $type is Bkup/Arch/SpMg
*/
public function logmb_bybtype($type) {
Log::instance()->add(LOG::DEBUG,'FLYBY :method',array(':method'=>__METHOD__));
return $this->_data_int('TYPE',$type,'LOGICAL_MB');
}
/**
* Return the LOGICAL_MB that this NODE has in a STORAGE POOL
* @param $pool is STORAGE POOL NAME
*/
public function logmb_bypool($pool) {
Log::instance()->add(LOG::DEBUG,'FLYBY :method',array(':method'=>__METHOD__));
return $this->_data_int('STGPOOL_NAME',$pool,'LOGICAL_MB');
}
public function logmb_bypoolbybtype($pool,$type) {
Log::instance()->add(LOG::DEBUG,'FLYBY :method',array(':method'=>__METHOD__));
return $this->_data_bypoolbybtype($pool,'LOGICAL_MB',$type);
}
/**
* Return the FILES that this NODE has in a STORAGE POOL TYPE
* @param $type is ACTIVEDATA/PRIMARY/COPY
*/
public function logmb_byptype($type) {
Log::instance()->add(LOG::DEBUG,'ENTER :method',array(':method'=>__METHOD__));
$result = 0;
foreach ($this->stgpools_byptype($type) as $spo)
$result += $this->logmb_bypool($spo);
Log::instance()->add(LOG::DEBUG,'EXIT :method',array(':method'=>__METHOD__));
return $result;
}
public function occupancy() {
return $this->_occupancy();
}
/**
* Return the STORAGE POOLS this NODE has data in
*/
public function stgpools() {
Log::instance()->add(LOG::DEBUG,'ENTER :method',array(':method'=>__METHOD__));
$k = sprintf('%s-%s',__METHOD__,$this->NODE_NAME);
$c = Kohana::$config->load('tsm')->cache;
if (is_null($result = Cache::instance($c)->get($k))) {
$x = $result = array();
foreach ($this->_occupancy() as $oo)
if (! in_array($oo->STGPOOL_NAME,$x)) {
array_push($result,$oo->STGPOOL);
array_push($x,$oo->STGPOOL_NAME);
}
// @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;
}
/**
* Return the STORAGE POOL TYPES used by this NODE
* ie: ACTIVE/PRIMARY/COPY
* @todo This should be sorted by PRIMARY/ACTIVE/COPY
*/
public function stgpooltypes() {
Log::instance()->add(LOG::DEBUG,'ENTER :method',array(':method'=>__METHOD__));
$k = sprintf('%s-%s',__METHOD__,$this->NODE_NAME);
$c = Kohana::$config->load('tsm')->cache;
if (is_null($result = Cache::instance($c)->get($k))) {
$result = array();
foreach ($this->stgpools() as $spo)
if (! in_array($spo->POOLTYPE,$result))
array_push($result,$spo->POOLTYPE);
// @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;
}
/**
* Return the STORAGE POOLS that this NODE uses by BACKUP TYPE
* @param $type is Bkup/Arch/SpMg
*/
public function stgpools_bybtype($type) {
Log::instance()->add(LOG::DEBUG,'ENTER :method',array(':method'=>__METHOD__));
$k = sprintf('%s-%s-%s',__METHOD__,$this->NODE_NAME,$type);
$c = Kohana::$config->load('tsm')->cache;
if (is_null($result = Cache::instance($c)->get($k))) {
$x = $result = array();
foreach ($this->_occupancy() as $oo)
if ($oo->TYPE == $type AND ! in_array($oo->STGPOOL_NAME,$x)) {
array_push($result,$oo->STGPOOL);
array_push($x,$oo->STGPOOL_NAME);
}
// @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;
}
/**
* Return the STORAGE POOLS that this NODE uses by BACKUP TYPE
* @param $type is ACTIVEDATA/PRIMARY/COPY
*/
public function stgpools_byptype($type) {
Log::instance()->add(LOG::DEBUG,'ENTER :method',array(':method'=>__METHOD__));
$k = sprintf('%s-%s-%s',__METHOD__,$this->NODE_NAME,$type);
$c = Kohana::$config->load('tsm')->cache;
if (is_null($result = Cache::instance($c)->get($k))) {
$result = array();
foreach ($this->stgpools() as $spo)
if ($spo->POOLTYPE == $type)
array_push($result,$spo);
// @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 vols_bybtype($type) {
return $this->vols_byctype($this->datatypemap($type));
}
private function _vols_metric($metric,$data) {
Log::instance()->add(LOG::DEBUG,'ENTER :method',array(':method'=>__METHOD__));
$k = sprintf('%s-%s-%s-%s',__METHOD__,$this->NODE_NAME,$metric,$data);
$c = Kohana::$config->load('tsm')->cache;
if (is_null($result = Cache::instance($c)->get($k))) {
$x = $result = array();
foreach ($this->_volumeusage() as $vuo)
if ($vuo->{$metric} == $data AND ! in_array($vuo->VOLUME_NAME,$x)) {
array_push($result,$vuo->VOLUME);
array_push($x,$vuo->VOLUME_NAME);
}
Sort::MASort($result,'VOLUME_NAME');
// @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;
}
/**
* Return the VOLUMES that this NODE uses by BACKUP TYPE
* @param $type is BACKUP/ARCHIVE/SPACE MANAGED
*/
public function vols_byctype($type) {
return $this->_vols_metric('COPY_TYPE',$type);
}
/**
* Return the VOLUMES that this NODE uses
* @param $pool is STORAGE POOL NAME
*/
public function vols_bypool($pool) {
return $this->_vols_metric('STGPOOL_NAME',$pool);
}
/**
* Return the VOLUMES that this NODE has in a STORAGE POOL TYPE
* @param $type is ACTIVEDATA/PRIMARY/COPY
*/
public function vols_byptype($type) {
Log::instance()->add(LOG::DEBUG,'ENTER :method',array(':method'=>__METHOD__));
$result = array();
foreach ($this->stgpools_byptype($type) as $spo)
$result = array_merge($result,$this->vols_bypool($spo));
Log::instance()->add(LOG::DEBUG,'EXIT :method',array(':method'=>__METHOD__));
return $result;
}
/**
* Return the VOLUMES that this NODE uses by POOL and BACKUP TYPE
* @param $pool is STORAGE POOL NAME
* @param $type is Bkup/Arch/SpMg
*/
public function vols_bypoolbybtype($pool,$type) {
return $this->vols_bypoolbyctype($pool,$this->datatypemap($type));
}
/**
* Return the VOLUMES that this NODE uses by POOL and BACKUP TYPE
* @param $pool is STORAGE POOL NAME
* @param $type is BACKUP/ARCHIVE/SPACE MANAGED
*/
public function vols_bypoolbyctype($pool,$type) {
Log::instance()->add(LOG::DEBUG,'ENTER :method',array(':method'=>__METHOD__));
$k = sprintf('%s-%s-%s-%s',__METHOD__,$this->NODE_NAME,$pool,$type);
$c = Kohana::$config->load('tsm')->cache;
if (is_null($result = Cache::instance($c)->get($k))) {
$result = array();
foreach ($this->_volumeusage() as $vuo)
if ($vuo->STGPOOL_NAME == $pool AND $vuo->COPY_TYPE == $type AND ! in_array($vuo->VOLUME_NAME,$result))
array_push($result,$vuo->VOLUME);
Sort::MASort($result,'VOLUME_NAME');
// @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 volumeusage() {
return $this->_volumeusage();
}
}
?>

View File

@ -0,0 +1,38 @@
<?php defined('SYSPATH') or die('No direct access allowed.');
/**
* This class contains our TSM information
*
* @package TSM Database Module
* @category Helpers
* @author Deon George
* @copyright (c) 2010-2014 Deon George
* @license http://dev.leenooks.net/license.html
*/
abstract class lnApp_TSM {
static $_online = FALSE;
public function set($username,$password,Database_TSM_Result $server) {
return TSM::$_online = TRUE;
}
public static function online() {
return TSM::$_online;
}
public static function instance() {
return new TSM;
}
public static function name() {
return Session::instance()->get('SERVER')->get('SERVER_NAME');
}
public static function version() {
$s = Session::instance()->get('SERVER')->rewind()->as_array();
$s = array_pop($s);
return sprintf('%s.%s.%s.%s',$s['VERSION'],$s['RELEASE'],$s['LEVEL'],$s['SUBLEVEL']);
}
}
?>

View File

@ -0,0 +1,78 @@
<?php defined('SYSPATH') or die('No direct access allowed.');
/**
* Configuration - TSM Client
*
* @package TSM Database Module
* @category Configuration
* @author Deon George
* @copyright (c) 2010-2014 Deon George
* @license http://dev.leenooks.net/license.html
*/
return array
(
'dsmadmc' => array
(
'type' => 'tsm_dsmadmc',
'connection' => array(
/**
* The following options are available for MySQL:
*
* string hostname server hostname, or socket
* string database database name
* string username database username
* string password database password
* boolean persistent use persistent connections?
*
* Ports and sockets may be appended to the hostname.
*/
//'hostname' => 'localhost', // Unused
'username' => 'admin',
'password' => 'tsm0593lx',
//'persistent' => FALSE, // Unused
),
'table_prefix' => '',
'charset' => 'utf8',
'caching' => TRUE,
'cache' => array(
'ASSOCIATIONS' => 1200,
'AR_COPYGROUPS' => 1200,
'BU_COPYGROUPS' => 1200,
'CLIENT_SCHEDULES' => 1200,
'CLIENTOPTS' => 1200,
'DEVCLASSES' => 1200,
'DOMAINS' => 1200,
'DRIVES' => 1200,
'EVENTS' => 1200,
'FILESPACES' => 1200,
'LIBRARIES' => 1200,
'LIBVOLUMES' => 1200,
'MEDIA' => 1200,
'MGMTCLASSES' => 1200,
'NODES' => 1200,
'OCCUPANCY' => 1200,
'PATHS' => 1200,
'SCHEMA' => 604800,
'STGPOOLS' => 1200,
'SUMMARY' => 180,
'VOLHISTORY' => 1200,
'VOLUMES' => 1200,
'VOLUMEUSAGE' => 1200,
),
'cachepreload' => array(
'DEVCLASSES' => 1200,
'DOMAINS' => 1200,
'DRIVES' => 1200,
'LIBVOLUMES' => 1200,
'LIBRARIES' => 1200,
'MEDIA' => 1200,
'NODES' => 1200,
'STGPOOLS' => 1200,
'VOLHISTORY' => 1200,
'VOLUMES' => 1200,
),
'profiling' => TRUE,
),
);
?>

View File

@ -0,0 +1,18 @@
<?php defined('SYSPATH') or die('No direct access allowed.');
/**
* TSM system default configurable items.
*
* @package TSM Database Module
* @category Configuration
* @author Deon George
* @copyright (c) 2010-2014 Deon GEorge
* @license http://dev.leenooks.net/license.html
*/
return array(
'client' => '/opt/tivoli/tsm/client/ba/bin/dsmadmc',
'client_type' => 'dsmadmc',
'client_errorlogname' => '/tmp/tsm-errorlog.log',
);
?>