Commit graph

1030 commits

Author SHA1 Message Date
DannyS712
f3e2b140c8 Create abstract special page SpecialRedirectWithAction, and use it.
Special:Edit, Special:History, Special:Purge, and Special:Info all
redirect to index.php?title=$1&action=, where the action is edit,
history, purge, or info. Thus, they can each extend a common class.

Bug: T13456
Change-Id: I64aca28075f5d79ec841b6868e1760f2dac4ec90
2019-11-28 01:00:28 +00:00
Bartosz Dziewoński
97eab7f35b Improve collapsible HTMLForm styling (and accessibility, slightly)
Previously the form was only collapsible/expandable using the small
link-button on the far right. Now you can click on the entire header
to do it, and it has an appropriate pretty icon.

We add appropriate ARIA `role` and textual labels. Together with
recently added `toggleARIA` option of jquery.makeCollapsible in
Ic457bda58e56f we feature a screen reader workable output.

Bug: T222904
Change-Id: I6964296bc6870550478de662d21f12a1fc084c15
2019-09-23 10:57:26 -07:00
Brad Jorsch
02d6dc2e4f API: Use ApiBlockInfoTrait in ApiQueryUsers and AllUsers
For efficient bulk querying, this means that
ApiQueryBase::showHiddenUsersAddBlockInfo() needs to return everything
needed by DatabaseBlock::newFromRow().

Since we're rewriting it anyway, we may as well also move
ApiQueryBase::showHiddenUsersAddBlockInfo() out into a trait of its own.

Bug: T232021
Change-Id: I9c5b17a232ecbfbffefc7e40608cf5684ce8a644
2019-09-18 19:44:01 +00:00
Brad Jorsch
17909bfe0b MergeHistory: Update revactor_page too
When using MergeHistory, we need to update the denormalized
revision_actor_temp.revactor_page to match the update we do for
revision.rev_page.

Also, we need a maintenance script to clean up the rows that were broken
by our failure to do that before.

Bug: T232464
Change-Id: Ib819a9d9fc978d75d7cc7e53f361483b69ab8020
2019-09-17 07:17:38 +00:00
Reedy
dd71a77512 Make most special pages class names match filename
Change-Id: I3a9f932acb7d9cf44a984b5d97f9fbc6b8670f7d
2019-09-10 02:47:08 +01:00
jenkins-bot
64e7e7d760 Merge "Provide command to adjust phpunit.xml for code coverage" 2019-09-09 19:25:32 +00:00
Kosta Harlan
fd72f6c48e Provide command to adjust phpunit.xml for code coverage
Our current recommendation for adjusting PHPUnit configuration for
extension code coverage reports is to manually modify
tests/phpunit/suite.xml. This is cumbersome and annoying, since
suite.xml is version controlled.

This patch proposes a composer script to simplify editing
the (non-version controlled) phpunit.xml config in the root of the
MediaWiki repo. It is useful if you are interested in generating
code coverage reports based on unit tests only, not integration tests.

Usage: composer phpunit:coverage-edit -- extensions/GrowthExperiments

When you're done, you can run `rm phpunit.xml` to switch back to the
default phpunit.xml.dist.

The script will use the default includes/src/maintenance directories,
but a future improvement would be to identify the relevant directories
via the AutoloadClasses property of extension.json.

Another improvement would be to provide an option for passing
arbitrary paths in core, in case you are working on tests for a
specific class and want to generate coverage reports instantly.

We could probably also remove
dockerfiles/quibble-coverage/phpunit-suite-edit.py (which inspired
this patch) and use composer phpunit:coverage-edit instead.

Bug: T100294
Change-Id: Ia0ef41f67ca4a64b0d1ca0ddcee488c29630af0b
2019-09-09 14:32:02 +02:00
Timo Tijhof
56fdc4715e docs: Factor out MWDoxygenFilter from mwdoc-filter.php with tests
Bug: T232104
Change-Id: I591f44678cff4adb8863ce5c6ce231a8d3e162d7
2019-09-05 18:22:23 +01:00
daniel
6906a7728c Add UnknownContentHandler.
UnknownContentHandler can be configued to handle models that
belong to extensions that have been undeployed:

  $wgContentHandlers['xyzzy'] = 'UnknownContentHandler';

This way, no errors will be thrown when trying to access
pages with the unsupported model. Instead, an error message is
shown, and editing is prevented.

This patch also improves handling of non-editable content in
EditPage and in DifferenceEngine.

Bug: T220608
Change-Id: Ia94521b786c0a5225a674e4dc3cb6761a723d75b
2019-08-29 10:43:11 +00:00
jenkins-bot
4accd44583 Merge "Hard deprecate new SearchResult() and introduce RevisionSearchResult" 2019-08-27 15:53:34 +00:00
David Causse
bf9a7cad61 Hard deprecate new SearchResult() and introduce RevisionSearchResult
Transitional step for the transformation of SearchResult into an
abstract base class:
- RevisionSearchResult is introduced to behave like SearchResult
- methods are currently shared between  RevisionSearchResult and
  SearchResult in the RevisionSearchResultTrait

Bug: T228626
Change-Id: I13d132de50f6c66086b7f9055d036f2e76667b27
2019-08-27 08:27:28 -07:00
Aryeh Gregor
5a6c18a086 LockManagerGroupFactory to replace singletons
100% test coverage of code that appears to be working and used, in both
LockManagerGroupFactory and also LockManagerGroup. Where possible I
wrote it as unit tests. One preexisting code path seems to be broken and
I marked the test as skipped. Two methods look unused and perhaps not
especially helpful, so I didn't write tests for them yet in case we want
to just get rid of them instead.

Change-Id: Iaa7354f31c451b87773468609c674a3bf1d4382f
2019-08-27 13:19:15 +03:00
jenkins-bot
1c7a8c1d25 Merge "Add SearchResultTrait" 2019-08-27 00:32:25 +00:00
Amir Sarabadani
308e6427ae Revert "Make LocalisationCache a service"
This reverts commits:
 - 76a940350d
 - b78b8804d0
 - 2e52f48c2e
 - e4468a1d6b

Bug: T231200
Bug: T231198
Change-Id: I1a7e46a979ae5c9c8130dd3927f6663a216ba753
2019-08-26 18:28:26 +02:00
jenkins-bot
c63a37679c Merge "language: Move ConverterRule to includes/ and add test case" 2019-08-26 15:09:13 +00:00
Timo Tijhof
7eef775b27 language: Move ConverterRule to includes/ and add test case
Add a very basic test that creates an instance, invokes it
with an empty string, and asserts the types and values returned
by the public methods used in LanguageConverter::applyManualConv.

Bug: T225756
Change-Id: I3600260e712f019243ba5f00890011e694444e43
2019-08-26 12:32:14 +01:00
Daimona Eaytoy
f18af0b61f Remove more Oracle and Mssql leftovers
Follows-up 4d10bb14e8 and 807d793ab9.

According to codesearch [0], these were the last usages. Note that this
patch leaves two constants in places, IDatabase::DBO_SYSDBA and
DBO_DDLMODE. These are public constants used "mostly for oracle" according
to the docs, but maybe we could find other use cases in the future (?).

[0] - https://codesearch.wmflabs.org/core/?q=oracle%7Cmssql&i=fosho&files=%5C.%5B%5Ej%5Cd%5D%7Cen%5C.json&repos=

Bug: T230418
Change-Id: Ibfb748b4b23b885a77f4de161af4bf2ab9649a89
2019-08-25 17:21:49 +00:00
jenkins-bot
ab2e77bb5d Merge "objectcache: move MemcachedClient class to /utils subdir" 2019-08-23 14:19:58 +00:00
Aryeh Gregor
2e52f48c2e Split some Language methods to LanguageNameUtils
These are static methods that have to do with processing language names
and codes. I didn't include fallback behavior, because that would mean a
circular dependency with LocalisationCache.

In the new class, I renamed AS_AUTONYMS to AUTONYMS, and added a class
constant DEFINED for 'mw' to match the existing SUPPORTED and ALL. I
also renamed fetchLanguageName(s) to getLanguageName(s).

There is 100% test coverage for the code in the new class.

Change-Id: I245ae94bfc1f62b6af75ea57525139adf2539fe6
2019-08-23 12:52:35 +03:00
Aaron Schulz
44e2ab3560 objectcache: move MemcachedClient class to /utils subdir
Change-Id: I2774d3e7a3c96ef691106b21908a42bfbbf25956
2019-08-21 16:17:20 -07:00
Aryeh Gregor
5e2199c5b0 BadFileLookup to replace wfIsBadImage
I think this probably shouldn't be directly in the MediaWiki namespace,
but I don't know where is a better place to put it.

In order to avoid gratuitous use of TitleFormatter, I changed the cache
format -- the old implementation used getPrefixedDBkey() and I switched
to an ns/dbkey pair. I also changed the cache keys to use SHA1 instead
of MD5, by Daniel's request.

The previous implementation cached the parsed blacklist for one minute
without invalidation, so it could return slightly stale results, but it
didn't retrieve the bad image list message on a cache hit. The new
implementation unconditionally retrieves the bad image list message, but
uses a hash of it in the cache key and caches for one day. The new
behavior happens to be more cleanly implementable in a service.

Bug: T200882
Bug: T139216
Change-Id: I69fed1b1f3cfc1aa149e0739780e67f6de01609d
2019-08-21 20:45:37 +03:00
Aryeh Gregor
a83b33582a TempFSFileFactory service
This replaces TempFSFile::factory(), which is now deprecated.

Change-Id: I9e65c3867e26c16687560dccc7d9f3e195a8bdd6
2019-08-21 16:26:05 +03:00
David Causse
9d944bd816 Add SearchResultTrait
to hold non-obvious behaviors and rarely specialized methods.

Change-Id: Idc600e22b35a01be8be8cb629bfb09701e842cd7
2019-08-20 18:24:44 +02:00
Aryeh Gregor
8ec24b607a Introduce MovePageFactory
This will help make MovePage more testable.

In the course of abstracting the logic out of ParserFactoryTest to
FactoryArgTestTrait so it could be used in MovePageFactoryTest, I made
them all unit tests instead of integration. This required some
modification to the Parser constructor so that it didn't access
MediaWikiServices unnecessarily.

Change-Id: Idaa1633f32dfedfa37516bb9180cfcfbe7ca31aa
2019-08-19 20:25:31 +03:00
Amir Sarabadani
4b80ca45f7 Drop last bits of oracle
Undefined constant

Change-Id: I66f17a7647bdcf254695dd0d3a0d49d41a35fff3
2019-08-14 23:44:22 +02:00
Amir Sarabadani
4d10bb14e8 Drop Oracle and Mssql
After approval of RFC T191231, we are going to drop oracle and mssql
and it will be possible to bring back the support using the abstract schema

Adding to release notes will be done in a follow-up

Bug: T230418
Change-Id: I90bd5cfcc3e18011b193c965fdb1fa54675040b5
2019-08-14 11:31:41 +00:00
jenkins-bot
fab912b65c Merge "Create Special:NewSection special page" 2019-08-07 20:24:41 +00:00
Daniel Kinzler
aa4da3c2e8 Revert "Add small HtmlCacheUpdater service class to normalize purging code"
This reverts commit 35da1bbd7c.

Reason for revert: wrong tab, wrong patch. Ooops.

Change-Id: I5828fff6308d43460a3b2b10f60996409181f8b3
2019-08-07 13:56:30 +00:00
Aaron Schulz
35da1bbd7c Add small HtmlCacheUpdater service class to normalize purging code
The purge() method handles purging of both file cache and CDN, using
a PRESEND deferred update. This avoids code duplication and missing
file cache purge calls.

Also:
* Migrate HTMLCacheUpdate callers to just directly using HTMLCacheUpdateJob
* Add HtmlFileCacheUpdate class and defer such updates just like with CDN
* Simplify HTMLCacheUpdate constructor parameters
* Remove BacklinkCache::clear() calls which do nothing since the backlink
  query does not actually happen until the job runs

Change-Id: Ic453b189a40109a73a9426538608eea87a76befa
2019-08-06 13:45:27 -07:00
Aaron Schulz
0bee81df81 Move WANObjectCache to wancache/ instead of WinCache
Follow up 6ca3de5fa0.

Change-Id: I7021dfe5c900f810ab3b6dc701a04e2c3e1c4c66
2019-08-02 22:07:47 +00:00
Aaron Schulz
6ca3de5fa0 Move WAN cache classes under a new wancache/ directory
Change-Id: I6837761ebca7557e029e1f65beca738266e48efb
2019-08-02 14:46:23 -04:00
DannyS712
95b257375c Create Special:NewSection special page
Bug: T207577
Change-Id: If69a8e13b524f55f78b2f61aadf1f9045fda5ff2
2019-08-02 12:34:13 +00:00
jenkins-bot
d64df8329b Merge "Make CliInstaller control the processing logic of the error" 2019-08-01 00:01:08 +00:00
RazeSoldier
b873e9294b Make CliInstaller control the processing logic of the error
Previously, if there was an error during CLI installation,
CliInstaller::showStatusMessage() exited the script directly. The exit
timing of the script should be given to the caller, not the callee.
So, I coding:
[1] Remove `exit()` from CliInstaller::showStatusMessage()
[2] Make the callee to return Status, the caller determine how to handle these Status
[3] Strictly check the key database type instead of just outputting message

Bug: T46511
Change-Id: I72ffd33fe5c592b9ea78f37bae5a9c081295c624
2019-07-29 20:18:08 +08:00
David Causse
ff6b6a758a Add SearchResultSetTrait
trait meant to hold methods that rarely overridden or that are
non trivial to implement.

Bug: T228626
Change-Id: I4fba27b22860109d648e830a435d4a036d26ad06
2019-07-25 15:52:36 +02:00
David Causse
e97ff3524b Add BaseSearchResultSet
Meant to hold the B/C behaviors and be the base class implemented
by extensions.

Bug: T228626
Change-Id: I072a9bd0f94bd785d1ff51f0e6ee13790e37b417
2019-07-25 15:47:01 +02:00
David Causse
6af636fb03 Add ISearchResultSet
Bug: T228626
Change-Id: I3306bf6107c97dd58adf578fd965bd11a422627d
2019-07-22 18:27:39 +00:00
Aaron Schulz
bebe30333d objectcache: add MediumSpecificBagOStuff base class for non-proxy subclasses
This make it much clearer what needs to be overridden

Change-Id: I3073f8a0605f557c6a3a93d0d8401cddd0fb8dbe
2019-07-19 13:01:46 -07:00
jenkins-bot
04d1aa3033 Merge "maintenance: Script to rename titles for Unicode uppercasing changes" 2019-07-10 06:42:16 +00:00
Brad Jorsch
9ef8c9608d maintenance: Script to rename titles for Unicode uppercasing changes
This uses MovePage where possible to try to better keep data in sync.
Archives, log entries, and so on can't do that though.

The script skips User and User_talk pages for registered users, as
renaming the users is more complicated than makes sense to try to
implement here. Use something like Extension:Renameuser to clean those
up; this script can provide a list of user names affected.

Bug: T219279
Change-Id: I157577cb5bedfd347b808c254fb19ae8088818ab
2019-07-09 13:53:43 -04:00
Aaron Schulz
670687fae0 objectcache: add IStoreKeyEncoder interface for key generation helper methods
If a key is stored in both BagOStuff and WANObjectCache, it useful to have
one common method for generating the cache and storage keys.

Change-Id: I8b77651746a55e8a98a79db298226e334d15a494
2019-07-08 22:33:07 +00:00
Reedy
d7451a03e9 Move MultiHttpClient.php to libs/http
Change-Id: I199e615fad363b1439604c9d01a9a475856d6128
2019-07-01 21:47:57 +01:00
Aaron Schulz
baafb5adb4 Make ExternalStore wrap ExternalStoreFactory and create access class
* Inject settings and global instances as dependencies to the
  ExternalStoreMedium instances. This includes the local wiki
  domain, so that wfWikiId() calls are not scattered around.
* Create ExternalStoreAccess service for read/write logic.
* Deprecate the ExternalStore wrapper methods.
* Add some exception cases for bogus store URLs are used instead
  of just giving PHP warnings and failing later.
* Make moveToExternal.php require the type/protocol to decide
  which ExternalStoreMedium to use instead of assuming "DB".
* Convert logging calls to use LoggerInterface.

Change-Id: I40c3b5534fc8a31116c4c5eb64ee6e4903a6197a
2019-06-28 14:31:44 -07:00
David Causse
92c20832f1 Deprecate SearchResult::termMatches()
And start indicating that hooks relying on this data might become
unreliable as this data is only populated by SearchDatabase search
engines.

This information was only populated by SearchDatabase implementations
and due to bad initial design of SearchResult[Set] (now fixed) it forced
users of these classes to carry this information for the sole purpose of
highlighting.
Because SearchEngine can now own their SearchResult[Set] implementations
nothing that is engine specific should be exposed outside of these
specific implementations.
If there are some logic that still requires access to such list of terms
they should be made engine specific by guarding their code against
instanceof SqlSearchResult.

Change-Id: I38b82c5e4c35309ee447edc3ded60ca6a18b247a
Depends-On: I53fe37c65c7940f696c1e184125e01e592a976e4
2019-06-27 08:44:06 -07:00
jenkins-bot
6b9b8b9add Merge "Add Special:Mute as a shortcut for muting notifications" 2019-06-25 17:15:39 +00:00
Dayllan Maza
ed13d3fa56 Add Special:Mute as a shortcut for muting notifications
- Special:Mute has been added as a quick way for users to block unwanted
   emails from other users originating from Special:EmailUser
 - Special:Mute can be enabled by setting $wgEnableSpecialMute = true.
   This flag default value is `false`. This flag is temporary until
   enough wikis have this feature enabled and then it will go away
 - When Special:Mute is enabled, emails sent from Special:EmailUser
   contain a link to Special:Mute to facilitate access to the page

In the future, Special:Mute will support extensions to append other types
of notifications that could be muted. These are some of the tasks tracking
the rest of the work:
- T218270
- T220163
- T218266

It is worth mentioning that blocking emails from users is already available
via Special:Preferences

Bug: T218265
Change-Id: I54b847192f42ee1f37999d36c3a187f8826f55a8
2019-06-24 23:10:02 -04:00
jenkins-bot
7462d3075a Merge "language: Move some language-related classes to includes/language/" 2019-06-19 02:14:15 +00:00
jenkins-bot
efe7286cac Merge "resourceloader: Skip modules with circular deps in tree optimiser" 2019-06-18 22:59:07 +00:00
Timo Tijhof
f557b2be4f language: Move some language-related classes to includes/language/
Bug: T225756
Change-Id: Ica351483d83a3a912d58ebb194b30828541fbcf3
2019-06-18 21:38:44 +00:00
Kunal Mehta
dd8aab7382 Remove unused/deprecated Replacer classes
Change-Id: Ifec6c624810b2354f2fab2c1fd4a27267b625c4b
2019-06-17 15:46:08 -04:00