joomla-cms icon indicating copy to clipboard operation
joomla-cms copied to clipboard

[5.2][Events] Use event classes for Extension plugins

Open Fedik opened this issue 8 months ago • 2 comments

User description

Summary of Changes

Update extension and installer plugins to use SubscriberInterface event classes.

Testing Instructions

Test that extension installation works as before. Joomla update also works as before.

Actual result BEFORE applying this Pull Request

Works

Expected result AFTER applying this Pull Request

Works

Link to documentations

Please select:

  • [ ] Documentation link for docs.joomla.org:
  • [ ] No documentation changes for docs.joomla.org needed
  • [x] Pull Request link for manual.joomla.org: https://github.com/joomla/Manual/pull/177
  • [ ] No documentation changes for manual.joomla.org needed

PR Type

Enhancement


Description

  • Updated extension and installer plugins to use SubscriberInterface event classes.
  • Introduced AbstractJoomlaUpdateEvent class and its concrete implementations BeforeJoomlaUpdateEvent and AfterJoomlaUpdateEvent.
  • Modified Joomla update process to dispatch new event classes.
  • Implemented SubscriberInterface for various extension plugins and updated their methods to use event classes.

Changes walkthrough 📝

Relevant files
Enhancement
9 files
UpdateModel.php
Use event classes for Joomla update process                           

administrator/components/com_joomlaupdate/src/Model/UpdateModel.php

  • Added dispatching of BeforeJoomlaUpdateEvent and
    AfterJoomlaUpdateEvent instead of triggering events directly.
  • Included new event classes for Joomla update process.
  • +8/-3     
    CoreEventAware.php
    Map Joomla update events to core events                                   

    libraries/src/Event/CoreEventAware.php

  • Added onJoomlaBeforeUpdate and onJoomlaAfterUpdate to the core event
    mapping.
  • +2/-0     
    AbstractJoomlaUpdateEvent.php
    Introduce abstract class for Joomla update events               

    libraries/src/Event/Extension/AbstractJoomlaUpdateEvent.php

  • Introduced abstract class AbstractJoomlaUpdateEvent for Joomla update
    events.
  • +55/-0   
    AfterJoomlaUpdateEvent.php
    Add AfterJoomlaUpdateEvent class                                                 

    libraries/src/Event/Extension/AfterJoomlaUpdateEvent.php

  • Added AfterJoomlaUpdateEvent class extending
    AbstractJoomlaUpdateEvent.
  • +58/-0   
    BeforeJoomlaUpdateEvent.php
    Add BeforeJoomlaUpdateEvent class                                               

    libraries/src/Event/Extension/BeforeJoomlaUpdateEvent.php

  • Added BeforeJoomlaUpdateEvent class extending
    AbstractJoomlaUpdateEvent.
  • +23/-0   
    Finder.php
    Implement SubscriberInterface for Finder plugin                   

    plugins/extension/finder/src/Extension/Finder.php

  • Implemented SubscriberInterface for the Finder extension plugin.
  • Updated methods to use event classes.
  • +35/-13 
    Joomla.php
    Implement SubscriberInterface for Joomla plugin                   

    plugins/extension/joomla/src/Extension/Joomla.php

  • Implemented SubscriberInterface for the Joomla extension plugin.
  • Updated methods to use event classes.
  • +36/-13 
    NamespaceMap.php
    Implement SubscriberInterface for NamespaceMap plugin       

    plugins/extension/namespacemap/src/Extension/NamespaceMap.php

  • Implemented SubscriberInterface for the NamespaceMap extension plugin.
  • Updated methods to use event classes.
  • +30/-15 
    Override.php
    Implement SubscriberInterface for Override plugin               

    plugins/installer/override/src/Extension/Override.php

  • Implemented SubscriberInterface for the Override extension plugin.
  • Added event subscription methods.
  • +21/-1   

    💡 PR-Agent usage: Comment /help on the PR to get a list of all available PR-Agent tools and their descriptions

    Fedik avatar Jun 04 '24 14:06 Fedik