As far as I can tell, outside of test cases, every single time we call
OutputPage::enableClientCache() we pass it `false` and actually mean to
*disable* the client cache. Create a new less-confusingly-named method
and deprecate the old one.
Change-Id: I7c89e20528a0d91173f0edcb997dcae631935ee5
The purpose of all these changes is not only to make the code
shorter, but to make it more readable.
Notable:
* Fix wrong type hints.
* The `foreach ( $roles )` loop was processing everything twice.
* Inline preg_replace_callback() callbacks.
Change-Id: I2b8146946ab6966cc6f047556a0a898624af181a
In order to allow configuration default to come from JsonSchema,
and dynamic defaults need to be initialized in Setup.php.
This movesd the initialialization of $wgExtensionDirectory and $wgStyleDirectory
to Setup.php
Bug: T294788
Change-Id: I11f5723aa299caa210cf6a1f5b7436f191b1ffc2
These will be used immediately in Minerva but expands icons to
the sidebar for other skins
Bug: T291568
Change-Id: Ia54d01eb5d8d9c33d067f61c73203f9fec4569a6
Loops ServiceOptions through to CoreParserFunctions and CoreTagHooks to
avoid access to the main config from static methods.
Bug: T294739
Change-Id: Ia6c97f2d0952964c2ad6189f8053ad127589b37c
Values loaded from the default wouldn't be inverted, there is no need to copy the conditions to here, we can just simply bypass them.
Fortunately, nothing can be affected in a normal use case, since all value of fields would be set to server.
Thanks to the newly added tests, which helped me to realize this problem.
Change-Id: I5589ba7383587afdd9307c79e88849dacee02706
getLazyLoadedAttribute() accounts for about 3% of load.php CPU usage in
production, mostly because each ResourceLoaderFileModule calls it for
SkinLessImportPaths, and makeCacheKey() is quite slow.
So, cache lazy attributes in a process cache. There was already
$this->lazyAttributes, which was unused since the original commit. I
assume it was meant to be used for this, so I used it.
I also added a process cache for makeCacheKey() which is invalidated
when the queue changes, so that requests for different lazy attributes
in the same request will be fast.
Change-Id: I83d22b58bb9bf5d06d934d5d2eef8ae7d5f72857
Fields can have some filter to process the data, for example, HTMLCheckField would return true rather than raw string '1', we should also test this.
Note that the param indicating 'checked' state is matching the state on client-side, the value would be inverted by HTMLCheckField...
Change-Id: Ia9a7a8c46b0a55ecf2d5378a0d0b6cc00cdb54eb
Without the default the preference is never deleted from the database,
even it was disabled by the user.
This can be tested by check "all" on Special:Search and save it for
future searches. After checking "none" and selecting the main namespace
and save it for future searches there still the other searchNS options
on the database.
Bug: T291748
Change-Id: Idb3a8774b82f5f27fbeda4537dfdacf59768e8c0
getPageCount() method return `cat_pages`, a value that makes sense
on database table but is currently non-intuitve in object context
where there's a value that better deserves the name. This makes it
necessary for callers to repeat same logic to get the content pages
count and a comment to explain the behavior.
In this patch, getMemberCount() is added. It returns the total
member count as getPageCount(), by default, does now.
getPageCount() now takes a parameter and two public constants are
provided for that; Category::COUNT_CONTENT_PAGES return count of all
memebers to retain existing behavior, Category::COUNT_CONTENT_PAGES
will return only content pages.
In future there'd be no need for the parameter. Content pages will
be returned always. Total member count is already accessible with
getMemberCount().
Also improve return type doc of getId() and getName()
Bug: T299350
Change-Id: I63c711ebc697c1a131a50910c854f956d4021254
* In PagePropsTable, compare values after converting to string. In the
old code this was implicitly done by array_diff_assoc().
* Also convert to string before inserting, since
ParserOutput::setPageProperty() is documented as allowing null, but
the field is not nullable, so the query failed.
* Add a regression test which confirms that no write queries are done on
the second invocation of LinksUpdate.
Bug: T299662
Change-Id: I3f7d5800bf27a47cb57be80bdba13792fe3caae6
Follow-up changes will use cond-state params in other functions, split this out to make sure it's validated.
Change-Id: Icf358794b11a8f986fbd02c8f1b15ea9d1ef4d15
Allow cookie config to be supplied to FauxResponse explicitly,
so it can be used in unit tests without initializing MediaWiki.
Bug: T294739
Change-Id: I107d33c77ac7d9d81b33c59b872eee006956d863
There are cases where probabilistic early expiry is not enough to
prevent cache stampedes, most notably during a cold start/restart where
the cache is not yet populated and during conditions where source I/O
wait times may exceed the possible range of early expiry offset.
To completely prevent cache stampedes from occurring, a mutex must be
used around settings (re)caching.
Early expiry is left in place as it should still be quite effective in
reducing cache lock contention.
Bug: T296771
Change-Id: I99676466ce1ad4f1622867158d2ed15ef9202ec2
- OutputPage::getSections returns a flat data array. This patch nests sections such that the first level of section data contains only the keys of top level parents. Child sections are nested within a new key of their parent sections to create a tree of parent-child section relationships.
- Add helper method to recursively create subsections.
- Update SkinTemplateTests.
Bug: T299065
Change-Id: I33a95253f6d0de2bafeaa133a9c1da505c1824b2
* In LinkBatch::addObj(), reject interwiki links with a warning.
Otherwise the link is added to the batch by ns/title and later
reconstructed as if it were a local link without an interwiki
prefix.
* In CommentParser, treat interwiki links as always good, don't defer
the existence check.
* In LinkBatch, inject a LoggerInstance instead of calling LoggerFactory
in four places.
* Add a regression test, and some general tests for known links.
Bug: T300311
Change-Id: I0e5825eb48a6ba2932aea69a4d0fff3439c50ff5
Many communities for historic reasons use "messagebox" to style
certain templates. Going forward we aim to make sure all internally
produced CSS classes are prefixed with "mw-".
A user notice has been run notifying editors that this is potentially
a breaking change with directions on how to update their CSS in
preparation for this change.
Bug: T270796
Depends-On: Id258e328d1691f7bd31d2b3c57d64d5434706561
Change-Id: I2df24431ec72641b63fbe2fc929025a53459c06c