Commit graph

1069 commits

Author SHA1 Message Date
jenkins-bot
b21453f61d Merge "widgets: Split out SearchWidgets into their own tree" 2020-02-15 00:20:08 +00:00
Aaron Schulz
5282a02961 resourceloader: support tracking indirect module dependency paths via BagOStuff
This can be enabled via a configuration flag. Otherwise, SqlModuleDependencyStore
will be used in order to keep using the module_deps table.

Create a dependency store class, wrapping BagOStuff, that stores known module
dependencies. Inject it into ResourceLoader and inject the path lists into
ResourceLoaderModule directly and via callback.

Bug: T113916
Change-Id: I6da55e78d5554e30e5df6b4bc45d84817f5bea15
2020-02-13 17:26:36 +00:00
jenkins-bot
c3f20ad3f7 Merge "Add SelectQueryBuilder" 2020-02-13 00:04:11 +00:00
James D. Forrester
3a9a542e1d widgets: Split out SearchWidgets into their own tree
Expecting people to magically know that MediaWiki\Widget\SearchInputWidget is
generic and for use on random pages, but MediaWiki\Widget\SearchResultWidget
is super-specialised, based on bespoke technologies, and only for use on
Special:Search, is not great.

None of these are used outside the MediaWiki core codebase and so this change
whilst it would otherwise be technically breaking is fine.

Change-Id: I16d21dd5e1ac3aa9893863df272d1bbb4788066f
2020-02-11 14:37:27 -08:00
Peter Ovchyn
f136c2953c languages: More doc annotations for LanguageConverter related classes
Deprecated LinkHolderArray for public usage

Bug: T244709
Change-Id: Ic5b9e9237044b56cbb64e7c762f5d2de3b1de821
2020-02-11 17:32:12 +02:00
Tim Starling
d06a3e049b Add SelectQueryBuilder
Add a query builder class which encapsulates the parameters to
IDatabase::select() and related functions.

Override useIndexClause() and ignoreIndexClause() in DatabaseTestHelper
so that index hints can be tested.

Bug: T243051
Change-Id: I58eec4eeb23bd7fb05b8b77d0a748f1026afee52
2020-02-07 10:10:17 +11:00
ArtBaltai
30e54b3962 Introduce ContentHandlerFactory
Added:
- ContentHandlerFactory
Tests:
- PHPUnit
Changed
- Calls of changed and deprecated
- DI for some service/api
Deprecated:
- ContentHandler::* then similar to ContentHandlerFactory
- ContentHandler::getForTitle
- ContentHandler::$handlers

Bug: T235165
Change-Id: I59246938c7ad7b3e70e46c9e698708ef9bc672c6
2020-02-07 00:53:51 +03:00
Brad Jorsch
c2b1525908 API: Use ParamValidator library
This brings significant modularization to the Action API's parameter
validation, and allows the Action API and MW REST API to share
validation code.

Note there are several changes in this patch that may affect other code;
see the entries in RELEASE-NOTES-1.35 for details.

Bug: T142080
Bug: T232672
Bug: T21195
Bug: T34675
Bug: T154774
Change-Id: I1462edc1701278760fa695308007006868b249fc
Depends-On: I10011be060fe6d27c7527312ad41218786b3f40d
2020-02-04 13:36:14 -05:00
Peter Ovchyn
863a1d5bdd languages: Move Converter and tests to respective files
Bug: T226833, T243760
Change-Id: I6fc7f267098d663fbefd0e78457726c343c9b3e4
2020-02-03 15:31:08 +02:00
Peter Ovchyn
61e0908fa2 languages: Introduce LanguageConverterFactory
Done:
* Replace LanguageConverter::newConverter by LanguageConverterFactory::getLanguageConverter
* Remove LanguageConverter::newConverter from all subclasses
* Add LanguageConverterFactory integration tests which covers all languages by their code.
* Caching of LanguageConverters in factory
* Make all tests running (hope that's would be enough)
* Uncomment  the deprecated functions.
* Rename FakeConverter to TrivialLanguageConverter
* Create ILanguageConverter to have shared ancestor
* Make the LanguageConverter class abstract.
* Create table with mapping between lang code and converter instead of using name convention
* ILanguageConverter @internal
* Clean up code

Change-Id: I0e4d77de0f44e18c19956a1ffd69d30e63cf51bf
Bug: T226833, T243332
2020-02-03 11:38:03 +02:00
Aaron Schulz
758e980427 objectcache: remove APCBagOStuff class
apcu comes with PHP 5.5+ and the minimum version for MediaWiki is 7.2

Change-Id: I69a988c6c2999766a3c7e56b841cd4f4091b4d95
2020-01-29 17:27:47 +00:00
C. Scott Ananian
5cbb64f56a Remove Preprocessor_DOM, deprecated in 1.34
Remove the deprecated Preprocessor_DOM class, which was hard-deprecated
in 1.34.  This begins to simplify parser configuration and reduce redundant
code paths, but I've left two things for cleanup in a future patch:

1. The `preprocessorClass` configuration option to the parser, exposed
in `$wgParserConf`, ServiceWiring, ParserFactory, etc.  There is no reason
for this to be exposed as configurable, but I've left this clean up to a
future patch.

2. The `$wgMaxGeneratedPPNodeCount` configuration, exposed also in
ParserOptions.  Only Preprocessor_DOM calculated this count, and since
we are only using Preprocessor_Hash now, this configuration has no effect.
But since this value was exposed in ParserOptions and elsewhere, I've
deprecated where needed but left this clean up to a future patch.

Bug: T204945
Change-Id: I727f003f9a42d0c92bcbcce8a8289d5af6cd1298
2020-01-25 11:22:45 -05:00
Bill Pirkle
512b0b08d9 Add core REST API endpoint for media links
Add an endpoint to the core REST API to return the list of
media files embedded in a page, including certain metadata
for each media file.

Bug: T236169
Change-Id: I3188848ee7de365d209dfb7da5b885313e9f705b
2020-01-22 15:10:44 -06:00
Reedy
ec5b793fd0 Remove 1.33 aliases from libs/services
Change-Id: Ib120d58194662c3fa05784736eb5c82d7892777d
2020-01-09 21:37:29 +00:00
mainframe98
297a89069a Add LinkBatchFactory to inject services into LinkBatch
All services required by LinkBatch are now injected by the
LinkBatchFactory. The constructor for LinkBatch has been
soft-deprecated, but the required services are still optional.

Bug: T239855
Depends-On: If49cbb730d4ac48586b891908cf24601efbc5d6a
Change-Id: I93d931ab60305ad49a6e419f8269c77791a3938d
2020-01-06 17:02:31 +01:00
DannyS712
f6417508c2 Remove FileBasedSiteLookup class, deprecated and unused
Bug: T241356
Change-Id: I252904b6b4c31a0ac42cbfbe7875a23c727150c1
2020-01-03 23:59:16 +00:00
jenkins-bot
74aee4ed08 Merge "Use wikimedia/ip-utils 1.0.0 to replace IP class" 2020-01-01 23:55:38 +00:00
James D. Forrester
610954eda6 Use wikimedia/ip-utils 1.0.0 to replace IP class
Adjust use in ApiBase.

Depends-On: I9a172b2bd922c3a62248545906bd9bdfcac03a43
Change-Id: Ie5485b1df9f3886add943ddcf8b0824e87a7f3e4
2020-01-01 02:29:11 -08:00
TheSandDoctor
01b9bfd5ae Remove MWMessagePack
MWMessagePack has been removed.

Bug: T241220
Change-Id: I1e1823c3b42022d6b045b8d33bebb1be7da95631
2019-12-30 00:00:39 -08:00
Timo Tijhof
8373f51cb0 benchmarks: Exclude from PHPUnit test coverage
Also move Benchmarker.php to maintenance/includes/ because
that file is not itself a benchmark, and that base class is
actually covered by tests and should remain included.

Change-Id: I4acd88242dde56a884d319dfc141a3511a8221a3
2019-12-18 01:24:42 +00:00
jenkins-bot
808c737df6 Merge "Create abstract special page SpecialRedirectWithAction, and use it." 2019-12-02 17:59:36 +00:00
Tim Starling
164a3ac1f0 Remove IE 6 security features from server-side code
* Deprecate WebRequest::checkUrlExtension() and have it always return
  true. This reverts the security fixes made for T30235.
* Remove IEUrlExtension. This is a helper for checkUrlExtension() which
  is not used in any extensions.
* Remove CSS sanitization code which is specific to IE6. This reverts
  the changes made to fix T57332, and related followups. I confirmed
  that the relevant test cases do not result in XSS on IE8.
* Remove related tests.

Bug: T232563
Change-Id: I7318ea4a63210252ebc64968691d4f62d79a63e9
2019-11-28 15:11:56 +11:00
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
Max Semenik
ee1af9bc72 Rewrite cdb.php to use Maintenance
Change-Id: Ia3fbfbe2e89401d867f457b89a19bebdced5dd3a
2019-11-11 20:17:40 -08:00
Amir Sarabadani
30c4b22d4e Start of DoctrineSchemaBuilder
This allows us to abstract away schemas into one json file.

Bug: T230419
Change-Id: Ic8a658c97150e4c248bdbc9a5cf5d947b8c71036
2019-11-09 21:32:32 +00:00
jenkins-bot
5e27e79c6d Merge "Add renameRestrictions.php maintenance script" 2019-11-08 15:41:58 +00:00
Max Semenik
38a9f0a42a Add a maintenance script to delete a change tag
Based on Ib8b96b8460db3832e9297a07922ee1d9d1af5ccb by Legoktm.

Bug: T75181
Change-Id: I0e61dfbc72fe27efa9c1deabc928e7c9af66e1bc
2019-11-07 16:57:51 -08:00
Martin Urbanec
25d1f724a6 Add renameRestrictions.php maintenance script
Bug: T237194
Change-Id: I64a54980c3ef00d345a180dff10d8ffa917916bd
2019-11-07 22:29:25 +01:00
Timo Tijhof
0da1ecfd89 profiler: Remove ProfilerOutputDb and profileinfo.php entry point
Bug: T231366
Change-Id: I211c8192200d9af00914f9847608a6daf2898f91
2019-11-06 15:28:00 -05:00
Max Semenik
93a27f83f9 Remove PhpXmlBugTester
This bug was fixed over 10 years ago and is impossible to encounter
on modern libxml versions. While libxml versions might vary slightly
for the same PHP version depending on how it's built, this gives a
general idea:

https://3v4l.org/Tk27c

Change-Id: I669abb3543180e6edd090297fcfcb811aa833b57
2019-10-31 00:44:40 +00:00
Ed Sanders
e20a6e516a Move deflate method to MW util and deprecate EasyDeflate module
This will allow us to easily change the deflate library in future.

Rename the PHP class and i18n to just "Deflate".

Bug: T236210
Change-Id: I88dea5e82a7f672e36556c40b151ac00ff3d044e
2019-10-30 15:03:41 +00:00
Aryeh Gregor
e787246ce8 LanguageFactory to replace Language::factory()
Languages with variants no longer can override the parent's constructor
(which is now used for injecting services). Instead, they need to
override Language::newConverter().

Bug: T201405
Change-Id: I923400d61763cf1db88cb0c3f684c9c10e58032d
2019-10-23 10:48:23 -07:00
jenkins-bot
0915ac1713 Merge "Add TitleFactory" 2019-10-21 18:02:41 +00:00
jenkins-bot
abfea4c7ff Merge "Add faux SearchResult and SearchResultSet" 2019-10-21 09:37:50 +00:00
Gergő Tisza
95586dd937
Add TitleFactory
Makes it possible to mock static Title methods in tests, where
they are one of the more common reasons for not being able to
use MediaWikiUnitTestCase.

Actually introducing dependency injection to Title is left for
the future.

Change-Id: I959ba87f8e283da9549b6bfcefd338e60b00be8f
2019-10-18 00:00:46 +02:00
Aryeh Gregor
8c4f59db64 New LanguageFallback service
This replaces the static Language methods getFallbackFor(),
getFallbacksFor(), and getFallbacksIncludingSiteLanguage(). There is
100% unit and integration test coverage for the new class.

One deliberate functional change: I changed one place where we threw
MWException to InvalidArgumentException.

Bug: T201405
Depends-On: Ie7a89f6ed7d52a0bc01672019ff92e7ee105a1f3
Change-Id: I49222eb55f1feec5b1dcd40f364cffe0c8801855
2019-10-08 15:11:39 -07:00
Aryeh Gregor
6d80b6c082 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.

This was previously committed as 2e52f48c2e and reverted because it
depended on e4468a1d6b, which had to be reverted for performance
issues. There should be no changes other than rebasing.

Bug: T201405
Change-Id: Ifa346c8a92bf1eb57dc5e79458b32b7b26f1ee8a
2019-10-07 15:20:52 -07:00
Gergő Tisza
c296cf69b4
Add faux SearchResult and SearchResultSet
The use case is code that uses search internally, but wants to allow
a development setup where search is proxied via some public API and
the actual querying is performed on a production server, instead of
having to set up all the search services + staging content locally.

Also fix a small logic error in SearchResultSet::shrink.

Change-Id: I83931c1a19c1cb747380e17a4aff3b1fadd5fcf3
2019-10-07 16:35:58 +02:00
James D. Forrester
52ed3261d9 HHVM removal: Drop HHVM code for maintenance/
Change-Id: Id713c523caacdf829d107f6d7473fe22ed9c75d6
2019-10-02 17:06:56 -07:00
Petr Pchelko
854b044ab7 Remove Revision::getRevisionText and gated pre-MCR schema access
- fixT22757.php appears to have been written for T22757 which has been
resolved, I assume it can be removed.

- compressOld.php - rev_text_id access is gated on MCRSchemaMigrationStage
READ_OLD. IT's safe to use the old_text and old_flags directly as we
select for them. Also the query ensures external blobs are not selected,
so we can use decompressData instead of Revision::getRevisionText.
Tested locally.

- recompressTracked.php uses a temporary table for tracking the blobs.
Table is populated by trackBlobs which explicitly queries for old_id,
so using it directly in recompressTracked is ok.
Tested locally.

- checkStorage.php the affected code attempts to fix broken revisions
from a dump, however, it looks like it doesn't work - the code expects
revision IDs as input, however it receives an array of text table old_id
values. Untested.

Bug: T198343
Change-Id: I753019565c15d270c831c995c07c7f1aad887cb6
2019-09-27 09:40:02 -07: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