Commit graph

12030 commits

Author SHA1 Message Date
C. Scott Ananian
6859304afc Hard-deprecate OutputPage::enableClientCache()
Code search:
https://codesearch.wmcloud.org/deployed/?q=enableClientCache&i=nope&files=&excludeFiles=&repos=

Depends-On: I91d0b8e8f69a2d309b6fc61e13bfb5d86dc0218d
Depends-On: I0b0cc58f18a47766a174af7f25be51d7630ecb37
Depends-On: I4aff8ceeae7e28a869c8cb60b69f59a4dac48b5d
Depends-On: I70c4b719346b737c801257c37c26997fbbecd27f
Depends-On: Ib195336a8f6bb9f7d4a1344e9dcf3c01dfd5d114
Depends-On: Idf1cf2fac3311f50ed3cbc420f7772b5c71b1992
Depends-On: I7c89e20528a0d91173f0edcb997dcae631935ee5
Change-Id: I3a8a0897ed36dac5927dc7fb3d533cdb12e5136f
2022-02-04 15:51:53 -05:00
C. Scott Ananian
065617f93c Add OutputPage::disableClientCache() and deprecate ::enableClientCache(false)
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
2022-02-04 15:51:50 -05:00
jenkins-bot
c82ced1ba1 Merge "diff: Fix small issues and compact syntax in DifferenceEngine" 2022-02-04 15:09:28 +00:00
Thiemo Kreuz
32bbb421c7 diff: Fix small issues and compact syntax in DifferenceEngine
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
2022-02-04 10:55:48 +01:00
daniel
f5641f9856 Do not rely on $IP in DefaultSettings.php
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
2022-02-03 22:05:34 +00:00
Petr Pchelko
d54e3d216c Add pre-generator for config-schema.php
Bug: T300129
Change-Id: Ib2620993114af5a659bda60dc45b6fb3bed657b0
2022-02-03 13:27:47 +00:00
jenkins-bot
55a2f2be4d Merge "HTMLFormField: Bypass the inverting logic of HTMLCheckField for disable-if and hide-if" 2022-02-02 21:25:22 +00:00
jenkins-bot
3ea4e097ae Merge "HTMLFormFieldTest: Use mFieldData for check of values" 2022-02-02 21:23:27 +00:00
jenkins-bot
66a9e60776 Merge "Add getMemberCount() to Category to supersede getPageCount()" 2022-02-02 03:47:38 +00:00
Jon Robson
e9b7bcc932 Add icons to navigation sidebar entries
These will be used immediately in Minerva but expands icons to
the sidebar for other skins

Bug: T291568
Change-Id: Ia54d01eb5d8d9c33d067f61c73203f9fec4569a6
2022-02-02 00:44:51 +00:00
jenkins-bot
cb32a65f36 Merge "objectcache: add more guessSerialValueSize() tests" 2022-02-01 23:06:06 +00:00
jenkins-bot
50f08c19d0 Merge "ExtensionRegistry: Add process cache for lazy attributes" 2022-02-01 23:00:09 +00:00
jenkins-bot
3c55e960bd Merge "remove access to config globals from includes/parser" 2022-02-01 16:27:52 +00:00
daniel
026133bb05 remove access to config globals from includes/parser
Loops ServiceOptions through to CoreParserFunctions and CoreTagHooks to
avoid access to the main config from static methods.

Bug: T294739
Change-Id: Ia6c97f2d0952964c2ad6189f8053ad127589b37c
2022-02-01 07:48:57 -08:00
Func
0c707ca259 HTMLFormField: Bypass the inverting logic of HTMLCheckField for disable-if and hide-if
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
2022-02-01 13:09:13 +00:00
Tim Starling
5586bb1a57 ExtensionRegistry: Add process cache for lazy attributes
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
2022-02-01 21:01:44 +11:00
Func
c574f49f34 HTMLFormFieldTest: Use mFieldData for check of values
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
2022-02-01 08:10:14 +00:00
jenkins-bot
aaea327efb Merge "Avoid unneeded category count updates on moves" 2022-02-01 03:33:43 +00:00
jenkins-bot
ec52d2d6fb Merge "Use a mutex to prevent settings cache stampedes" 2022-01-31 19:28:54 +00:00
jenkins-bot
a831b76a55 Merge "user: Set a default value for all searchNs* user preferences" 2022-01-31 19:03:26 +00:00
jenkins-bot
c0f7f43e75 Merge "Fix pollution of LinkBatch/LinkCache with interwiki link" 2022-01-31 19:03:19 +00:00
Umherirrender
12eff262d3 user: Set a default value for all searchNs* user preferences
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
2022-01-31 18:45:27 +00:00
jenkins-bot
ab778e5405 Merge "remove access to config globals from FauxResponse" 2022-01-31 16:16:01 +00:00
jenkins-bot
64ea317d7c Merge "PHPUnit: Cover rewind(), next(), and key() test cases" 2022-01-31 15:30:30 +00:00
jenkins-bot
e1cc1af28d Merge "HTMLFormField: Split out the validation of cond-state params" 2022-01-31 15:15:41 +00:00
jenkins-bot
d1a1ed054c Merge "Add tests for HTMLFormField 'hide-if' / 'disable-if' functionality" 2022-01-31 15:15:36 +00:00
jenkins-bot
49b0a82e67 Merge "Fix page_props DELETE/INSERT on null edit" 2022-01-31 14:54:15 +00:00
Ammarpad
c7734cbb9f Add getMemberCount() to Category to supersede getPageCount()
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
2022-01-31 13:59:34 +01:00
Tim Starling
c11954c036 Fix page_props DELETE/INSERT on null edit
* 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
2022-01-31 15:59:28 +11:00
Func
53d4b41be3 HTMLFormField: Split out the validation of cond-state params
Follow-up changes will use cond-state params in other functions, split this out to make sure it's validated.

Change-Id: Icf358794b11a8f986fbd02c8f1b15ea9d1ef4d15
2022-01-28 21:47:52 +00:00
daniel
62d924428a remove access to config globals from FauxResponse
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
2022-01-28 22:45:36 +01:00
Bartosz Dziewoński
751f050bf3 Add tests for HTMLFormField 'hide-if' / 'disable-if' functionality
(Test scaffolding code copied from HTMLRestrictionsFieldTest)

Change-Id: I9d221059813a6ac362e3e070984abcaae57906dc
2022-01-28 22:44:35 +01:00
jenkins-bot
482daa82cb Merge "Update section name in toc data array" 2022-01-28 19:57:04 +00:00
jenkins-bot
b18023b48f Merge "filerepo: Simplify and document 'favicon' FileRepo option" 2022-01-28 18:14:28 +00:00
Dan Duvall
aae7c326ef Use a mutex to prevent settings cache stampedes
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
2022-01-28 09:13:38 -08:00
Clare Ming
130928520f Update section name in toc data array
Bug: T299065
Change-Id: Ic4eb68f13d33561ce8725cde25e3401a873be69a
2022-01-28 02:06:02 -07:00
jenkins-bot
198a7ae655 Merge "Update Skin::getSectionData method" 2022-01-28 02:26:12 +00:00
Clare Ming
3c7caa83ad Update Skin::getSectionData method
- 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
2022-01-27 17:29:18 -07:00
Tim Starling
16979ecf29 Fix pollution of LinkBatch/LinkCache with interwiki link
* 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
2022-01-28 10:52:38 +11:00
jenkins-bot
e1e4f7514f Merge "Convert various callers to LoadBalancer::getConnectionRef()" 2022-01-27 23:34:39 +00:00
jenkins-bot
fc6b80b464 Merge "Replace deprecated JobQueueGroup::singleton()" 2022-01-27 22:17:12 +00:00
Alexander Vorwerk
decbaf4f38 phpunit: use ->getServiceContainer() in integration tests
Change-Id: I38299cb65eeaadfdc0eb05db4e8c0b0119cfb37d
2022-01-27 22:04:16 +01:00
Umherirrender
68808e5832 Replace deprecated JobQueueGroup::singleton()
Change-Id: Icdb301d352d302f70fefba9b40df2368cb217fd2
2022-01-27 21:37:50 +01:00
bwang
79e8ef17e6 Add additional layer of nesting to TOC data to better support rendering of TOC with mustache templates
Bug: T298796
Change-Id: I406acf333d28b3898e3bc4968d05224febd09b3c
2022-01-27 19:52:46 +00:00
jenkins-bot
fd84c0f087 Merge "tests: Replace usages of deprecated WikiPage::doDeleteArticleReal" 2022-01-27 19:32:06 +00:00
jenkins-bot
3843d16823 Merge "Reapply "SettingsBuilder: allow maintenance scripts to manipulate config"" 2022-01-27 17:53:01 +00:00
jenkins-bot
e8740a16f4 Merge "Update skin ordering to prioritize skins set through a new config" 2022-01-27 16:50:11 +00:00
jenkins-bot
0516a75e7a Merge "Untie Wikimedia message boxes from on-wiki messageboxes" 2022-01-27 15:44:29 +00:00
Derick Alangi
5b4c400056 PHPUnit: Cover rewind(), next(), and key() test cases
Change-Id: Ic8077fcdbfad68c6ae7c63daefbab3b2ee8c50bf
2022-01-27 12:48:20 +00:00
Jdlrobson
be9e79f9ad Untie Wikimedia message boxes from on-wiki messageboxes
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
2022-01-27 01:37:35 +00:00