? ? ? Pending

User tests: Successful: Unsuccessful:

avatar alikon
alikon
21 Sep 2020

Pull Request for Issue #30499 .

Summary of Changes

Log the from version on Joomla update event on the Actionlogs

Testing Instructions

apply pr
joomlaupdate -> options
change to Custom URL
and put this manifest https://ci.joomla.org/artifacts/joomla/joomla-cms/staging/30714/downloads/35635/pr_list.xml
is the one available on bottom near Download — Prebuilt packages are available for download.

Actual result BEFORE applying this Pull Request

information about from version not available

Expected result AFTER applying this Pull Request

information about from version available
image

Documentation Changes Required

avatar alikon alikon - open - 21 Sep 2020
avatar alikon alikon - change - 21 Sep 2020
Status New Pending
avatar joomla-cms-bot joomla-cms-bot - change - 21 Sep 2020
Category Administration com_joomlaupdate Language & Strings Front End Plugins
07bc43e 21 Sep 2020 avatar alikon state
avatar alikon alikon - change - 21 Sep 2020
Labels Added: ? ?
avatar alikon alikon - change - 21 Sep 2020
Title
[wip] - show from to when update
[3.9] Log the from version on actionlogs when Joomla update
avatar alikon alikon - edited - 21 Sep 2020
avatar alikon alikon - change - 21 Sep 2020
The description was changed
avatar alikon alikon - edited - 21 Sep 2020
avatar richard67
richard67 - comment - 21 Sep 2020

@alikon It seems that it needs to apply the patch of this PR before doing the update to that package which you have linked.

avatar alikon
alikon - comment - 21 Sep 2020

Yes i forgot that, I'll add it

Il lun 21 set 2020, 16:05 Richard Fath notifications@github.com ha
scritto:

@alikon https://github.com/alikon It seems that it needs to apply the
patch of this PR before doing the update to that package which you have
linked.


You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
#30714 (comment),
or unsubscribe
https://github.com/notifications/unsubscribe-auth/AABMLMKAXH7KBVD463FQPOLSG5MR5ANCNFSM4RUKTPUA
.

avatar richard67 richard67 - test_item - 21 Sep 2020 - Tested successfully
avatar richard67
richard67 - comment - 21 Sep 2020

I have tested this item successfully on c3c8480


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

avatar alikon alikon - change - 21 Sep 2020
The description was changed
avatar alikon alikon - edited - 21 Sep 2020
avatar ChristineWk ChristineWk - test_item - 21 Sep 2020 - Tested successfully
avatar ChristineWk
ChristineWk - comment - 21 Sep 2020

I have tested this item successfully on c3c8480


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

avatar Quy Quy - change - 21 Sep 2020
Status Pending Ready to Commit
avatar Quy
Quy - comment - 21 Sep 2020

RTC


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

avatar SharkyKZ
SharkyKZ - comment - 21 Sep 2020

This could be a B/C break if onJoomlaAfterUpdate is triggered by 3rd party extension.

avatar HLeithner
HLeithner - comment - 21 Sep 2020

Why should onJoomlaAfterUpdate be triggered by a 3rd party extension? I mean we have no way to protect events but do you think a 3rd party extension triggers this?

Or do you mean the plugin should add a default value for the $oldVersion parameter?

avatar SharkyKZ
SharkyKZ - comment - 22 Sep 2020

Given that this event was recently added, is undocumented and has a very limited use case, I don't think anyone is actually using it. But if you want to be really careful, adding a default value would be a sensible thing to do.

avatar alikon
alikon - comment - 22 Sep 2020

did you mean someting like public function onJoomlaAfterUpdate($oldVersion = 'unknown') ?

avatar richard67
richard67 - comment - 22 Sep 2020

Maybe null or empty string as default, and in the code use a JTEXT for 'unknown' if the parameter is empty, so it can be translated?

On the other hand, that seems to be a bit over-engineered for something which should never happen.

So I'd be ok with anything, no default like now, or hard-coded like suggested above.

avatar HLeithner
HLeithner - comment - 22 Sep 2020

Yes please add ="unknown"

avatar alikon alikon - change - 23 Sep 2020
Labels Added: ?
avatar alikon
alikon - comment - 23 Sep 2020

added

avatar HLeithner
HLeithner - comment - 23 Sep 2020

Thanks, plz 2 tests and can be merged

avatar HLeithner
HLeithner - comment - 23 Sep 2020

plz also with a plugin that triggers the event without parameter.

avatar richard67
richard67 - comment - 23 Sep 2020

Wouldn't is be better to use an empty string as default value for $oldVersion and use JText::_('JLIB_UNKNOWN') if $oldVersion is empty?

avatar richard67
richard67 - comment - 23 Sep 2020

@HLeithner I don't have such plugin so I can't test.

avatar SharkyKZ
SharkyKZ - comment - 23 Sep 2020

Wouldn't is be better to use an empty string as default value for $oldVersion and use JText::_('JLIB_UNKNOWN') if $oldVersion is empty?

IMO should be null. But realistically it makes no difference. It's only used internally by this plugin.

avatar richard67
richard67 - comment - 23 Sep 2020

@HLeithner Shouldn't a code review be sufficient for the default value part of this PR? Does it really need to write a plugin to test this?

avatar HLeithner
HLeithner - comment - 23 Sep 2020

if you use null (without language) you will end in a broken text string "...updated Joomla from to 3.9.22"

Actually while testing you see this broken string, so I would suggest to catch this case better and change the code from

$oldVersion='unknown' to $oldVersion=null and test on if empty($oldVersion) and set the unkown version string...

@richard67 no you don't need to create a plugin you only have to trigger the event for example in a template:

JFactory::getApplication()->triggerEvent('onJoomlaAfterUpdate');

or

JFactory::getApplication()->triggerEvent('onJoomlaAfterUpdate', array(null));
JFactory::getApplication()->triggerEvent('onJoomlaAfterUpdate', array(''));
JFactory::getApplication()->triggerEvent('onJoomlaAfterUpdate', array('5.0.0));
avatar richard67
richard67 - comment - 23 Sep 2020

@HLeithner

no you don't need to create a plugin

Well, you wrote "plz also with a plugin that triggers the event without parameter." ?

avatar richard67
richard67 - comment - 23 Sep 2020

@alikon Could you change it to

	public function onJoomlaAfterUpdate($oldVersion = null)
	{
...		
		if (empty($oldVersion))
		{			
			$oldVersion = JText::_('JLIB_UNKNOWN');	
		}

?

avatar HLeithner
HLeithner - comment - 23 Sep 2020

Well, you wrote "plz also with a plugin that triggers the event without parameter." ?

wrong wording sorry

avatar richard67
richard67 - comment - 23 Sep 2020

wrong wording sorry

Now you say that? I almost have my plugin ready ? . (joking)

avatar richard67 richard67 - change - 23 Sep 2020
The description was changed
avatar richard67 richard67 - edited - 23 Sep 2020
avatar richard67
richard67 - comment - 23 Sep 2020

I've updated the custom update URL in the testing instructions to the one of the new build.

avatar richard67 richard67 - test_item - 23 Sep 2020 - Tested successfully
avatar richard67
richard67 - comment - 23 Sep 2020

I have tested this item successfully on ee6b10f

1. Real test as described:

Result: "User whoeveriamdoesnotmatter updated Joomla from 3.9.22-dev to 3.9.22-dev+pr.30714"

  1. Following in index.php of the isis template:
$app->triggerEvent('onJoomlaAfterUpdate');
$app->triggerEvent('onJoomlaAfterUpdate', array(null));
$app->triggerEvent('onJoomlaAfterUpdate', array(''));
$app->triggerEvent('onJoomlaAfterUpdate', array('5.0.0'));

Result: 3 times "User whoeveriamdoesnotmatter updated Joomla from Unknown to 3.9.22-dev+pr.30714", one time "User whoeveriamdoesnotmatter updated Joomla from 5.0.0 to 3.9.22-dev+pr.30714"


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

avatar rdeutz rdeutz - change - 26 Sep 2020
Status Ready to Commit Fixed in Code Base
Closed_Date 0000-00-00 00:00:00 2020-09-26 14:46:18
Closed_By rdeutz
avatar rdeutz rdeutz - close - 26 Sep 2020
avatar rdeutz rdeutz - merge - 26 Sep 2020

Add a Comment

Login with GitHub to post a comment