Commit graph

1847 commits

Author SHA1 Message Date
James D. Forrester
26109fb098 logos: Set default install icon to be an SVG one
Change-Id: I5cd715a0c220667827cde99f0296280110c78631
2022-03-10 12:54:59 -05:00
jenkins-bot
4420102e99 Merge "Fix edge cases in schema validation." 2022-03-08 17:48:26 +00:00
jenkins-bot
277453fe78 Merge "Define MW_INSTALL_PATH constant and BaseDirectory config." 2022-03-08 17:44:09 +00:00
jenkins-bot
347275f940 Merge "Add configuration for write both on templatelinks table" 2022-03-08 16:15:57 +00:00
daniel
404f4a8512 Fix edge cases in schema validation.
Since PHP arrays make no clear distinction between lists (JSON arrays)
and maps (JSON objects), some edge case handling is needed to make
validation work reliably when we declare types for all arrays:

1) Allow array keys to be ignored, so an associative PHP array validates
as a JSON array. This is needed for the SessionProviders setting.

2) Allow associative arrays with numeric keys to validate as JSON
objects. This is done by ignoring the type validation when numeric keys
are detected. A warning is returned in the status object.

3) Work around validation failing on float values that are expected to
be integers. All numbers come from the yaml parser as floats, and the
"integer" type in JSON schema should accept floats with if the
fractional part is 0. But that doesn't seem to work, we need to cast the
values to integers explicitly.

Also, this fixes some mistakes in the schema: LockManagers is a list,
so it should use the JSON type "array". NamespacesToBeSearchedDefault
is a map (JSON object), even though it uses numeric keys. The Actions
registry is also a map.

Change-Id: I9d0453d740c377b7cce574df743536c39a0ec619
2022-03-08 13:59:19 +01:00
jenkins-bot
fbe222eb4c Merge "pageupdater.md: Update and fix references to code" 2022-03-07 19:28:24 +00:00
Matěj Suchánek
eb5c36c6cd pageupdater.md: Update and fix references to code
Change-Id: If6ddcce76368521c48cced6296b556ad74842369
2022-03-06 09:51:36 +01:00
Reedy
11cc2d6993 Consistently use @deprecated since rather @deprecated
Change-Id: I301786f35cd6eb9c63fb72e0b64cffa9efd7b86b
2022-03-06 02:55:54 +00:00
daniel
cf581bb2ca Define MW_INSTALL_PATH constant and BaseDirectory config.
Application logic should use the BaseDirectory config variable.
Framework code should use MW_INSTALL_PATH to locate files should.

NOTE: Update https://www.mediawiki.org/wiki/Manual:$IP

Bug: T300301
Depends-On: I7142af16d692f26e90673b058029f572c1ea3991
Change-Id: Ib4caa80bb7007c4c7960a2fd370cf5da7d9ba344
2022-03-04 14:18:27 +01:00
Amir Sarabadani
f7298b59b8 Add configuration for write both on templatelinks table
Bug: T299419
Change-Id: Ic288ba021eecbed438e9337e52a41c59a89b6a9b
2022-03-03 08:48:13 +01:00
Matthias Mullie
b0bd09c939 Remove change tags for media additions/removals
This reverts commit dab7b16741.

Reason for revert: This was inaccurate/incomplete &
looks like we will not need this after all

Bug: T286362
Change-Id: I6d63d69f180d193f99986ce6878617d63cfb2b6d
2022-02-28 11:08:09 +01:00
daniel
f9b589f556 config-schema: Define types for all arrays.
This patch ensures that we know which arrays are lists (JsonSchema type
"array") and which are maps (JsonSchema type "object"). We can then
default to array_merge for lists and to array_plus for maps. This seems
clearer than requiring an explicit merge strategy to be declared for all
arrays.

This patch specified a mergeTrategy for some config variables that need
behavior different from the default.

This patch also changes the merging behavior to allow non-array values
to replace arrays and vice versa. It also changes the behavior of
defaults to allow falsy values to override non-falsy defaults.

Bug: T300129
Change-Id: Ia7b0c0250af6a957eac1efb554fb47511f5e093f
2022-02-23 14:09:41 +01:00
mainframe98
de0c4819d1 Add validation for abstract schema
This adds an option to the schema generating maintenance scripts to
validate abstract schemas and schema changes and a structure test to
validate exisiting schemas and schema changes. Schemas are also
validated when generating.

The validation for the schema doesn't impose limits on table, index or
column names as I couldn't find any reliable conventions for them.

The structure tests only cover MediaWiki itself as there is no
convention on where extensions store their abstract schema.
Ideally, auto detection would be possible for sql/, but for now
extensions have to define their own (thankfully trivial) tests.

A couple of invalid definitions were fixed thanks to these tests.

I aimed to be thorough, but not all parts of the abstract schema
are completely clear, and Doctrine's documentation is not complete.
As a result, not everything has a description field.

Bug: T298320
Change-Id: I681d265317d4d1584869142ebb23d4098c06885f
2022-02-22 17:41:08 +00:00
daniel
0ebf7786b1 DeferredUpdates: Introduce $wgForceDeferredUpdatesPreSend
Enabling this setting will cause post-send deferred updates to be run
before a response is sent to the client, so the client can observe all
effects of their last request immediately.

This resolves a problem with some end-to-end tests that were failing
because the updates caused by one request had not landed in the database
by the time the subsequent request was made.

This patch re-enabled some e2e tests that were disabled because of this
problem. If $wgForceDeferredUpdatesPreSend works as intended, the tests
should again pass reliably.

Bug: T230211
Bug: T301100
Change-Id: I0e30fdb6acba85cec4bb1499f7063ba6bfb0ffb2
2022-02-15 19:49:14 +01:00
Tim Starling
e582572622 Improve ObjectCache integration tests
* Add BagOStuffTest subclasses for all core BagOStuff subclasses,
  replacing PHPUNIT_USE_BAGOSTUFF, as suggested in a todo comment.
* Add config $wgEnableRemoteBagOStuffTests which causes all tests
  enabled by $wgObjectCache to execute, which means that the memcached
  tests are executed by default.

I have verified all except RESTBagOStuff and WinCacheBagOStuff. The
memcached tests fail against memcached 1.5.x but pass against memcached
1.6.x.

Bug: T90875
Change-Id: Id74b5226669f8cb857f859fbc35bc58ab001e873
2022-02-11 10:20:33 +11:00
Petr Pchelko
583dcf4085 Make autogenerated config docs more portable
Follow-up to I3c426b9fc37b1cf7ce8423969b2d7589767ee6cc

Bug: T296647
Change-Id: Iace2dc8014559a5e80905e6d1d17ec9539bdd0a9
2022-02-09 14:43:06 -08:00
Petr Pchelko
ef73bfafd9 Add simple configuration doc generator
This is a first draft of the configuration doc renderer.
The resulting markdown certainly needs some love, but
we can work on improvements incrementally. This gives
us a baseline to reference on doc.wikimedia.org

Bug: T296647
Change-Id: I3c426b9fc37b1cf7ce8423969b2d7589767ee6cc
2022-02-09 07:09:32 -08:00
mbsantos
d825e0d457 Allow ParsoidModules extension schema to register services
In order to allow extensions to wire services in Parsoid's ExtensionModule
implementation, the ParsoidModules schema should have the needed properties.
But rather than try to exhaustively list the properties allowed in an
object factory specification, rewrite the schema to be more permissive
about allowing unknown properties while still disambiguating the object
factory case from the "Parsoid extension configuration array" case.
In particular, the latter will never have a `class` or `factory`
property.

Change-Id: Id630912fde0d35628188988860832821142ca6ca
2022-01-20 16:03:21 -05:00
Alexander Vorwerk
01b0e099a8 Hard deprecate the global function wfWikiID()
deprecated since 1.35 and unused

Bug: T298059
Change-Id: I14ba3e7c98215cd584d7f99df2b5b4a198e6eab8
2022-01-10 20:50:50 +01:00
Siddharth VP
8242e84f9d Fix typos in docs
Change-Id: I5ccf296e0bd9afd8a82b620002346496cef18f0e
2022-01-09 21:59:57 +05:30
Isabelle Hurbain-Palatin
f336375846 Fix the json schema and the extension processor for Parsoid extension modules
Trying to declare a Parsoid extension showed a couple of issues related
to the JSON specification (there was a possible confusion between both
object declarations) and in trying to declare an extension as a single
string. This patch fixes both these issues.

Change-Id: I8c2f901e9a7e51704f10c8d8754cc8738079fde6
2021-12-17 09:50:25 +01:00
jenkins-bot
aadc33bfc5 Merge "registration: Allow ObjectFactory spec in extension.json schema" 2021-12-05 09:37:23 +00:00
Ostrzyciel
f1266d1783 registration: Allow ObjectFactory spec in extension.json schema
Since 272e941b7f it has been possible for a while now to construct
ContentHandlers using ObjectFactory specifications. However, this
was neither reflected in the JSON Schema of extension.json, nor in
the documentation on mediawiki.org.

See example of this being used in the wild: Ieca72e60d39376.
That patch is currently stuck on extension.json schema validation
test. The ObjectFactory spec itself is fine and works as intended.

Bug: T243560
Change-Id: I5986e19f1780709cf7b3ed2f55d5f46a0a1deeb7
2021-12-05 09:17:38 +00:00
Kunal Mehta
d1c292fe1b registration: Let namespaces specify if they're includable
Extensions can now define namespaces as non-includable, corresponding to
$wgNonincludableNamespaces.

By default, namespaces are includable and need to explicitly be
specified as `"includable": false` to be added to
$wgNonincludableNamespaces.

Bug: T277210
Change-Id: I85dc7bf01e5af81673c745a21ac83168321d0fef
2021-08-19 22:09:47 -07:00
DannyS712
df6c612941 ExtensionProcessor: Remove loaderScripts from extension.json schemas
The `loaderScripts` feature of ResourceLoaderFileModule was removed
without replacement a while ago. Use of it would no longer work
correctly and should result in a test failure.

The `position` property was also removed, but made no functional change
to behaviour. Update its documentation to clarify that it is no longer
used (it is simply no longer needed).

Bug: T289108
Change-Id: If3dbbbe95d60803be8df3c9a4d5ee9e01c825ebb
2021-08-20 04:11:53 +00:00
Fomafix
356f1b72ef Use IEC prefixes instead of SI prefixes for byte sizes (docs+backend)
This change doesn't change any UI messages.

Bug: T54687
Change-Id: Ia62899a2a6fe8910618c35cd667291e397ddb055
2021-06-28 11:59:09 +01:00
DannyS712
47d70dbfba Post Revision-removal cleanup
Updates for the removal of the Revision class itself
and the various methods/hooks/variables removed in the
process, including:

- Update some documentation removing most references
to the Revision class and updating the MCR migration
notes to reflect the past tense for Revision methods.

- Change some capitalization from "Revision" to "revision"
to make it clear comments are about revisions in general,
not the Revision class in particular.

- Minor code tweaks including removing unused variables that
were around for the old hooks that were removed, and
removing the use of DeprecatablePropertyArray where no
longer needed for anything.

- Fix incorrect documentation for PageUpdater::getStatus(),
the status value changed a while ago to have revision-record
in addition to revision, and recently to only have the
revision-record, but ironically PageUpdater was never updated.

- Removed Parser::$mRevisionObject, used to be a Revision object
and was deprecated in 1.35, missed earlier because it was no
longer being set to Revision objects, always null.

- Add RevisionRecord typehints in DummyLinker to match those
in the corresponding Linker methods

This should be a no-op in terms of functionality.

Bug: T247143
Change-Id: I03bbb94fc29085855448780b1a5ad9063911ecc4
2021-06-24 00:32:39 +00:00
jenkins-bot
7837931be9 Merge "Add missing *Path properties to OOUIThemePaths" 2021-06-21 13:00:11 +00:00
Amir Sarabadani
d37ad656c2 Make postgres IRC channel point to libera.chat
They have migrated to libera.chat:
https://www.postgresql.org/community/irc/

Bug: T283273
Change-Id: I5f14e9079cdac628fa81e6d237f9a5906bf46b6f
2021-05-26 23:35:42 +02:00
MacFan4000
c351c4f06e Freenode -> Libera per wikimedia moving from freenode to libera
Bug: T283247
Change-Id: Iebbb13ac53830a8d77b42bf2954cf80d76d78467
2021-05-20 22:10:24 +00:00
James D. Forrester
f2f9345e39 Replace uses of DB_MASTER with DB_PRIMARY in documentation and local variables
This is just a start.

Bug: T254646
Change-Id: I9213aad4660e27afe7ff9e5d2e730cbf03911068
2021-05-14 12:40:34 -07:00
jenkins-bot
f1fe87e2b0 Merge "Add extension.json merge strategy "provide_default"" 2021-05-13 23:20:47 +00:00
jenkins-bot
32d1ce99a7 Merge "registration: Allow multi-line strings in "@" note keys" 2021-05-08 05:13:42 +00:00
Tim Starling
076b93fba0 Add extension.json merge strategy "provide_default"
Add a merge strategy which sets the whole value only if the global
has not previously been set. This can be used to allow LocalSettings.php
to remove elements from an array created by extension.json.

Bug: T142663
Change-Id: Id250f9c349ee4eafbc759452ca6ea2a918baeb11
2021-05-04 16:02:55 +10:00
DannyS712
7bd7d2a6c1 Remove hooks that use Revision objects
All hooks were previously hard deprecated
in 1.35. Affected hooks:
* ArticleRevisionUndeleted - use RevisionUndeleted
* ArticleRollbackComplete - use RollbackComplete
* DiffRevisionTools - use DiffTools
* DiffViewHeader - use DifferenceEngineViewHeader
* HistoryRevisionTools - use HistoryTools
* NewRevisionFromEditComplete - use RevisionFromEditComplete
* PageContentInsertComplete - use PageSaveComplete
* PageContentSaveComplete - use PageSaveComplete
* ParserFetchTemplate - use BeforeParserFetchTemplateRevisionRecord
* RevisionInsertComplete - use RevisionRecordInserted
* TitleMoveComplete - use PageMoveComplete
* TitleMoveCompleting - use PageMoveCompleting
* UndeleteShowRevision - no replacement

Includes a fix for setting the associated rev id
of page protections, which previously was only done
using $nullRevision which was a Revision object created
if any hooks needed it; those hooks were hard deprecated
and so for WMF prod the rev id was not being set.

Bug: T247143
Depends-On: Idfa345193ae99fb2f1c9a8f8d28d8d540a6e3d62
Change-Id: I519167f76a5a3c1f5410415b2721462a3dcc3ec8
2021-04-30 17:28:20 +00:00
Timo Tijhof
39e2abd886 registration: Allow multi-line strings in "@" note keys
Change-Id: Ifb1a0f04cc22b122ed99308c096d0ce4296e9097
2021-04-29 02:47:47 +01:00
lens0021
c648468f1d
Add missing *Path properties to OOUIThemePaths
\ResourceLoaderOOUIFileModule extends \ResourceLoaderFileModule, so it
handles "localBasePath", "remoteExtPath" and "remoteSkinPath" properties
in code and works well as expected in reality.

But ExtensionJsonValidationTest fails because of the lack of the schema.
This fixes the false-negative failure.

Change-Id: I9d07a9b9984d934811478fef9cc2fe24cbbd3bc7
2021-04-19 18:30:16 +09:00
Ammarpad
0e7bf93d48 Drop two unused Perl scripts
Probably nobody is using these.

Also hopefully after fully migrating to abstract schema, there'd
not be any more unnecessary drifts between MySQL and Postgres tables,
obsoleting the need for compare_schema.pl

For mysql2postgres.pl, dumpBackup.php/importDump.php can be used.

Bug: T258876
Change-Id: Ief36bca6f3a387f811408f2a5e4840656dfffff2
2021-03-27 11:47:48 +01:00
Ammarpad
ba17c42a79 registry: Allow specifying immovable namespaces in extension.json
In most cases this will alleviate the need to use the
ImmovableNamespaces hook.

Bug: T277520
Change-Id: If1e1063a597ebdb39343a356cc381a6ceafaebcc
2021-03-17 06:10:35 +00:00
James D. Forrester
bdddfb92ba Drop wgContLang, deprecated in 1.32
Bug: T245940
Depends-On: Ib7fe7318100c0aadc3aa759416bf787913a9b788
Change-Id: I75c3b6715abd5eaf3619337cab8b1844e9a8349a
2021-03-08 13:27:28 -06:00
Roan Kattouw
b267f7aa90 resourceloader: Allow modules to mark themselves as ES6-only
Modules that set "es6": true in their module definition will error when
a non-ES6 client tries to load them.

To detect ES6 support, this looks for native Promise support,
RegExp.prototype.flags, and non-BMP characters in variable names. All
browsers that lack full ES6 support fail at least one of those checks.

To flag modules as requiring ES6, this adds a ! to the end of their
version string. This takes up much less space than adding another
register() parameter (which would have to be at the end). It's hacky,
but we expect this feature to be relatively temporary, until we require
ES6 for running any JS at all (probably in about a year).

For distinguishing different types of errors thrown from
sortDependencies(), use e.name. We can't subclass Error properly because
that requires ES6.

Bug: T272104
Change-Id: I45670c910ff12eb422ae54c9fcf372e45c7b2bf1
2021-03-04 14:53:36 -05:00
Ammarpad
bed437e131 Fix 404 link for Maintenance class doxygen doc
Change-Id: I15c0b55d1d0269e0f26887055e648de266291abf
2021-01-31 11:11:34 +01:00
jenkins-bot
5ebb7dd4d0 Merge "Add db group documentation" 2020-12-09 23:41:21 +00:00
Nikki Nikkhoui
3067ec77c2 Add db group documentation
Add section to database.md outlining simple
usage of database groups and the 3 remaining
supported types.

Bug: T267077
Change-Id: I66cb2fb063f291afc94ff207ef8d9a035bfc6a86
2020-12-09 23:10:48 +00:00
C. Scott Ananian
8510f728b1 docs: Fix JSON for deprecation in Hooks doc
A quoted string here will fail validation in ExtensionJsonValidationTest.

Change-Id: I8d8bbb03f4238090cab13218d45123e885744c9b
2020-12-09 15:03:49 -05:00
DannyS712
6a03737104 Update for object-factory v.3
Bug: T267074
Change-Id: Iff9b46c9e78e87d32c8f75d26b284ce01bccb63d
2020-11-17 06:20:23 +00:00
Tim Starling
9834d4c214 Prevent service injection to LoadExtensionSchemaUpdates hook
* Add noServices option to HookContainer::run()
* Use the option for LoadExtensionSchemaUpdates
* Document service injection including the caveats we know about

Bug: T258851
Change-Id: Ie57f2a3aeeea883f392e3c83ff228d1de68c6ebf
2020-09-18 08:01:52 +10:00
Timo Tijhof
0c01d8cc52 resourceloader: Add skin-based 'mediawiki.skin.variables.less' import
Add the SkinLessImportPaths attribute for skin-specific LESS import
paths, which skins can use to override the mediawiki.skin.variables.less
file.

As a starting point, add the following 5 variables:

* device widths (3x)
  To help phase out 'mediawiki.ui/variables'. These are
  commonly used by MobileFrontend.

* @font-family-sans
  Recommended by Volker. Used by multiple skins.

* @border-radius-base
  Recommended by Volker as example of something that we currently
  hardcode in MediaWiki core for Vector and OOUI/WikimediaUI
  in 'mediawiki.widgets.datetime' but should instead be allowed
  to vary by skin and OOUI theme.

  Remove the hardcoded value for '@border-radius-base' in
  various places in favour of importing from mediawiki.skin.
  The default is a bare default of 0 (as border-radius is off
  by default in the browser).

  The value for Vector is restored there by I47da304667811.
  The value for MonoBook is improved by I000f319ab31b.

Bug: T112747
Change-Id: Icf86c930a3b5524254bb549624737d3b9dccb032
2020-09-15 10:05:53 +00:00
Timo Tijhof
10bdad0d35 Remove $wgMemc
Deprecated since 1.35, and no longer used in core, bundled, or
wmf-deployed projects.

Bug: T160813
Change-Id: Idd3166ef90d1795a0b22dc29d52de76048d0703e
2020-07-27 23:45:22 +00:00
Kunal Mehta
46d4504660 registration: Sync v2 and v1 schemas
Unless it's an intentional deviation, everything in v2 should also be in v1.

This copies over:
* e71e025aba: Add 'ParsoidModules' ...
* 7abd828ea3: Extension schema updates for HookContainer
* 34bff221ba: Introduce 'MessagePosterModule' extension attribute
* e97f2943f2: QUnitTestModule should support packageFiles and templates
** d50c7f5b56: Fix schemas for 'packageFiles'
** ee1f4f8ea3: Fix schemas for 'templates'
* 3f0056a252: REST API initial commit

Change-Id: I1ae6fed0261ad29ea5cb39b3511b8cde392ab612
2020-07-20 16:31:45 -07:00