Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/smgladkovskiy/kohana-logapp
Module for application actions logging and table locking in Kohana v3 apps
https://github.com/smgladkovskiy/kohana-logapp
Last synced: 2 days ago
JSON representation
Module for application actions logging and table locking in Kohana v3 apps
- Host: GitHub
- URL: https://github.com/smgladkovskiy/kohana-logapp
- Owner: smgladkovskiy
- Created: 2010-03-25T06:15:52.000Z (almost 15 years ago)
- Default Branch: master
- Last Pushed: 2010-05-20T16:37:06.000Z (over 14 years ago)
- Last Synced: 2024-11-05T12:28:00.886Z (about 2 months ago)
- Language: PHP
- Homepage:
- Size: 105 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Logapp
Logapp is a module to make application logs (for example, users login/logout, adding/deleting/editing
information etc.) and editing table locks (to prevent multiple table record editing).## Quick Start
* Place logapp module to modules folder;
* Enable logapp module in bootstrap.php;
* Copy-paste logap config to you application/config folder;
* Build database tables.To start logging call Logapp instance method write():
Logapp::instance()->write($tog_type, $log_result, $log_description);
Logapp remembers tog_types adn log_results automaticly. You don't need to fill certain tables before
using this helper.To work with table locking:
// Sets table record lock
Logapp::instance()->set_lock($table_name, $record_id, $user_id);// Investigate table record lock existance
// Returnes lock object or FALSE if record is not locked
$lock = Logapp::instance()->get_lock($table_name, $record_id);// Clears table record lock
// Uses lock object
// Returnes TRUE if lock was deleted
$lock = Logapp::instance()->clear_lock($lock_object);// Deletes all locks
$lock = Logapp::instance()->clear_all_locks();## Database structure
CREATE TABLE IF NOT EXISTS `locks` (
`id` int(10) unsigned NOT NULL auto_increment,
`time` int(10) unsigned NOT NULL COMMENT 'timestamp',
`table_name` varchar(20) NOT NULL,
`table_record` smallint(5) unsigned NOT NULL,
`user_id` smallint(5) unsigned default NULL,
PRIMARY KEY (`id`),
KEY `fk_lock_user` (`user_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;CREATE TABLE IF NOT EXISTS `logs` (
`id` int(10) unsigned NOT NULL auto_increment,
`time` int(10) unsigned NOT NULL COMMENT 'timestamp',
`type_id` smallint(5) unsigned NOT NULL COMMENT 'log type',
`result_id` smallint(5) unsigned NOT NULL,
`user_id` smallint(5) unsigned default NULL,
`description` text NOT NULL,
PRIMARY KEY (`id`),
KEY `fk_log_user` (`user_id`),
KEY `fk_log_result` (`result_id`),
KEY `fk_log_type` (`type_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;CREATE TABLE IF NOT EXISTS `log_results` (
`id` smallint(5) unsigned NOT NULL auto_increment,
`name` varchar(64) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;CREATE TABLE IF NOT EXISTS `log_types` (
`id` smallint(5) unsigned NOT NULL auto_increment,
`name` varchar(64) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;ALTER TABLE `logs`
ADD CONSTRAINT `fk_log_type` FOREIGN KEY (`type_id`) REFERENCES `log_types` (`id`) ON UPDATE CASCADE,
ADD CONSTRAINT `fk_log_result` FOREIGN KEY (`result_id`) REFERENCES `log_results` (`id`) ON UPDATE CASCADE,
ADD CONSTRAINT `fk_log_user` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON UPDATE CASCADE;ALTER TABLE `locks`
ADD CONSTRAINT `fk_lock_user` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON UPDATE CASCADE;