Skip to content

Add new InstallerScriptTrait (PR #44381) #448

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

bembelimen
Copy link
Contributor

@bembelimen bembelimen commented Apr 25, 2025

User description

PR for new InstallerScriptTrait feature: joomla/joomla-cms#44381


PR Type

Documentation, Enhancement


Description

  • Document usage of new InstallerScriptTrait in script files.

  • Update example to demonstrate trait integration and properties.

  • Show how to override preflight and postflight with custom methods.

  • Add code comments for minimum version checks and dashboard menu module.


Changes walkthrough 📝

Relevant files
Documentation
install-process.md
Add InstallerScriptTrait usage and update install script example

docs/building-extensions/install-update/installation/install-process.md

  • Added documentation for using InstallerScriptTrait in script files.
  • Updated code example to include the trait and its properties.
  • Replaced standard preflight/postflight with custom methods for
    extensibility.
  • Provided comments on minimum PHP/Joomla version checks and dashboard
    menu module.
  • +40/-21 

    Need help?
  • Type /help how to ... in the comments thread for any questions about Qodo Merge usage.
  • Check out the documentation for more information.
  • Copy link
    Contributor

    PR Reviewer Guide 🔍

    Here are some key observations to aid the review process:

    ⏱️ Estimated effort to review: 2 🔵🔵⚪⚪⚪
    🧪 No relevant tests
    🔒 No security concerns identified
    ⚡ Recommended focus areas for review

    Syntax Error

    Missing closing quote in the minimumJoomla property declaration which would cause a PHP syntax error if copied directly.

    protected $minimumJoomla = '6.0.0;
    
    Method Naming

    The custom preflight and postflight methods are introduced but it's not clear how they relate to the standard preflight/postflight methods from the InstallerScriptInterface. Documentation should clarify how these custom methods are invoked.

    public function customPreflight(string $type, InstallerAdapter $parent): bool
    {
      // Your custom preflight code
    
      // Custom Dashboard Menu Module
      // $this->addDashboardMenuModule('example', 'example');
    
      return true;
    }
    
    public function customPostflight(string $type, InstallerAdapter $parent): bool
    {
      // Your custom postflight code
    
      return true;
    }

    Copy link
    Contributor

    qodo-merge-pro bot commented Apr 25, 2025

    PR Code Suggestions ✨

    Latest suggestions up to fd69391

    CategorySuggestion                                                                                                                                    Impact
    Possible issue
    Fix unrealistic version requirements

    The specified minimum PHP version (8.4) and Joomla version (6.0.0) are future
    versions that don't exist yet. This will cause installations to fail on all
    current systems. Use realistic minimum version requirements that match currently
    available versions.

    docs/building-extensions/install-update/installation/install-process.md [93-105]

     /**
      * Minimum PHP version required to install the extension
      *
      * @var    string
      */
    -protected $minimumPhp = '8.4';
    +protected $minimumPhp = '8.1';
     
     /**
      * Minimum Joomla! version required to install the extension
      *
      * @var    string
      */
    -protected $minimumJoomla = '6.0.0';
    +protected $minimumJoomla = '4.3.0';
    • Apply this suggestion
    Suggestion importance[1-10]: 9

    __

    Why: The suggestion correctly identifies that the specified PHP 8.4 and Joomla 6.0.0 are future versions that don't exist yet, which would cause all current installations to fail. Changing to realistic current versions (PHP 8.1 and Joomla 4.3.0) is a critical fix for the example code to be functional.

    High
    • Update

    Previous suggestions

    ✅ Suggestions up to commit 27cef1b
    CategorySuggestion                                                                                                                                    Impact
    Possible issue
    Fix syntax error
    Suggestion Impact:The commit fixed the syntax error by adding the missing closing quote to the $minimumJoomla property declaration, exactly as suggested

    code diff:

    -        protected $minimumJoomla = '6.0.0;
    +        protected $minimumJoomla = '6.0.0';

    Fix the missing closing quote in the $minimumJoomla property declaration. The
    string is not properly terminated.

    docs/building-extensions/install-update/installation/install-process.md [105]

    -protected $minimumJoomla = '6.0.0;
    +protected $minimumJoomla = '6.0.0';

    [Suggestion has been applied]

    Suggestion importance[1-10]: 10

    __

    Why: The suggestion correctly identifies a critical syntax error where the closing quote is missing in the $minimumJoomla property declaration. This would cause a PHP syntax error that would prevent the code from executing properly. Fixing this issue is essential for the code to function.

    High

    @HLeithner HLeithner added 6.0 PR for Joomla 6.0 Waiting for Joomla reference PR This pr is ready to merge and can be merged when the corresponding Joomla cms pr is merged. labels Apr 29, 2025
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
    Labels
    6.0 PR for Joomla 6.0 Review effort 2/5 Waiting for Joomla reference PR This pr is ready to merge and can be merged when the corresponding Joomla cms pr is merged.
    Projects
    None yet
    Development

    Successfully merging this pull request may close these issues.

    2 participants