Code Monkey home page Code Monkey logo

tracker's Introduction

Tracker

Description

A Symphony extension that tracks user and system activity.

Features

  • Tracks creations, updates, and deletes of Entries, Pages, Events, Data Sources, Utilities, and Sections.
  • Tracks frontend submissions via events.
  • Tracks when Preferences are changed.
  • Tracks when Extensions are enabled, disabled, or uninstalled.
  • Tracks login activity and password reset activity.
  • Provides a back-end interface for viewing and managing tracked activities.
  • Provides a data source for accessing Entry-related tracker activity from the front end.

Installation

  1. Place the tracker folder in your Symphony extensions directory.
  2. Go to System > Extensions, select "Tracker", choose "Enable" from the with-selected menu, then click Apply.

Usage

Managing/Viewing Activities

Activities can be viewed at System > Tracker Activity. It is possible from this page to delete individual activities or to clear all activity in the system.

The view can be filtered with GET params using the normal Symphony back-end filtering syntax:

?filter=column:values

column can be any of: item_type, item_id, action_type, or user_id. values can be a comma-delimited list of values to filter on. The following values are acceptable:

  • For item_type: a section id, pages, events, datasources, utilities, sections, authors, preferences, extensions, login, or password
  • For action_type: updated, created, deleted, enabled, disabled, uninstalled
  • For user_id: an author id, or 0 for unauthenticated/unknown users.

Example:

/symphony/extension/tracker/?filter=item_type:pages,events

These query strings can also be used to filter the entries in Tracker's Dashboard panel:

item_type:1,2

Excluding Activities

Tracker allows you to exclude certain types of activity from being tracked. Go to System > Preferences and, in the "Tracker" section, choose any system elements, sections, or users you'd like to exclude from tracking.

Using Activity Info on the Front End

The included data source, "Tracker Activity" can be attached to Pages and returns all Entry creation/update activity.

Customized Data Sources

Configuration options are available in the data source file, but rather than edit the included version, it's recommended to copy the code into a custom DS of your own:

  • Copy the data.tracker_activity.php file to your workspace/data-sources and rename it to data.your_datasource.php
  • Update the class name (line 6) to datasourceyour_datasource
  • Update the about() method (line 28) to reflect your data source's name and other info
  • Update the sorting and filtering options (lines 10-21) to suit your needs

To Do

  • Enable other extensions to log activities
  • Beef up the filtering; allow an all-sections wildcard

Known Issues

  • Doesn't track page template changes (there's no delegate for that)

tracker's People

Contributors

alexbirukov avatar animaux avatar brendo avatar cz avatar fhamon avatar jurajkapsz avatar moretaste avatar nickdunn avatar nils-werner avatar nilshoerrmann avatar nitriques avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

tracker's Issues

Warning: GenericErrorHandler 2: array_keys()

After deleting all logged entries in Tracker a warning in main log:

Warning: GenericErrorHandler 2: array_keys() expects parameter 1 to be array, null given on line 204 of file .../extensions/tracker/content/content.index.php

Line 204

Using Tracker v2.1.2

Error on install

I had Tracker installed before but some tables seem still to be present in the database. Now I get the following error:

MySQL Error (1050): Table 'sym_tracker_activity' already exists in query: CREATE TABLE `sym_tracker_activity` ( `id` int(11) unsigned NOT NULL auto_increment, `item_type` varchar(255), `item_id` varchar(75), `action_type` varchar(255), `user_id` int(11), `timestamp` timestamp, `fallback_username` varchar(255), `fallback_description` varchar(255), PRIMARY KEY (`id`) );

Error on logging in

I get the following error on the /symphony/login/ page whenever a user logs in. Login still works and going to /symphony/ afterwards works fine.

PHP Fatal error:  Call to undefined method Author::loadAuthorFromUsername() in …/extensions/tracker/extension.driver.php on line 595

Dashboard Tracker Panel Fails on Install

Or at least it seems to, I get this message when adding a tracker Dashboard Panel:

Fatal error: Call to undefined method contentExtensionDashboardPanel_Config::addStylesheetToHead() in /Applications/MAMP/htdocs/my-site/extensions/tracker/extension.driver.php on line 856

Unidentified users

I just found this in the Tracker logs:

An unidentified user (141.41.XXX.XXX) logged in to the back end.

How is it possible that someone who logged into the backend is unknown. I'd expect to read the user's name here.

Errors when no visible columns

I'm using Tracker in combo with the Static Section. As the section is static none of the fields have "Display field’s value in entries table" checked. This triggers an error in Tracker when you're trying to save. The code in question is around line 223 of class.tracker.php:

$data = $entry->getData($primary_field->get('id'));

Tracker::formatElementItem() crash

After extension was uninstalled and removed from extensions directory, Tracker will crash on Tracker Activity page.
It is because of this line (https://github.com/czheng/tracker/blob/master/lib/class.tracker.php#L479):

$about = Administration::instance()->ExtensionManager->about($activity['item_id']);

ExtensionManager will throw exception if it cannot find extension file. Wrapping that line with try..catch prevents crashing:

try {
    $about = Administration::instance()->ExtensionManager->about($activity['item_id']);
}
catch (Exception $e) {
    $about = NULL;
}

Access denied - CSRF

In Symphony 2.6, when having enabled enable_xsrf (is by default), clearing of Tracker's log throws an

Access Denied. Request was rejected for having an invalid cross-site request forgery token. Please go back and try again.

error.

Tracker version 1.2.1

Decouple language strings from database storage

It seems like Tracker stores language strings for actions and description in the database directly. This is causing trouble when translations change: the database storage is not updated. In my eyes, Tracker should store some kind of "action ids" in the database and convert them into readable strings when building the backend markup. So if something is updated it should not store updated but something like a generic status code like 1, 2 or something similar.

Deleting selected entries is not working

On Symphony 2.2.3 deleting selected entries is not working. The page get’s reloaded, but no entries are being deleted. However deleting all via the special button works.

Symphony Warning: A non-numeric value encountered

  • Symphony 2.7.0
  • PHP 7.0
  • Tracker 2.1.1

I get the following error when trying to access /symphony/extension/tracker/

An error occurred in …/extensions/tracker/content/content.index.php around line 157

	152 ;
	153 $per_page = Symphony::Configuration()->get('pagination_maximum_rows', 'symphony');
	154 $total_entries = Symphony::Database()->fetchVar('count', 0, $sql);
	155 $remaining_entries = max(0, $total_entries - ($start + $per_page));
	156 $total_pages = max(1, ceil($total_entries * (1 / $per_page)));
	157 $remaining_pages = max(0, $total-pages - $current_page);
	158
	159 if ($total_pages > 1) {
	160 $ul = new XMLElement('ul');
	161 $ul->setAttribute('class', 'page');

Backtrace

	[/…/extensions/tracker/content/content.index.php:157]
		GenericErrorHandler::handler();
	[/…/symphony/lib/toolkit/class.administrationpage.php:490]
		contentExtensionTrackerIndex->view();
	[/…/symphony/lib/core/class.administration.php:205]
		AdministrationPage->build();
	[/…/symphony/lib/core/class.administration.php:483]
		Administration->__buildPage();
	[/…/symphony/lib/boot/func.utilities.php:253]
		Administration->display();
	[/…/symphony/lib/boot/func.utilities.php:235]
		symphony_launcher();
	[/…/index.php:19]
		symphony();

Dashboard panel has error after install

Fatal error: Call to undefined method contentExtensionDashboardPanel_Config::addStylesheetToHead() in /Applications/MAMP/htdocs/new-site/extensions/tracker/extension.driver.php on line 856

Trying to delete an Authors throws error

Same behavior with Tracker 1.1.1, 1.2 and 1.2.1 on Symphony 2.3.6:

16. July 2014 14:04 > Warning: GenericErrorHandler 2: Invalid argument supplied for foreach() on line 466 of file /www/htdocs/…/2014/extensions/tracker/extension.driver.php
16. July 2014 14:04 > UNKNOWN: ErrorException 0 - Invalid argument supplied for foreach() on line 466 of /www/htdocs/…/2014/extensions/tracker/extension.driver.php

Section with 1 field whitout "Display in entries table"

I've created a section with only 1 field and whitout "Display in entries table".
When i create or save an entry i get the following error:

Fatal error: Call to a member function get() on a non-object in /PATH/extensions/tracker/lib/class.tracker.php on line 267

Tracker 1.1.1
Symphony 2.3.2 RC2

Error on delete

When I try to delete the Tracker list using the "clear all" button, I see the following Symphony Warning:

array_keys() [function.array-keys]: The first argument should be an array
/var/www/maschine/extensions/tracker/content/content.index.php line 195

190     }
191     
192     public function __actionIndex(){
193     
194         if(isset($_POST)) {
195             $checked = @array_keys($_POST['items']);
196                     
197             if(@array_key_exists('clear-all', $_POST['action'])) {
198                 $sql = 'TRUNCATE `tbl_tracker_activity`;';
199                 Symphony::Database()->query($sql);

Tested Tracking Ability, Four Things Untracked

I tested the extension thoroughly on Symphony 2.2.1 to see if everything worked properly. There were no PHP errors and most activity was tracked, but four important activities available on a fresh Symphony installation were not: event deletions, data source deletions, utility deletions, and page template updates. Below is the checklist I used while testing your extension (+ success, - failure):

Page        Create      +
            Update      +
            Delete      +
Section     Create      +
            Update      +
            Delete      +
Event       Create      +
            Update      +
            Delete      -
Data Source Create      +
            Update      +
            Delete      -
Utility     Create      +
            Update      +
            Delete      -
Template    Update      -
Author      Create      +
            Update      +
            Delete      +
Preferences Update      +
Extension   Enable      +
            Disable     +
            Uninstall   +

Error on saving dashboard panel

This error:

Fatal error: Call to undefined method contentExtensionDashboardPanel_Config::addStylesheetToHead() in [...]/extensions/tracker/extension.driver.php on line 949

Appears on saving the dashboard panel. Any ideas how to fix this? Thanks

call to AuthorManager() is missing argument

On line 845 of extension.driver.php there is:

$am = new AuthorManager();

It looks like it gives errors in logs. Maybe it should be:

$am = new AuthorManager(Symphony::Engine());

Unexpected T_STRING

On install I got an "unexpected T STRING" in the class.tracker.php file in "lib" folder line 185.
There was some uncommented text which needed // commenting.

Logged-in front-end users

When creating or updating entries from the front-end, Tracker creates records similar to this one:

A front-end user updated Ohne Titel in the Filme section.

This is just fine, as long as the front-end user is unknown but it's not very helpful when the front-end user is also logged into the backend. In this case I'd expect a different message like:

Nils Hörrmann updated Ohne Titel in the Filme section from the front-end.

Sections with date as primary field always displays now in Activity column

Sym 2.7.10
PHP 7.1

To be specific, this is a System Date Extension field that I've set as the first field in a section that is tracked.

In the Activity column it will show something like:

Jane Doe created 01/04/2021 12:30 in the Foo section.

The date and time in that line will always be the point in time that the Tracker Activity page was loaded in the browser, for any row tracking that section. Same if an existing entry was modified. Meanwhile, the Date and Time columns will accurately reflect when that entry was created or modified.

Probably a niche case, I guess.

Compatibility with Members Extension?

I know this complicates things, but would it be possible to have this work with the Members extension a little better? Right now by default when a front-end user edits something all you get is:

"A front-end user created {x} in the {y} section."

That's still helpful as an administrator, but it's not super helpful if you want to make a sort of "Site Activity" feed for a Members site.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.