Commit graph

1022 commits

Author SHA1 Message Date
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
Timo Tijhof
14547fd9dc resourceloader: Skip modules with circular deps in tree optimiser
Either the server needs to omit these from the registry with
state=error output to the client (and server-side error logging),
or it needs to detect them, and transport them unchanged, so that
the existing client-side logic can handle it.

This patch does the latter.

Without the source code change in this patch, the added test case
fails due to "top" and "middle1" then being registered with
an empty array as dependencies.

Bug: T223402
Change-Id: I57502d7c4e434de4737759aed325dd4200ca89bf
2019-06-13 20:11:44 +00:00
jenkins-bot
699920cc66 Merge "objectcache: add object segmentation support to BagOStuff" 2019-06-13 18:19:17 +00:00
Bartosz Dziewoński
a8dae2212c Allow loading styles for arbitrary OOUI icon packs
You can now create ResourceLoader modules for arbitrary sets of OOUI
icons. This is an alternative to I8af783666a2b23a938af93c1b56fee619219eaf5.

Update dependencies of OOUI's modules to use custom icon packs instead
of default icon packs.

Bug: T160690
Change-Id: Icf9560da79c91e56c7a3f4c0de01dd057f5aa00d
2019-06-11 17:52:23 +00:00
Aaron Schulz
b09b3980f9 objectcache: add object segmentation support to BagOStuff
Use it for ApiStashEdit so that large PaserOutput can be stored.

Add flag to allow for value segmentation on set() in BagOStuff.
Also add a flag for immediate deletion of segments on delete().

BagOStuff now has base serialize()/unserialize() methods.

Bug: T204742
Change-Id: I0667a02612526d8ddfd91d5de48b6faa78bd1ab5
2019-06-11 16:14:17 +01:00
jenkins-bot
dfe30d5118 Merge "Refactor buildPrevNextNavigation" 2019-06-06 09:04:26 +00:00
clarakosi
4ca72763ec Refactor buildPrevNextNavigation
Refactored buildPrevNextNavigation() into standalone helper class,
PrevNextNavigationRenderer, to be used by both SpecialPages and Pagers.

Bug:T207977
Change-Id: Ic49837a451f795ec203e867961ec1c69075cc91a
2019-06-05 19:32:27 -04:00
jenkins-bot
e3705c7b17 Merge "Add action=query&meta=languageinfo API module" 2019-06-04 20:03:38 +00:00
Lucas Werkmeister
67b3cdc004 Add action=query&meta=languageinfo API module
This API module can be used to get information about all the languages
supported by this MediaWiki installation. Since parts of this
information, such as the fallback chain, are expensive to retrieve if
the localization cache is not populated, we apply continuation if the
request is taking too long (suggested by Anomie in T217239#4994301); we
don’t expect this to happen in Wikimedia production, though.

Bug: T74153
Bug: T220415
Change-Id: Ic66991cd85ed4439a47bfb1412dbe24c23bd9819
2019-06-03 12:46:03 +02:00