User tests: Successful: Unsuccessful:
Creating a new plugin plg_sys_userlogs
and a new component com_userlogs
to record users action withing the CMS. To make them installed with the CMS install/update, I added the related SQL queries to SQL files in installation/sql
.
Download the repository and install it as you install Joomla normally.
After installation you need first to activate the plugin so that the users actions can be logged.
Go to http://www.example.com/index.php?option=com_installer&view=manage
and look for a plugin called "System - User actions Log" and then activate it.
Now your Joomla! website can store users' actions.
To view the logs just go to the component as shown in this image
You will have control over the logs as a super admin that allows you to sort, search, export or delete logs as you want.
Go to http://www.example.com/index.php?option=com_installer&view=manage
and look for a plugin called "System - User actions Log" and go to its options. You will find a field Select events to be logged where you can choose which Extension you need to log its actions.
AS every component in Joomla, this component has permissions that are default to superusers only.
Just click on the options button on the top right of the component page and you will view the permissions of the component.
Every user that has permission to view the logs can choose whether to receive e-mail notifications when a new action happen.
The user will just go to the account settings, and under "Basic Settings" tab you can choose whether to receive e-mail notifications and you also can choose which extensions you need to receive logs from.
Status | New | ⇒ | Pending |
Category | ⇒ | Administration Components SQL Postgresql MS SQL Language & Strings Installation |
Labels |
Added:
?
?
|
Immediately after install - go to the component and try to export all the logs
PHP Fatal error: Call to undefined function from() in administrator/components/com_userlogs/models/userlogs.php on line 259
Tested loggin of installing a basic plugin - the result was
a php notice
PHP Notice: Array to string conversion in /libraries/joomla/language/text.php on line 312
and a field content of
Extension installed, its id="Array"
I'm getting LOTS of php notices all over the place with whatever I do. Please retest your code
Retested and now I get new errors
[29-Aug-2016 17:40:02 Europe/London] PHP Notice: Trying to get property of non-object in /Applications/MAMP/htdocs/github-joomla-cms/plugins/system/userlogs/userlogs.php on line 397
[29-Aug-2016 17:40:02 Europe/London] PHP Notice: Trying to get property of non-object in /Applications/MAMP/htdocs/github-joomla-cms/plugins/system/userlogs/userlogs.php on line 400
[29-Aug-2016 17:40:09 Europe/London] PHP Notice: Undefined variable: type in /Applications/MAMP/htdocs/github-joomla-cms/plugins/system/userlogs/userlogs.php on line 688
[29-Aug-2016 17:40:09 Europe/London] PHP Notice: Undefined index: extension_name in /Applications/MAMP/htdocs/github-joomla-cms/plugins/system/userlogs/userlogs.php on line 648
[29-Aug-2016 17:40:09 Europe/London] PHP Notice: Undefined index: extension_name in /Applications/MAMP/htdocs/github-joomla-cms/plugins/system/userlogs/userlogs.php on line 648
[29-Aug-2016 17:40:09 Europe/London] PHP Notice: Undefined variable: type in /Applications/MAMP/htdocs/github-joomla-cms/plugins/system/userlogs/userlogs.php on line 596
[29-Aug-2016 17:40:09 Europe/London] PHP Notice: Undefined variable: type in /Applications/MAMP/htdocs/github-joomla-cms/plugins/system/userlogs/userlogs.php on line 596
[29-Aug-2016 17:40:09 Europe/London] PHP Notice: Undefined index: extension_name in /Applications/MAMP/htdocs/github-joomla-cms/plugins/system/userlogs/userlogs.php on line 644
Thank you @brianteeman for your feedback.
Are the notices still there after this last commit?
And sorry for the missed up code
The language strings for the profile is not showing correctly at:
www.website.com/administrator/index.php?option=com_admin&view=profile&layout=edit&id=659
PLG_SYSTEM_USERLOGS_NOTIFICATIONS
PLG_SYSTEM_USERLOGS_NOTIFICATIONS_DESC
PLG_SYSTEM_USERLOGS_EXTENSIONS_NOTIFICATIONS
PLG_SYSTEM_USERLOGS_EXTENSIONS_NOTIFICATIONS_DESC
A great new feature, I like it very much, well done.
I had to create the table manually using phpMyAdmin-4.4.15.5 and still running PHP5.4 on 1 server.
CREATE TABLE IF NOT EXISTS #__user_logs
(
...
message
text NOT NULL DEFAULT '',
...
MySQL said: Documentation
#1101 - BLOB/TEXT column 'message' can't have a default value
EDIT: seems to be old MySQL "bug/limitation/compatibility across platforms". I'm running Windows with MySQL 5.5.24
EDIT2: works on Windows with MySQL 5.6.21 XAMPP V3.2.1
Labels |
Added:
?
|
Labels |
Added:
?
|
[30-Aug-2016 14:24:50 Europe/London] PHP Notice: Undefined variable: type_title in /plugins/system/userlogs/userlogs.php on line 188
Take a look at com_finder and see how it displays a message when you do not have the plugin enabled. Need to do something similar for userlogs
Issues I reported about search filters and sort dropdown are still present
Thank you all for your feedback. I'm woking on these issues but I need only one day to fix them.
Thank you for your patience.
hmm can't make it work... applied PR by patch tester - it says its applied successfully, no new component visible in 'components' menu, had to discover it, then no tables present, had to fix database... and no System - User actions Log plugin was installed only User actions Log component visible in management.
mysql 5.5.50
php 5.6.24
Joomla! 3.6.3-dev Development
any pointers?
@jsubri thanks for a tip about existing instalation, installed J from last commit in this PR and it works.
CREATE TABLE IF NOT EXISTS #__user_logs
(
...
ip_address
VARCHAR(30) NOT NULL DEFAULT 'PLG_SYSTEM_USERLOG_DISABLED',
PRIMARY KEY (id
)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 DEFAULT COLLATE=utf8mb4_unicode_ci;
Using language strings for field default values isn't a good idea IMO, which language would you use in multilingual website? Either use 0.0.0.0 or 255.255.255.255.
btw. PLG_SYSTEM_USERLOG_DISABLED is missing from any language file.
As I said in my first post, more beautification for logs would be great ;)
Edit: 'Select events to be logged' option displays components titles but extension column in component shows system names (ie COM_CONTENT).
Edit2: Each item in list of components/extension in 'Select events to be logged' takes full width of page its easy to uncheck an item if you click on 'empty' space.
Still a notice when deleting a user:
Notice: Undefined index: edited_user in ...\plugins\system\userlogs\userlogs.php on line 673 User "" deleted
@brianteeman Do you still see the field Select events to be logged
and there is nowhere for input
Sorry I still cannot get this to work. This is what I have done - maybe you can see the error
This shows the component and plugin installed but I still dont get the Select events to be logged list
I have a problem with applying the PR with com_patchtester. It gives me error Fatal error: Allowed memory size of 268435456 bytes exhausted
. But when I go to discover
, I find the plugin and the component and I find the database tables that needs to be created in the database
part. When I see the tables __user_logs_extensions
and #__user_logs_tables_data
in the database, I find them empty as the insert queries here are not executed.
What could cause such an error?
Try using patchtester 3alpha available in the patchtester repository
https://github.com/joomla-extensions/patchtester/releases/tag/3.0.0-alpha2
Patchtester 3 alpha doesn't get the plugin. Patchtester 2 gets the plugin and the component but has the previous error.
Patch tester does not install new extensions. It simply grabs the files that are marked as changed in a pull request and downloads them to your local filesystem (backing up existing files to allow a clean revert). No matter the version of patch tester you're using you'd have to discover and install any new extensions after the patch is applied or manually run any needed database changes to test a patch.
Try using patchtester 3alpha available in the patchtester repository
https://github.com/joomla-extensions/patchtester/releases/tag/3.0.0-alpha2
was because of this comment
I have a problem with applying the PR with com_patchtester. It gives me error Fatal error: Allowed memory size of 268435456 bytes exhausted.
This is solved in v3alpha of the patchtester
@mbabker @andrepereiradasilva The problem I have with patchtester v3alpha is that it doesn't grab the plugin files and the v2 grabs all the files but produces the error
Fatal error: Allowed memory size of 268435456 bytes exhausted.
File an issue on the patch tester repo with all of the info requested in the template. I would also suggest turning error reporting to maximum and debug mode on; the patch tester component might not raise an error about the plugin files not being downloaded but one of the core Joomla APIs may.
No matter the issue the patch tester has known limitations; for example executing the SQL statements needed for a patch just won't happen and it's out of scope for the extension to do so.
deleting an article does not complete the message in the User Actions Log:
(s) [""] became trashed
I think I found the problem that makes you @brianteeman and @AlexRed have the problems that you see.
These INSERT
queries
are essential for the extension to work well. If you apply the PR using the patch tester and go and fix the database, you will get 163 database changes did not alter table structure and were skipped.
These skipped database changes include those queries above.
I don't know how to solve it, but you can test the PR from my fork https://github.com/muhakh/joomla-cms/tree/staging
I have tested this item
Tested with muhakh's fork.
Looks like brianteeman and AlexRed 's issue has been corrected.
Nice addition.
I guess it will need to be thoroughly explained and advertised if only not to let users overload unnecessarily their DB.
I had "patchtester" issue as the plugins/system/userlogs/. didn't got copied over.
Beside that works fine. +1
In my opinion there should be a headers for csv to get clear understanding of data.
I have tested this item
Labels |
Removed:
?
|
Category | Administration Components SQL Postgresql MS SQL Language & Strings Installation | ⇒ | Administration com_admin SQL Postgresql MS SQL Language & Strings Installation Components |
@muhakh make a second pass code review in the code. I focused on sql (install and update), ini language and xml here.
Added a lot of comments, some are minor CS, some are issues with conflicts with recently merged com_fields, some, if not fixed would probably break all joomla on update.
Please fix all of these. Thanks
I still have the same problem I reported before
Sorry I still cannot get this to work. This is what I have done - maybe you can see the error
Install Joomla 3.7
Apply this PR using com_patchtester
Discover install the plugin and component
Database fix
This shows the component and plugin installed but I still dont get the Select events to be logged list
This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/11834.
Labels |
Added:
?
|
Is this still being worked on?
Status | Pending | ⇒ | Information Required |
If this PR get no Response, it will be closed at 22th June 2017.
Status | Information Required | ⇒ | Closed - No Reply |
Closed_Date | 0000-00-00 00:00:00 | ⇒ | 2017-06-22 06:39:34 |
Closed_By | ⇒ | franz-wohlkoenig |
Set to "closed" on behalf of @franz-wohlkoenig by The JTracker Application at issues.joomla.org/joomla-cms/11834
closed as stated above.
After quick look at this, I can say that #__user_logs table could be expanded with additional 'id' field that would store id of content/element that fired event (i.e article changed - save article id, created new article save article id, and so on). ATM 'message' field would be hard to parse (as I saw that you can export it to csv...). Or 'message' field would be filled with html strings that links to a content/element/position/user. i.e
User logged in at date/time.