Feature PR-5.0-dev Pending

User tests: Successful: Unsuccessful:

avatar Fedik
Fedik
25 Jul 2023

Summary of Changes

Implementing Event classes for Content events.
It does not change all plugins, maybe only 1-2 for test, rest can be done in addittional PRs.

Lists of events:

  • onContentPrepare
  • onContentAfterTitle
  • onContentBeforeDisplay
  • onContentAfterDisplay
  • onContentPrepareForm
  • onContentPrepareData
  • onContentNormaliseRequestData
  • onContentBeforeSave
  • onContentAfterSave
  • onContentBeforeDelete
  • onContentAfterDelete
  • onContentBeforeChangeState
  • onContentChangeState
  • onContentBeforeValidateData
  • onCategoryChangeState
  • onContentCleanCache

Testing Instructions

Apply patch.
Everything should work as before.

Actual result BEFORE applying this Pull Request

Works

Expected result AFTER applying this Pull Request

Works

Link to documentations

Please select:

avatar Fedik Fedik - open - 25 Jul 2023
avatar joomla-cms-bot joomla-cms-bot - change - 25 Jul 2023
Category Front End com_content Libraries Plugins
avatar Fedik Fedik - change - 25 Jul 2023
Status New Pending
36d8057 25 Jul 2023 avatar Fedik phpcs
avatar Fedik Fedik - change - 25 Jul 2023
Labels Added: PR-5.0-dev
avatar Fedik Fedik - change - 25 Jul 2023
The description was changed
avatar Fedik Fedik - edited - 25 Jul 2023
avatar Fedik Fedik - change - 25 Jul 2023
The description was changed
avatar Fedik Fedik - edited - 25 Jul 2023
avatar joomla-cms-bot joomla-cms-bot - change - 25 Jul 2023
Category Front End com_content Libraries Plugins Administration Front End com_content com_users Libraries Plugins
avatar Fedik Fedik - change - 25 Jul 2023
Labels Added: Feature
avatar Fedik Fedik - change - 25 Jul 2023
The description was changed
avatar Fedik Fedik - edited - 25 Jul 2023
avatar HLeithner
HLeithner - comment - 25 Jul 2023

thanks for your work, you are doing a great job

avatar Fedik Fedik - change - 26 Jul 2023
The description was changed
avatar Fedik Fedik - edited - 26 Jul 2023
avatar joomla-cms-bot joomla-cms-bot - change - 26 Jul 2023
Category Front End com_content Libraries Plugins Administration com_users Administration Front End com_content com_users Libraries
avatar Fedik Fedik - change - 26 Jul 2023
The description was changed
avatar Fedik Fedik - edited - 26 Jul 2023
avatar Fedik Fedik - change - 26 Jul 2023
The description was changed
avatar Fedik Fedik - edited - 26 Jul 2023
avatar Fedik
Fedik - comment - 27 Jul 2023

I have no idea why test fails on installation, cypress gives no info.
Localy it works.

avatar joomla-cms-bot joomla-cms-bot - change - 28 Jul 2023
Category Front End com_content Libraries Administration com_users Unit Tests Administration Front End com_content com_users Libraries
avatar joomla-cms-bot joomla-cms-bot - change - 28 Jul 2023
Category Front End com_content Libraries Administration com_users Unit Tests Administration Front End com_content com_users JavaScript Libraries
avatar Fedik Fedik - change - 28 Jul 2023
Labels Added: ?
avatar joomla-cms-bot joomla-cms-bot - change - 28 Jul 2023
Category Front End com_content Libraries Administration com_users JavaScript Administration Front End com_content com_users JavaScript Installation Libraries
avatar Fedik Fedik - change - 28 Jul 2023
Labels Removed: ?
avatar joomla-cms-bot joomla-cms-bot - change - 28 Jul 2023
Category Front End com_content Libraries Administration com_users JavaScript Installation Administration com_config Front End com_content com_users JavaScript Libraries
avatar joomla-cms-bot joomla-cms-bot - change - 28 Jul 2023
Category Front End com_content Libraries Administration com_users JavaScript com_config Administration Front End com_content com_users JavaScript Libraries
avatar joomla-cms-bot joomla-cms-bot - change - 28 Jul 2023
Category Front End com_content Libraries Administration com_users JavaScript Administration com_config Front End com_content com_users JavaScript Libraries
avatar joomla-cms-bot joomla-cms-bot - change - 28 Jul 2023
Category Front End com_content Libraries Administration com_users JavaScript com_config Administration Front End com_content com_users Libraries
avatar joomla-cms-bot joomla-cms-bot - change - 29 Jul 2023
Category Front End com_content Libraries Administration com_users Unit Tests Administration Front End com_content com_users JavaScript Libraries
avatar Fedik Fedik - change - 29 Jul 2023
Labels Added: ?
avatar joomla-cms-bot joomla-cms-bot - change - 29 Jul 2023
Category Front End com_content Libraries Administration com_users Unit Tests JavaScript Administration Front End com_content com_users JavaScript Libraries
avatar Fedik Fedik - change - 29 Jul 2023
Labels Removed: ?
avatar Fedik
Fedik - comment - 29 Jul 2023

Okay, the error comes from schemaorg plugins, this has to be fixed separately .

avatar joomla-cms-bot joomla-cms-bot - change - 29 Jul 2023
Category Front End com_content Libraries Administration com_users JavaScript Administration Front End com_content com_users Libraries
avatar Fedik Fedik - change - 30 Jul 2023
The description was changed
avatar Fedik Fedik - edited - 30 Jul 2023
avatar Fedik
Fedik - comment - 30 Jul 2023

I think it is ready for review and testing

avatar Fedik
Fedik - comment - 1 Aug 2023

I made a PR to 4.4-dev branch to cover $event->getArgument(0) #41298

avatar Fedik Fedik - change - 5 Aug 2023
The description was changed
avatar Fedik Fedik - edited - 5 Aug 2023
avatar Fedik Fedik - change - 5 Aug 2023
The description was changed
avatar Fedik Fedik - edited - 5 Aug 2023
avatar joomla-cms-bot joomla-cms-bot - change - 5 Aug 2023
Category Front End com_content Libraries Administration com_users Administration com_categories Front End com_content com_users Libraries
avatar Fedik Fedik - change - 5 Aug 2023
The description was changed
avatar Fedik Fedik - edited - 5 Aug 2023
avatar Fedik Fedik - change - 5 Aug 2023
Title
[5.0] Content event classes
[5.0][Events] Content event classes
avatar Fedik Fedik - edited - 5 Aug 2023
avatar bayareajenn bayareajenn - test_item - 11 Aug 2023 - Tested unsuccessfully
avatar bayareajenn
bayareajenn - comment - 11 Aug 2023

I have tested this item ? unsuccessfully on b317289

I tested this after a failed J4 to J5 test that Benjamin thought this PR might help with.

I tested in two server environments.

Server environment 1
I used Patchtester 4.2.2 in J5, applied the patch. Patchtester broke. Manage Extensions broke. Reverting the patch in the db did not resolve the issue.
Error: 0 Cannot set the argument result of the immutable event onContentPrepareForm.
Disabling com_patchtester in the db did not resolve Manage Extensions being broken with the same error as above.

Server environment 2
It wouldn't apply the patch to begin with. Error said:
You have not entered your GitHub API token in the Options. This will limit you to only 60 requests to the GitHub API per hour. Configuring authentication via an API token will allow 5,000 requests per hour.
Could not connect to GitHub: API rate limit exceeded for 72.249.30.219. (But here's the good news: Authenticated requests get a higher rate limit. Check out the documentation for more details.)

I added my GitHub API token and then applied the patch. In this environment, the entire backend is broken, not just Patchtester. Error says 0 Call to undefined method Joomla\Plugin\System\Schemaorg\Extension\Schemaorg::setUserFactory()

Eek!


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

avatar HLeithner
HLeithner - comment - 14 Aug 2023

@Fedik can you fix the cs please

avatar HLeithner
HLeithner - comment - 14 Aug 2023

image

with current 5.0 it works, with this pr there is a problem

avatar Fedik
Fedik - comment - 14 Aug 2023

That sounds like $form is missing in patchtester layout, hmhm

avatar Fedik
Fedik - comment - 14 Aug 2023

Any idea why this is hidden?

// Get the form.
return $this->loadForm($this->context . '.filter', $this->filterFormName, ['control' => '', 'load_data' => $loadData]);
} catch (\RuntimeException $e) {
}

The error is because the ListModel implements DispatcherAwareInterface, but no one actually set a dispatcher for this legacy component.

In PR it:

if ($this instanceof DispatcherAwareInterface) {
$dispatcher = $this->getDispatcher();
} else {
$dispatcher = Factory::getApplication()->getDispatcher();
}

avatar Fedik
Fedik - comment - 14 Aug 2023

I will update to:

try {
  $dispatcher = $this->getDispatcher();
} catch (\UnexpectedValueException $e) {
  $dispatcher = Factory::getApplication()->getDispatcher();
}

Need to check all places.

avatar Fedik
Fedik - comment - 14 Aug 2023

Should be good now

avatar Fedik
Fedik - comment - 14 Aug 2023

Do not merge it for now,
I will look to set a default Dispatcher in BaseDatabaseModel::__constructor

public function __construct($config = [], MVCFactoryInterface $factory = null)

avatar Fedik
Fedik - comment - 15 Aug 2023

After the #41371 PR will be merged, it should work fine

avatar HLeithner
HLeithner - comment - 16 Aug 2023

this PR should work now since the fix has been upmerged from 4.4 to 5.0 and merged into this pr

avatar Fedik Fedik - change - 17 Aug 2023
The description was changed
avatar Fedik Fedik - edited - 17 Aug 2023
avatar Fedik Fedik - change - 17 Aug 2023
The description was changed
avatar Fedik Fedik - edited - 17 Aug 2023
avatar Fedik
Fedik - comment - 17 Aug 2023

Okay, now it ready for test again.
Also, I have added a missed event onContentCleanCache

avatar joomla-cms-bot joomla-cms-bot - change - 21 Aug 2023
Category Front End com_content Libraries Administration com_users com_categories Front End com_content Libraries
avatar HLeithner HLeithner - change - 21 Aug 2023
Status Pending Fixed in Code Base
Closed_Date 0000-00-00 00:00:00 2023-08-21 07:46:26
Closed_By HLeithner
avatar HLeithner HLeithner - close - 21 Aug 2023
avatar HLeithner HLeithner - merge - 21 Aug 2023
avatar HLeithner
HLeithner - comment - 21 Aug 2023

thanks

avatar Fedik Fedik - change - 22 Aug 2023
The description was changed
avatar Fedik Fedik - edited - 22 Aug 2023

Add a Comment

Login with GitHub to post a comment