? ? Pending

User tests: Successful: Unsuccessful:

avatar laoneo
laoneo
26 Sep 2018

Summary of Changes

As extension dev, I like to do as less repetitive work as possible. This pr adds a base class extension devs can use to log actions more convenient. For example a plugin can then look like:

JLoader::import('com_actionlogs.libraries.actionlogplugin', JPATH_ADMINISTRATOR . '/components');

class PlgActionlogFoo extends ActionLogPlugin
{
	public function onContentAfterSave($context, $item, $isNew)
	{
		if ($context != 'com_foo.bar')
		{
			return;
		}

		$message = array(
			'action'   => $isNew ? 'add' : 'update',
			'type'     => 'PLG_ACTIONLOG_FOO_TYPE_BAR',
			'id'       => $item->id,
			'title'    => $item->title,
			'itemlink' => 'index.php?option=com_foo&task=edit&id=' . $item->id
		);

		$this->addLog(array($message), 'PLG_ACTIONLOG_FOO_' . $message['action'], $context);
	}
}

Additionally it simplifies the default Joomla log plugin.

Testing Instructions

Save an article.

Expected result

An action log is created.

Actual result

An action log is created.

Documentation Changes Required

Document that a base class exists.

avatar laoneo laoneo - open - 26 Sep 2018
avatar laoneo laoneo - change - 26 Sep 2018
Status New Pending
avatar joomla-cms-bot joomla-cms-bot - change - 26 Sep 2018
Category Administration Front End Plugins
avatar laoneo laoneo - change - 27 Sep 2018
Labels Added: ?
avatar laoneo
laoneo - comment - 27 Sep 2018

Done the changes.

avatar ciar4n
ciar4n - comment - 3 Oct 2018

I have tested this item successfully on d48be2f

Action log created after save


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/22389.

avatar ciar4n ciar4n - test_item - 3 Oct 2018 - Tested successfully
avatar infograf768
infograf768 - comment - 4 Oct 2018

I have tested this item successfully on d48be2f


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/22389.

avatar infograf768
infograf768 - comment - 4 Oct 2018

I have tested this item successfully on d48be2f


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/22389.

avatar infograf768 infograf768 - test_item - 4 Oct 2018 - Tested successfully
avatar infograf768 infograf768 - change - 4 Oct 2018
Status Pending Ready to Commit
avatar infograf768
infograf768 - comment - 4 Oct 2018

RTC.


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/22389.

avatar infograf768
infograf768 - comment - 4 Oct 2018

Note:
The plugin uses the list() method which can be confusing depending on the php version.

avatar mbabker mbabker - change - 6 Oct 2018
Status Ready to Commit Fixed in Code Base
Closed_Date 0000-00-00 00:00:00 2018-10-06 18:55:55
Closed_By mbabker
Labels Added: ?
avatar mbabker mbabker - close - 6 Oct 2018
avatar mbabker mbabker - merge - 6 Oct 2018

Add a Comment

Login with GitHub to post a comment