Commit graph

94586 commits

Author SHA1 Message Date
jenkins-bot
6512ef160c Merge "Introduce an expiry to WatchedItem" 2020-03-04 18:33:07 +00:00
jenkins-bot
7206c1ecbf Merge "SearchHandler: implement limit parameter" 2020-03-04 17:07:34 +00:00
MusikAnimal
bb56abfba0 Introduce an expiry to WatchedItem
Includes the new $wgWatchlistExpiry feature flag.

Consumers of WatchedItem and WatchedItemStore have not been changed to
make use of expiries, this along with associated UI changes will be done
in a separate patch.

Bug: T245213
Change-Id: Ifff5e56e0222bb325cf796e0aa3d88825820d1fd
2020-03-04 11:32:19 -05:00
jenkins-bot
26765a909d Merge "parser: Fix incomplete PHPDocs, remove meaningless comments" 2020-03-04 15:49:27 +00:00
James D. Forrester
c9b7c0c61d EditPage: Rename private bot var to 'markAsBot' to make clear what it does
Mostly for clarity of code, but particularly for the next patch.

Change-Id: Ieeaf50c6286a877ca00e0d4e673d393d28810f3c
2020-03-04 13:41:48 +00:00
daniel
c647e16c92 SearchHandler: implement limit parameter
The integration tests in Search.js were copied from the api-testing repo, see
<https://gerrit.wikimedia.org/r/plugins/gitiles/mediawiki/tools/api-testing/+/refs/heads/master/test/REST/Search.js>

Bug: T245676
Change-Id: Icb4e9b363586914f2c4bcf809bde003d90c017db
2020-03-04 11:13:55 +01:00
Thiemo Kreuz
1606d4a206 parser: Fix incomplete PHPDocs, remove meaningless comments
As long as no parsing was started, and $this->startParse() was not
triggered at least once, the $this->mOptions property is null. This
does have a lot of consequences. I'm intentionally not fixing all of
them in this patch to not make it to big, only the most obvious ones.

This came up in I6714400 which was actually running into this issue.

This patch also removes a few comments that *literally* repeat what
the code already says. Such comments are not helpful, but clutter the
code, make it harder to read, and create error-prone redundancy.

Change-Id: Ic1ab18242b2f79d3da2a2e7c25e3af3e6907f7b4
2020-03-04 11:08:00 +01:00
Thiemo Kreuz
f46a01334e Document the "beforeunload.editwarning" JavaScript event
I seriously hate jQuery for the way it concatenates strings to construct
long event names that can not be found when searching the code. This just
confused me again in Id8229e9. Let's please document this so we can find
the event name when searching for the string.

Change-Id: Ica19ee440a3ebe952ef1f2f883e2cbf893cbd879
2020-03-04 09:36:47 +01:00
Translation updater bot
a78df1485a Localisation updates from https://translatewiki.net.
Change-Id: I535974b55a278066476ccd01b7f40da88a2e4c2f
2020-03-04 07:55:07 +01:00
jenkins-bot
12a26c2e2f Merge "SiteConfiguration: Optimise getSetting() internals for getAll()" 2020-03-04 02:48:24 +00:00
jenkins-bot
c07fe5a8eb Merge "SiteConfiguration: Add unit test for tag/suffix conflict scenario" 2020-03-04 02:42:23 +00:00
Timo Tijhof
15f6e986eb SiteConfiguration: Optimise getSetting() internals for getAll()
* getSetting() was retreiving the overrides array from $this->settings
  by settingName. But, the getAll() caller already had this array
  locally available from its foreach loop as "$stuff" which was
  previously unused.

  The protected getSetting() was renamed to processSetting(),
  and now takes this array directly.

* Remove the code duplication in processSetting() for handling
  of 'tags' and handling of 'suffix'. Instead, treat the 'suffix'
  as an extra tag internally, which is exactly how it was behaving
  already. This happens in mergeParmas(), which now documents this
  feature and what it means practically.

  This means for WMF that it can remove the duplication between
  $wgConf->suffices and wikifamily dblist files. These are redundant
  given the suffix for those wikis is identical to the tag name.
  This will save about a dozen dblist file reads in production,
  once we utilize this decade-old feature.

* Rewrite the internal do-while in processSetting() in a more
  procedural fashion. The only reason it used do-while was to
  perform an "early return" from the given block in two places.
  One was rewritten with a simple if/else that devides before/after,
  and the other was rewritten by explicitly tracking the action it
  wanted to skip (which is: applying of 'default' value').

* Document this scary code, including the various anti-features
  I found along the way (such as 'default' overridding '+wiki').
  No changes in behaviour for now.

Bug: T169821
Bug: T246858
Bug: T246213
Change-Id: I723133e6814a5d15c3b0b9e785921505ec7b9a69
2020-03-04 02:12:16 +00:00
Timo Tijhof
44dd120f5a SiteConfiguration: Add unit test for tag/suffix conflict scenario
This is currently broken per T246858. Will be fixed in the next
commit.

Bug: T246858
Change-Id: Ifb5239e118f8707ccc397d55e4ae3eb8287906a3
2020-03-04 02:09:21 +00:00
jenkins-bot
ab79c3861e Merge "profiler: Document SectionProfiler private start and end as 'array|null'" 2020-03-04 01:28:12 +00:00
jenkins-bot
7192c88dba Merge "SearchHandler: add unit test" 2020-03-04 00:26:52 +00:00
jenkins-bot
a709f1c6c0 Merge "rcfilters: Improve accessibility of buttons to filter by namespaces/tags" 2020-03-03 23:13:59 +00:00
jenkins-bot
637f4ec411 Merge "Revert "Replace weird stdClass mock with class actually expected"" 2020-03-03 23:09:07 +00:00
Bartosz Dziewoński
11a91c3130 rcfilters: Improve accessibility of buttons to filter by namespaces/tags
* Remove the ButtonSelectWidget wrapper, use ButtonGroupWidget
  instead. The two buttons are independent, and only grouped visually.
  We did not even use the selecting feature (we reset the selection
  immediately after a button was chosen), and the keyboard navigation
  between two buttons was confusing because of the overridden styles.

* Re-add an ARIA label (and title) on the "Tags" button, which was
  accidentally removed in b988627835.

* Remove the ARIA label on the obsolete ButtonSelectWidget wrapper.

Change-Id: I3420a5426dc0fa835c156559323c670fb440478e
2020-03-03 22:58:05 +00:00
jenkins-bot
19e1d9a08d Merge "objectcache: split out StorageAwareness/ExpirationAwareness from IExpiringStore" 2020-03-03 22:55:24 +00:00
jenkins-bot
b9da733e96 Merge "Ensure all tests pass with partial blocks enabled" 2020-03-03 21:47:51 +00:00
jenkins-bot
925f1f9ce3 Merge "SpecialBlock: Set a default reason for data object in processForm" 2020-03-03 21:42:56 +00:00
Thalia
07548f4111 Ensure all tests pass with partial blocks enabled
This is in anticipation of removing the $wgEnablePartialBlocks
config.

Bug: T246685
Change-Id: I5e36bba184b20d97633c8cdc661cc1ca96e7423b
2020-03-03 20:12:32 +00:00
Thalia
7ec2cb856a SpecialBlock: Set a default reason for data object in processForm
Change-Id: Icf22c78b8b1425ed05ca76b34ee15254cfae7d11
2020-03-03 20:12:16 +00:00
jenkins-bot
7bfe3dd1c5 Merge "blockUsers script: fix logging" 2020-03-03 19:05:44 +00:00
jenkins-bot
f7c24dc564 Merge "[docker] Bump base image to 0.1.0" 2020-03-03 18:57:00 +00:00
jenkins-bot
95b5d15010 Merge "WikiMap: Add WikiMap::getCurrentWikiId() to make common use case easier" 2020-03-03 17:32:08 +00:00
jenkins-bot
4127e5b317 Merge "rdbms: improve IDatabase method documentation and parameter names" 2020-03-03 17:14:49 +00:00
jenkins-bot
360d7f6c3b Merge "TemplateParser: Invalidate cache if partial changes" 2020-03-03 17:03:24 +00:00
Timo Tijhof
95ec909e52 WikiMap: Add WikiMap::getCurrentWikiId() to make common use case easier
Change-Id: Ie225ebfc37c824e3167742137bbbc9f64aca5f5e
2020-03-03 16:04:21 +00:00
DannyS712
efcc37b8e6 Add release notes for I0c8fe834d
Bug: T242311
Change-Id: I6c9c5c4b216fc562c59e3607e45618d22c83e4ab
2020-03-03 15:01:54 +00:00
jenkins-bot
25a0d01d19 Merge "Revert "Split FakeMaintenance and LoggedUpdateMaintenance to their own files"" 2020-03-03 14:30:58 +00:00
Daimona Eaytoy
7def03fe80 Revert "Split FakeMaintenance and LoggedUpdateMaintenance to their own files"
This reverts commit 2cdeb26d0c.

Reason for revert: broke roughly all scripts extending LoggedUpdateMaintenance.

Bug: T246754
Change-Id: Icfe3da924c364b4b4f9286871aeb0aa9f1bbff1a
2020-03-03 14:14:31 +00:00
jenkins-bot
f8a22d2ba2 Merge "RCFilters: Add ARIA label to filters namespaces and tags select widget" 2020-03-03 14:06:03 +00:00
Akinwale Alagbe
70ac607c42 RCFilters: Add ARIA label to filters namespaces and tags select widget
Bug: T246179
Change-Id: Id40b536b8e2a8fd35861fdd89ba7ce79ef14458e
2020-03-03 13:51:17 +00:00
jenkins-bot
fe13074a7b Merge "Remove Revision::loadFromId(), deprecated and unused" 2020-03-03 11:49:13 +00:00
Daimona Eaytoy
41a17c3bec blockUsers script: fix logging
If the username isn't valid, $performer is just false and not the
invalid name. For the other prints, use $performerName directly instead
of relying on User::__toString.

Change-Id: I22ad6f98a14a69ea13aa794b45869dd2eb747dee
2020-03-03 12:22:19 +01:00
Sam Smith
52f50cd657 TemplateParser: Invalidate cache if partial changes
Changes:

- Update TemplateParser::compile to return all files read during the
  compilation of the template and the hash of those files

- Tweak the cache invalidation logic in TemplateParser::getTemplate
  accordingly. This is made trivial due to the friendly design of the
  FileContentsHasher::getFileContentsHash.

Bug: T113095
Change-Id: I948fdaecf720d7d16c5ccabb2d7f01b5cbf27c90
2020-03-03 11:14:38 +00:00
DannyS712
4d4d4b61ab Forgot to include the deprecation version
Change-Id: I8d001bf97134e83998ac697bb2871833742cf087
2020-03-03 09:11:35 +00:00
jenkins-bot
0c650e25c6 Merge "mw.Api: Add utility function for asserting the current user" 2020-03-03 08:36:23 +00:00
Translation updater bot
4b07b83a07 Localisation updates from https://translatewiki.net.
Change-Id: Icadd6a980562ee6938a374f057740143aa9dd7ff
2020-03-03 07:56:22 +01:00
jenkins-bot
9ce8f505e5 Merge "SiteConfiguration: Optimise getAll() and doReplace() loops" 2020-03-03 01:14:05 +00:00
Timo Tijhof
268759c154 SiteConfiguration: Optimise getAll() and doReplace() loops
The runtime numbers in each bullet point are based on a local
benchmark that use a copy of WMF's InitialiseSettings.php file
to compute enwiki's $globals via SiteConfiguration::getAll().
Source code and results can be found at
<https://gist.github.com/Krinkle/2ef2fe72218b5f5cea91679df56a0b18>.

* The getSetting() method (called by getAll) was iterating over
  each find/replace pair and performing a separate call to str_replace()
  via doReplace().

  Instead, iterate the pairs only to create a replacements array
  (this array differs from the pairs in that it has a leading "$" in the
  search keys), and then call doReplace() once for each setting value,
  instead of multiple times.

  Also, switch from str_replace() to strtr() while at it (which promises
  to only search the string once, instead of repeatedly until it no
  longer finds any of the search patterns).

  Also also, generate the replacements array outside the getSetting()
  method and do this in the mergeParams() method instead, which is called
  before the getSetting-loop in getArray begins, thus further reducing
  identically repeated work.

  In my local benchmark for WMF/enwiki this reduced runtime from
  ~7.5-8.1ms to ~6.9-7.3ms.

* The getSetting() method was using a by-reference assignment
  for a local variable that would hold a read-only copy a class member
  `$thisSetting =& $this->settings[$settingName];`.

  This was presumably a PHP4 or PHP5 era optimisation to avoid
  an eager memory copy given the promise to only read the data.
  However, in PHP5/PHP7 this is redundant given that PHP
  does copy-on-write.

  Removing the "&" symbol here made a drastic perf improvement,
  reducing my WMF/enwiki benchmark runtime from ~6ms to ~1ms.

Bug: T169821
Change-Id: I0e8b395920c143f2b42f9d87c1afaffa2bfdaf2e
2020-03-03 00:59:51 +00:00
jenkins-bot
0ca7e767e6 Merge "Reduce usage of the Language class" 2020-03-03 00:08:35 +00:00
Aaron Schulz
ccebc2317b rdbms: improve IDatabase method documentation and parameter names
Change-Id: I87c0c6e418fe19bd837b38ebdfb967466f967fca
2020-03-02 22:59:12 +00:00
ArtBaltai
31283f34bf Reduce usage of the Language class
reduce/deprecate visibility of some members of the Language class

Bug: T243913
Change-Id: I6bad608455ceaa46f895f00dcc6380cec6d32680
2020-03-03 01:38:27 +03:00
jenkins-bot
72c86bc25b Merge "Add a maintenance script to block a list of users" 2020-03-02 22:16:57 +00:00
jenkins-bot
a80c1107a3 Merge "objectcache: make ObjectCache::newFromParams() defaults more consistent" 2020-03-02 22:08:45 +00:00
Sam Smith
5607158ba7 TemplateParser: Make cache value include metadata
Update TemplateParser::compile to return the PHP code and metadata. The
metadata includes details about the compilation that can be used to
validate that PHP code fetched from a cache is fresh without having to
recompile the original template.

TemplateParser::getTemplate did have such an invalidation mechanism but:

- It stored the hash of the template file in the key

- It stored the hash used for checking the integrity of the cached PHP
  code in the first 64 bytes of the value

This tight coupling between the compilation result and the contents of
the cache key/value made changing either the compilation or cache
invalidation steps difficult.

After this change, arbitrary metadata can be added or removed from the
compilation result.

Changes:

- Move all filename generation and reading to TemplateParser::compile
  and align its signature with ::getTemplate

- Update TemplateParser::compile to generate the file hash with
  FileContentsHasher::getFileContentsHash, which is used by
  Resource Loader to generate file hashes, and return it as part of its
  result

- Update TemplateParser::getTemplate to store the integrity hash in the
  compilation result prior to caching it

- Bump the cache key major version as both the key and value have
  changed

Note well that TemplateParser isn't expected to be subclassed, and
::getTemplate and ::compile are protected members and are therefore out
of the scope of MediaWiki's deprecation policy.

Bug: T113095
Change-Id: Ifb5e122c6ae238fd300cd60f2b1ab33b7ece8e71
2020-03-02 21:21:43 +00:00
jenkins-bot
3f92c64591 Merge "PHPVersionCheck: Refactor triggerError() to be easier to understand" 2020-03-02 21:13:20 +00:00
Aaron Schulz
5780011ec5 objectcache: make ObjectCache::newFromParams() defaults more consistent
Apply the same duplication logging and asyncHandler defaults for
factory-based entries as constructor-based entries.

Change-Id: I2aa835c5ec7932432d2c739ffa761a7bd9c21198
2020-03-02 21:07:32 +00:00