Conflicting Files ? Pending

User tests: Successful: Unsuccessful:

avatar sakiss
sakiss
5 Feb 2020

Summary of Changes

It triggers events after performing the basic finder indexer's actions.
The Indexer performs 3 tasks (index, delete, purge), though no any event triggered after the Finder Indexer has finished them.

Performing further actions can be very useful in cases like:
Caching, Meta-data generation, Filters generation, Logging.

Testing Instructions

Lets add some logic to be executed on each event.
It will be nothing more than the generation of a log record, for each action.

Open the file: plugins/finder/content/content.php

Within the class add/append the following code:

      	/**
	 * Triggered after saving an item or after running the indexer.
	 *
	 * @param   Result  $item
	 * @param   Int     $linkid
	 *
	 */
	public function onFinderIndexAfterIndex(Result $item, $linkId)
	{
		\Joomla\CMS\Log\Log::addLogger(array('text_file' => 'finder.log.php'), \Joomla\CMS\Log\Log::ALL, array('finder_plugin'));
		\Joomla\CMS\Log\Log::add('onFinderIndexAfterIndex Run after:' . $linkId, \Joomla\CMS\Log\Log::INFO, 'finder_plugin');
	}

	/**
	 * Triggered after deleting an item or pressing 'Delete' in com_finder.
	 * @param int $linkId
	 *
	 */
	public function onFinderIndexAfterDelete($linkId)
	{
		\Joomla\CMS\Log\Log::addLogger(array('text_file' => 'finder.log.php'), \Joomla\CMS\Log\Log::ALL, array('finder_plugin'));
		\Joomla\CMS\Log\Log::add('onFinderIndexAfterDelete Run after:' . $linkId, \Joomla\CMS\Log\Log::INFO, 'finder_plugin');
	}

	/**
	 * Triggered after purging (press 'Clear Index') in com_finder.
	 */
	public function onFinderIndexAfterPurge()
	{
		\Joomla\CMS\Log\Log::addLogger(array('text_file' => 'finder.log.php'), \Joomla\CMS\Log\Log::ALL, array('finder_plugin'));
		\Joomla\CMS\Log\Log::add('onFinderIndexAfterPurge Run after', \Joomla\CMS\Log\Log::INFO, 'finder_plugin');
	}

Expected result

After appending the above code, log events will be created for each Indexer's actions.
You can check the log records in the file: administrator/logs/finder.log.php

  1. Saving an existing article in com_content, 2 log records should be created:
    a. One with the message: onFinderIndexAfterDelete Run after
    b. One with the message: onFinderIndexAfterIndex Run after

  2. Pressing the "Clear Index" in the com_finder, 1 log record should be created with the message: onFinderIndexAfterPurge

  3. Deleting an item in com_finder, 1 log record should be created, with the message: onFinderIndexAfterDelete Run after

  4. Pressing the "Index" in the com_finder, multiple log records (as many as the indexed items) should be created with the message: onFinderIndexAfterIndex Run after

*As it is clear all the above is just for testing purpose.

Documentation Changes Required

Not sure

70d06e4 10 Jan 2020 avatar brianteeman [4.0]
e0be0a2 30 Jan 2020 avatar SharkyKZ CS
avatar sakiss sakiss - open - 5 Feb 2020
avatar sakiss sakiss - change - 5 Feb 2020
Status New Pending
avatar joomla-cms-bot joomla-cms-bot - change - 5 Feb 2020
Category Administration com_finder Front End Plugins
avatar sakiss sakiss - change - 5 Feb 2020
Labels Added: ?
avatar sakiss sakiss - change - 5 Feb 2020
The description was changed
avatar sakiss sakiss - edited - 5 Feb 2020
avatar sakiss sakiss - change - 6 Feb 2020
The description was changed
avatar sakiss sakiss - edited - 6 Feb 2020
avatar joomla-cms-bot joomla-cms-bot - change - 6 Feb 2020
Category Administration com_finder Front End Plugins Administration com_finder
avatar sakiss sakiss - change - 6 Feb 2020
The description was changed
avatar sakiss sakiss - edited - 6 Feb 2020
avatar sakiss sakiss - change - 6 Feb 2020
The description was changed
avatar sakiss sakiss - edited - 6 Feb 2020
avatar sakiss sakiss - change - 6 Feb 2020
The description was changed
avatar sakiss sakiss - edited - 6 Feb 2020
avatar sakiss sakiss - change - 7 Feb 2020
The description was changed
avatar sakiss sakiss - edited - 7 Feb 2020
avatar sakiss sakiss - change - 7 Feb 2020
The description was changed
avatar sakiss sakiss - edited - 7 Feb 2020
avatar sakiss sakiss - change - 7 Feb 2020
The description was changed
avatar sakiss sakiss - edited - 7 Feb 2020
avatar sakiss sakiss - change - 7 Feb 2020
The description was changed
avatar sakiss sakiss - edited - 7 Feb 2020
avatar sakiss sakiss - change - 7 Feb 2020
The description was changed
avatar sakiss sakiss - edited - 7 Feb 2020
avatar sakiss sakiss - change - 7 Feb 2020
The description was changed
avatar sakiss sakiss - edited - 7 Feb 2020
avatar sakiss sakiss - change - 7 Feb 2020
The description was changed
avatar sakiss sakiss - edited - 7 Feb 2020
avatar sakiss sakiss - change - 7 Feb 2020
The description was changed
avatar sakiss sakiss - edited - 7 Feb 2020
avatar sakiss sakiss - change - 10 Feb 2020
The description was changed
avatar sakiss sakiss - edited - 10 Feb 2020
avatar sakiss sakiss - change - 12 Feb 2020
The description was changed
avatar sakiss sakiss - edited - 12 Feb 2020
avatar sakiss sakiss - change - 12 Feb 2020
The description was changed
avatar sakiss sakiss - edited - 12 Feb 2020
avatar sakiss sakiss - change - 13 Feb 2020
The description was changed
avatar sakiss sakiss - edited - 13 Feb 2020
avatar sakiss sakiss - change - 13 Feb 2020
The description was changed
avatar sakiss sakiss - edited - 13 Feb 2020
avatar mateoAdi mateoAdi - test_item - 13 Feb 2020 - Tested successfully
avatar mateoAdi
mateoAdi - comment - 13 Feb 2020

I have tested this item successfully on c842c2a


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

avatar sakiss sakiss - change - 13 Feb 2020
Labels Added: Conflicting Files
avatar joomla-cms-bot joomla-cms-bot - change - 13 Feb 2020
Category Administration com_finder Repository Administration com_admin SQL Postgresql
avatar wilsonge
wilsonge - comment - 17 Feb 2020

This sounds sensible to me - but clearly somethings gone wrong with the rebasing here. Are you able to do this in a fresh PR please?

avatar sakiss
sakiss - comment - 17 Feb 2020

After the rebase issues, I made a new PR #27965

avatar sakiss sakiss - change - 17 Feb 2020
Status Pending Closed
Closed_Date 0000-00-00 00:00:00 2020-02-17 15:37:33
Closed_By sakiss
avatar sakiss sakiss - close - 17 Feb 2020
avatar sakiss sakiss - change - 17 Feb 2020
Title
[4.0] Trigger events after any Finder action (index, delete, purge)
[4.0] Trigger Finder events
avatar sakiss sakiss - edited - 17 Feb 2020

Add a Comment

Login with GitHub to post a comment