This is the development version for the new mwstake.org/wiki.

Project "Boterhal Extensions Best Practices Index (Boterhal Index)"

From mwstakeorgdev
Project "Extension Templates"
Jump to navigation Jump to search
​Identify well maintained and relevant extensions that implement functionality in an optimal way.
In this context
Well maintained
​recommended for latest LTS
relevant
{{Used by }}
optimal
​TDM, code quality: standards, unti, JS, integration tests, visual regression tests, Linting PHP stan, enforced by CI, release cycle following semantic versioning

What is the service provided to the community?

A developer should be able to install Extension:BoilerPlate and have exemplary extension functionalities working "out of the box". This shall:

  • simplify understanding how the functionalities are implemented, configured and used ("the truth is in the code") and
  • implicitly insinuate best practices.

Functionalities that can be implemented in MediaWiki extensions

This is partly based on the official types of extensions.

Functionality How to debug
Functionality "MediaWiki Action API"

Pending

Functionality "MediaWiki Job Queue"
  • tail -f debug.log | grep "### MediaWiki "
  • wfDebug("### MediaWiki Job Queue ### your message");
Functionality "MediaWiki MCR"

Pending

  1. Front end (HTML, Javascript C1703127635 Issue, CSS, other) Manual:OutputPage.php
  2. Magic word {{BoilerPlateMagicWord}}
  3. Tag <BoilerPlateTag>
  4. Parser function {{BoilerPlateParserFunction|...}})
  5. Hooks
  6. Special page
  7. Page content model
  8. PHP unit tests
  9. PHP integration tests
  10. Cypress unit tests C2001997125
  11. Cypress e2e/integration tests
  12. Extension-specific logging
  13. Database tables
  14. Forms
  15. Permissions
  16. Rest
  17. Action
  18. Subpages
    • List MyPage's sub pages: {{Special:PrefixIndex/MyPage/}}


Install Extension:BoilerPlate

Method: clone from Git Method: register in composer.local.json
  1. Git clone Extension:BoilerPlate into your extensions/ directory

Configure

# w/LocalSettings.php
wfLoadExtension( 'BoilerPlate' );
$wgBoilerPlateExampleGlobalVariable = "my BoilerPlate example global variable";
$wgDebugLogGroups['boilerPlate'] = "/var/log/boilerPlate.log";
php maintenance/update.php

Explore BoilerPlate functionality on your wiki in the browser, the console, the CLI and the code

https://your.wiki/wiki/Special:BoilerPlate

https://your.wiki/wiki/BoilerPlate

{{BoilerPlateMagicWord}}
<BoilerPlateTag>
{{BoilerPlateParserFunction|BPPFPositionalArgument|BPPFNamedArgument=BPPFNA}}

extensions/BoilerPlate/src/BoilerPlateHooks.php

extensions/BoilerPlate/extension.json

>
{
  "AutoloadNamespaces": {
    "MediaWiki\\Extension\\BoilerPlate\\": "src/"
  },
  "SpecialPages": {
    "BoilerPlate": "SpecialBoilerPlate"
  },
  "AutoloadClasses": {
    "SpecialBoilerPlate": "includes/specials/SpecialBoilerPlate.php"
  },
  "HookHandlers": {
    "chooseSomeName": {
      "class": "MediaWiki\\Extension\\BoilerPlate\\Hooks"
    }
  },
  "Hooks": {
    "BeforePageDisplay": "chooseSomeName"
  },
  "ResourceModules": {
    "ext.boilerPlate": {
      "localBasePath": "resources/ext.boilerPlate",
      "remoteExtPath": "BoilerPlate/resources/ext.boilerPlate",
      "dependencies": [],
      "styles": ["boilerPlate.css"],
      "packageFiles": [
        "./boilerPlate.js"
      ],
      "messages": []
    }
  },
  "JobClasses": {
    "BoilerPlateJob": "MediaWiki\\Extension\\BoilerPlate\\BoilerPlateJob"
  },
}

extensions/BoilerPlate/tests/phpunit/unit/BoilerPlateHooksTest.php

php tests/phpunit/phpunit.php extensions/BoilerPlate/tests/phpunit/unit/BoilerPlateHooksTest.php Class 'Wikimedia\TestingAccessWrapper' not found Issue