Commit graph

14 commits

Author SHA1 Message Date
Umherirrender
c8ec25a961 maintenance: Add missing documentation to class properties
Add doc-typehints to class properties found by the PropertyDocumentation
sniff to improve the documentation.

Once the sniff is enabled it avoids that new code is missing type
declarations. This is focused on documentation and does not change code.

Change-Id: I7dec01892a987a87b1b79374a1c28f97d055e8fa
2024-09-13 19:29:24 +02:00
Dreamy Jazz
e7393b3cc7 Exclude boilerplate maintenance code from code coverage reports
Why:
* Maintenance scripts in core have bolierplate code that is
  added before and after the class to allow directly running
  the maintenance script.
* Running the maintenance script directly has been deprecated
  since 1.40, so this boilerplate code is only to support a now
  deprecated method of running maintenance scripts.
* This code cannot also be marked as covered, due to PHPUnit
  not recognising code coverage for files.
* Therefore, it is best to ignore this boilerplate code in code
  coverage reports as it cannot be marked as covered and also
  is for deprecated code.

What:
* Wrap the boilerplate code (requiring Maintenance.php and then
  later defining the maintenance script class and running if the
  maintenance script was called directly) with @codeCoverageIgnore
  comments.
* Some files use a different boilerplate code, however, these
  should also be marked as ignored for coverage for the same
  reason that coverage is not properly reported for files.

Bug: T371167
Change-Id: I32f5c6362dfb354149a48ce9c28da9a7fc494f7c
2024-08-27 13:22:29 +01:00
DannyS712
8b66151b73 Update references to config-vars.php
Moved to docs/ rather than includes/, update references and remove
from phan exclusion list

Follow-up: I32c034d05bf2354cdaa5f02d19031421cbae78a1
Change-Id: I8d71c29c8cbfa413db47066f00d71783259f0916
2023-09-23 03:37:44 +00:00
Timo Tijhof
11c97c04f3 generateConfigSchema.php: Enable canExecuteWithoutLocalSettings()
Similar to generateAutoload.php, this should work even without
an active MW install.

Fix the casing and signature to match the base class while at it.

Change-Id: I1b0928f7bbb2c151c8350b4bbe503dd2a07da34e
2023-07-24 20:25:52 +01:00
Sam Wilson
4aea56c691 Update @since for MainConfigNames to 1.39
The MediaWiki\MainConfigNames class was added
in I817dc14c4ce8fc0a29d9c07e8fd393c4f359cade
which is not in 1.38 but only in 1.39 and later.

Change-Id: Ic25e64d109defc970c90e038a7de03d4ca8ed82c
2023-06-22 06:34:52 +08:00
jenkins-bot
08e36b9c23 Merge "Remove MainConfigNames.template." 2023-03-02 14:03:01 +00:00
daniel
a909bdfb7c Remove MainConfigNames.template.
generateConfigSchema.php was already generating all other files
directly, MainConfigNames.php was the only one based on the template.
Given the template was trivial and unlikely to change, this change
removes the template and changes the script to generate
MainConfigNames.php directly as well, in the name of consistency and
simplicity.

Change-Id: I7e7f2bfbc232d2ee6582638ced74b3e929be21ed
2023-03-02 14:05:36 +01:00
daniel
0089787c37 Move config-vars.php to docs, since it's documentation.
config-vars.php is not supposed to be executed, it provides declaration
stubs for use by IDEs.

Change-Id: I32c034d05bf2354cdaa5f02d19031421cbae78a1
2023-03-02 13:51:09 +01:00
daniel
bb10b7d528 Settings: add support for obsolete config
This allows config variables to be declared obsolete. Obsolete config
will be omitted from the schema, defaults, name constants, etc. The
purpose of keeping a declaration of obsolete config around is to allow
the updater to warn admins that they are using a config variable that no
longer has any effect, and provide them with a remedy.

The idea is that support for deprecated config can be removed after one
release per the stable interface policy, but the declaration of
obsolete config should be kept for as long as we support updates,
that is, at least two LTS releases.

See https://www.mediawiki.org/wiki/Topic:X4bh4nf3pe2ho5jj for
discussion.

Change-Id: Ia7a00742ea7a5311e820a6a43b11135a3f2a825f
2022-10-14 15:00:43 +02:00
Aryeh Gregor
b72b9a8c43 Move dynamic defaults into MainConfigSchema
The goal is to keep the actual default values for settings in the same
place as the setting is declared, and applied using the regular means
for loading the settings -- not in a separate piece of code that needs
to be loaded through some entirely different mechanism.

SetupDynamicConfig.php now contains a few categories of things:

* Post-processing of configuration settings, where already-set settings
  are altered. This could be moved to MainConfigSchema too as a separate
  set of methods.
* Processing of old aliases of settings (blacklist, slave) that are not
  registered as settings anymore and therefore are not available to
  MainConfigSchema. This could perhaps be moved to LocalSettings
  processing somehow?
* Setting $wgUseEnotif, which is also not registered as a setting.
  Easiest would be just to declare it as a setting and have it set
  unconditionally.
* Setting the actual timezone to $wgLocaltimezone. This is not related
  to configuration and should just be in Setup.php.

Bug: T305093
Change-Id: Ia5c23b52dbbfcb3d07ffcf5d3b7f2d7befba2a26
2022-07-07 09:55:48 +10:00
daniel
f2df03704e Add support for nested property schemas in MainConfigSchema.
This adds support for JSONSchema style property declarations with nested
schemas. This is a step towards using more nested structured for
configuration, rather than adding to the over 700 keys already defined
in the main config schema.

Defaults from property schemas are aggregated into a default value in
the top level schema. Descriptions are however not yet aggregated.

Change-Id: Iaf46a9ecc83bee3566098c56137a1be66bff2ab9
2022-06-29 16:34:43 +10:00
daniel
ad11b034ab Settings: Generate schema artefacts using a single maintenance script
Previously, each of the four derived config schema files had to be
regenerated using a separate maintenance script. This change simplifies
regeneration by combining all for scripts into a single command that can
be used to regenerate all relevant files after changing
MainConfigSchema.

Change-Id: I7d38d8a4aede60475c4bdd0053d2e10e298b9843
2022-06-05 19:17:29 +00:00
daniel
2fe23d6860 Use class constants to define config schema, rather than config-schema.yaml
Instead of maintaining the config schema as a yaml file, we
maintain it as a set of constants in a class. From the information in
these constants, we can generate a JSON schema (yaml) file, and an
php file containing optimized arrays for fast loading.

Advantages:
- PHP doc available to IDEs. The generated markdown file is no longer
  needed.
- Can use PHP constants when defining default values.

NOTE: needs backport to 1.38

Change-Id: I663c08b8a200644cbe7e5f65c20f1592a4f3974d
2022-03-17 21:20:03 +01:00
Petr Pchelko
d54e3d216c Add pre-generator for config-schema.php
Bug: T300129
Change-Id: Ib2620993114af5a659bda60dc45b6fb3bed657b0
2022-02-03 13:27:47 +00:00