Revize 929
Přidáno uživatelem Ondřej Fibich před více než 13 roky(ů)
freenetis/branches/testing/application/models/log.php | ||
---|---|---|
* Creates table for logs
|
||
* @author Ondřej Fibich
|
||
*/
|
||
public function create_table()
|
||
public static function create_table()
|
||
{
|
||
$this->db->query("
|
||
$db = new Database();
|
||
$db->query("
|
||
CREATE TABLE IF NOT EXISTS `logs` (
|
||
`id` int(11) NOT NULL AUTO_INCREMENT,
|
||
`table_name` varchar(255) COLLATE utf8_czech_ci NOT NULL,
|
freenetis/branches/testing/application/controllers/settings.php | ||
---|---|---|
$this->form->group('')->label(url_lang::lang('texts.Centralized logging'));
|
||
$this->form->group('')->label('ulogd '.help::hint('ulogd'))->message();
|
||
$this->form->input('ulogd_update_interval')->label(url_lang::lang('texts.Interval of update').':')->rules('required|valid_numeric')->value($this->settings->get('ulogd_update_interval'))->help(help::hint('ulogd_update_interval'));
|
||
$this->form->group('')->label(url_lang::lang('texts.Action logs').' '.help::hint('ulogd_active'));
|
||
$this->form->checkbox('action_logs_active')->value('1')->label(url_lang::lang('texts.Enable action logs'))->help(help::hint('action_logs_active'));
|
||
$this->form->group('')->label(url_lang::lang('texts.Action logs') . ' ' . help::hint('action_logs_active'));
|
||
$this->form->checkbox('action_logs_active')->value('1')->label(url_lang::lang('texts.Enable action logs'));
|
||
$this->form->group('')->label(url_lang::lang('texts.Active members').' '.help::hint('ulogd_active'));
|
||
$this->form->input('ulogd_active_count')->label(url_lang::lang('texts.Count of active members').':')->rules('required|valid_ulogd_active_count')->value($this->settings->get('ulogd_active_count'))->help(help::hint('ulogd_active_count'));
|
||
$this->form->dropdown('ulogd_active_type')->label(url_lang::lang('texts.Type of traffic').':')->rules('required')->options(array(0 => '----- '.url_lang::lang('texts.Select type').' -----', 'upload' => url_lang::lang('texts.upload'), 'download' => url_lang::lang('texts.download'),'total' => url_lang::lang('texts.both').' ('.url_lang::lang('texts.upload').' + '.url_lang::lang('texts.download').')'))->selected($this->settings->get('ulogd_active_type'))->help(help::hint('ulogd_active_type'));
|
||
$this->form->submit('submit')->value(url_lang::lang('texts.Save'));
|
||
special::required_forge_style($this->form, ' *', 'required');
|
||
|
||
$log_model = new Log_Model();
|
||
if (version_compare($log_model->get_mysql_version(), '5.1.0', '<'))
|
||
$user_model = new User_Model();
|
||
if (version_compare($user_model->get_mysql_version(), '5.1.0', '<'))
|
||
{
|
||
$this->form->action_logs_active->label(url_lang::lang('texts.Enable action logs').' - <span class="error">' . url_lang::lang('texts.require MySQL %s and higher', array('5.1')) . '</span>');
|
||
$this->form->action_logs_active->disabled('disabled');
|
||
... | ... | |
// try to create log table if not exists
|
||
if ($action_logs_active == '1')
|
||
{
|
||
$log_model->create_table();
|
||
Log_Model::create_table();
|
||
}
|
||
|
||
$issaved = true;
|
freenetis/branches/testing/application/upgrade_sql/upgrade_sql_870.php | ||
---|---|---|
<?php
|
||
|
||
/**
|
||
* Create actions log table, if database is in version 5.2 or higher
|
||
*/
|
||
function upgrade_sql_870_after()
|
||
{
|
||
// create new table which have got partitions and NO indexes
|
||
$log_model = new Log_Model();
|
||
$log_model->create_table();
|
||
$user_model = new User_Model();
|
||
|
||
if (version_compare($user_model->get_mysql_version(), '5.1.0', '>='))
|
||
{
|
||
// create new table which have got partitions and NO indexes
|
||
Log_Model::create_table();
|
||
}
|
||
|
||
return true;
|
||
}
|
||
|
freenetis/branches/testing/application/upgrade_sql/upgrade_sql.php | ||
---|---|---|
return $svnid;
|
||
}
|
||
|
||
/**
|
||
* Set action log trigger with current state.
|
||
*/
|
||
function upgrade_sql_before()
|
||
{
|
||
$db = new Database();
|
||
$value = '1';
|
||
|
||
try
|
||
{
|
||
$db->query("SELECT * FROM logs LIMIT 1");
|
||
}
|
||
catch (Exception $e)
|
||
{
|
||
$value = '0';
|
||
}
|
||
|
||
$db->query("INSERT INTO config (name, value) VALUES ('action_logs_active', '".$value."');");
|
||
|
||
return true;
|
||
}
|
||
|
||
// array of sql queries that upgrade database
|
||
$upgrade_sql[get_SVN_rev()] = array(
|
||
|
||
// Primary key to name
|
||
"ALTER TABLE config ADD PRIMARY KEY (name);",
|
||
// Action logs trigger
|
||
"INSERT INTO config (name, value) VALUES ('action_logs_active', '0');"
|
||
|
||
);
|
||
?>
|
freenetis/branches/testing/application/libraries/MY_Controller.php | ||
---|---|---|
catch (Kohana_Database_Exception $e)
|
||
{
|
||
$message = "SVN: $i <br />"
|
||
.url_lang::lang('texts.file').": upgrade_sql_$i.php<br /><br />";
|
||
.url_lang::lang('texts.file').": upgrade_sql_$i.php<br /><br />
|
||
$query";
|
||
$this->error(UPGRADE, $message);
|
||
}
|
||
catch (Exception $e)
|
freenetis/branches/testing/application/views/menu.php | ||
---|---|---|
<li><?php echo html::anchor(url_lang::base().'access_rights', url_lang::lang('texts.Access rights')) ?></li>
|
||
<li><?php echo html::anchor(url_lang::base().'fees', url_lang::lang('texts.Fees')) ?></li>
|
||
<li><?php echo html::anchor(url_lang::base().'login_logs', url_lang::lang('texts.Login logs')) ?></li>
|
||
<?php if (Settings::get('action_logs_active') == 1): ?>
|
||
<li><?php echo html::anchor(url_lang::base().'logs', url_lang::lang('texts.Action logs')) ?></li>
|
||
<?php endif; ?>
|
||
<li><?php echo html::anchor(url_lang::base().'stats', url_lang::lang('texts.Stats')) ?></li>
|
||
<li><?php echo html::anchor(url_lang::base().'translations', url_lang::lang('texts.Translations')) ?></li>
|
||
<li><?php echo html::anchor(url_lang::base().'enum_types', url_lang::lang('texts.Enumerations')) ?></li>
|
Také k dispozici: Unified diff
Dokonceni zmen v instalaci pro logy akci.