? ? Pending

User tests: Successful: Unsuccessful:

avatar dgrammatiko
dgrammatiko
30 Apr 2020

Pull Request for Issues #28877 #28878

Summary of Changes

Refactor the Model to trigger the correct Events with the correct payload for files/folders created/updated/deleted

Testing Instructions

Download install and enable the following plugin
mediamanagertest.zip

Test steps:

  • Upload a file in the media manager
  • Delete the file you just uploaded
  • Edit the image you just uploaded, eg crop it
  • Create a folder
  • Delete the newly created folder

Check plugins/content/mediamanagertest for a file log.txt the contents should be like

File uploaded
-------------------------
Event Type: onContentBeforeSave
Event Payload: {"adapter":"local-0","name":"Screenshot 2020-04-29 at 19.22.58.png","path":"\/","new":true}
-------------------------

-------------------------
Event Type: onContentAfterSave
Event Payload: {"adapter":"local-0","name":"Screenshot 2020-04-29 at 19.22.58.png","path":"\/","new":true}
-------------------------

File updated
-------------------------
Event Type: onContentBeforeSave
Event Payload: {"adapter":"local-0","name":"screenshot 2020-04-29 at 19.22.58.png","path":"\/","new":false}
-------------------------

-------------------------
Event Type: onContentAfterSave
Event Payload: {"adapter":"local-0","name":"screenshot 2020-04-29 at 19.22.58.png","path":"\/","new":false}
-------------------------

File Deleted
-------------------------
Event Type: onContentBeforeDelete
Event Payload: {"data":{"adapter":"local-0","path":"\/screenshot.png"}}
-------------------------

-------------------------
Event Type: onContentAfterDelete
Event Payload: {"data":{"adapter":"local-0","path":"\/screenshot.png"}}
-------------------------

Folder Created
-------------------------
Event Type: onContentBeforeSave
Event Payload: {"adapter":"local-0","name":"test","path":"\/","new":true}
-------------------------

-------------------------
Event Type: onContentAfterSave
Event Payload: {"adapter":"local-0","name":"test","path":"\/","new":true}
-------------------------

Folder Deleted
-------------------------
Event Type: onContentBeforeDelete
Event Payload: {"data":{"adapter":"local-0","path":"\/test"}}
-------------------------

-------------------------
Event Type: onContentAfterDelete
Event Payload: {"data":{"adapter":"local-0","path":"\/test"}}
-------------------------

Expected result

Actual result

Documentation Changes Required

No, bug fix

Remarks:

  • Moving/copying files won't trigger any event. This is kinda awkward...

@laoneo @dneukirchen

avatar dgrammatiko dgrammatiko - open - 30 Apr 2020
avatar dgrammatiko dgrammatiko - change - 30 Apr 2020
Status New Pending
avatar joomla-cms-bot joomla-cms-bot - change - 30 Apr 2020
Category Administration com_media
avatar dgrammatiko dgrammatiko - change - 30 Apr 2020
The description was changed
avatar dgrammatiko dgrammatiko - edited - 30 Apr 2020
avatar dgrammatiko dgrammatiko - change - 30 Apr 2020
The description was changed
avatar dgrammatiko dgrammatiko - edited - 30 Apr 2020
avatar dgrammatiko dgrammatiko - change - 30 Apr 2020
The description was changed
avatar dgrammatiko dgrammatiko - edited - 30 Apr 2020
avatar dgrammatiko dgrammatiko - change - 30 Apr 2020
The description was changed
avatar dgrammatiko dgrammatiko - edited - 30 Apr 2020
avatar dgrammatiko dgrammatiko - change - 30 Apr 2020
The description was changed
avatar dgrammatiko dgrammatiko - edited - 30 Apr 2020
avatar SharkyKZ
SharkyKZ - comment - 30 Apr 2020

Now Media Action - Resize plugin doesn't work.

avatar dgrammatiko dgrammatiko - change - 30 Apr 2020
Labels Added: ?
avatar dgrammatiko
dgrammatiko - comment - 30 Apr 2020

Good catch, I guess 45165a5 should fix that

avatar infograf768
infograf768 - comment - 30 Apr 2020

Is that also spposed to solve #28842

avatar dgrammatiko
dgrammatiko - comment - 30 Apr 2020

@infograf768 partly.

Also, internal server error when saving name of file or folder.

This should be ok now. Reason was that one of the current events had a wrong signature (expected to be called with 4 params but was called with 3)

avatar infograf768
infograf768 - comment - 1 May 2020

Ref: #28886 (comment) & #28842 (comment)
I still get the Internal Server Error when saving the file with the same name. It's OK when modifying the name of the file.

avatar dgrammatiko
dgrammatiko - comment - 1 May 2020

I still get the Internal Server Error when saving the file with the same name

Sorry I misunderstood, I was talking about renaming to something different.

avatar infograf768
infograf768 - comment - 1 May 2020

Still wrong.
change_image

avatar adj9 adj9 - test_item - 2 May 2020 - Not tested
avatar adj9
adj9 - comment - 2 May 2020

I have not tested this item.

@dgrammatiko I installed the plugin and function. Subsequently I looked for the log.txt file that you describe, but I did not find it .... I only have the indication of User Action Log. Where is the file?


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

avatar dgrammatiko
dgrammatiko - comment - 2 May 2020

I looked for the log.txt

it is created in the plugin's folder: plugins/content/mediamanagertest

avatar adj9
adj9 - comment - 16 May 2020

Apply PR it all worked out. Going to Latest actions (from home dashboard) and clicking on the name of the uploaded image, I have error 0
image

avatar dgrammatiko
dgrammatiko - comment - 16 May 2020

@adj9 I think that's ok as the plugin is a dummy implementation to showcase that the events are triggered correctly, in other words it doesn't actually do what it was supposed to do

avatar alikon
alikon - comment - 16 May 2020

so it's only a problem related to the com_actionlogs ?

avatar dgrammatiko
dgrammatiko - comment - 16 May 2020

@alikon do components require special code to trigger anything for the com_actionlogs?
If so then someone needs to patch the media manager to support that but that's out of the scope of this PR

avatar alikon alikon - test_item - 23 May 2020 - Tested successfully
avatar alikon
alikon - comment - 23 May 2020

I have tested this item successfully on 5b27cf6


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

avatar Quy Quy - test_item - 24 May 2020 - Tested successfully
avatar Quy
Quy - comment - 24 May 2020

I have tested this item successfully on 5b27cf6


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

avatar Quy Quy - change - 24 May 2020
Status Pending Ready to Commit
avatar Quy
Quy - comment - 24 May 2020

RTC


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

avatar wilsonge wilsonge - change - 24 May 2020
Status Ready to Commit Fixed in Code Base
Closed_Date 0000-00-00 00:00:00 2020-05-24 23:45:47
Closed_By wilsonge
Labels Added: ?
avatar wilsonge
wilsonge - comment - 24 May 2020

Thanks!

Add a Comment

Login with GitHub to post a comment