Commit graph

9777 commits

Author SHA1 Message Date
Func
53afd761b0 tests: Make sure deferred updates are done and re-enable TemplateCategoriesTest
LinksUpdate is a group of deferrable updates, not jobs till now.
See HtmlCacheUpdater::purgeTitleUrls().

Bug: T165099
Change-Id: Icf40c4ff9e14ee06d48600bcbfdc39e2baf68b23
2022-03-17 13:01:08 +00:00
Aaron Schulz
eed58f2f61 rdbms: fix owner id and RELEASE_ALL_LOCKS query in session flushing methods
Use the LoadBalancer id in flushPrimarySessions(), not the LBFactory one,
and use assertOwnership() to check $owner, similar to other methods.

In DatabaseMysqlBase::doFlushSession(), change RELEASE_ALL_LOCKS() query
to use RELEASE_LOCK(), since only newer MariaDB versions (>=10.5.2) support
it. No errors were thrown in the method since they are suppressed, but the
syntax error would cause the transaction to be placed in an error state.

Add assertion to testTransactionCallbackChains() that would otherwise fail.

Randomize lock names in lock() tests to avoid contention.

Bug: T292239
Bug: T303887
Follow-Up: ee3c65d541
Follow-Up: 4cac31de4e
Change-Id: I414d737028338cfd5369eee24576df4aa26a2f6f
2022-03-17 02:55:43 +00:00
daniel
e239b02a5e Add convenience methods for asserting status.
This ensures that assertions work in a uniform way,
and provides meaningful messages in cause of failure.

Change-Id: Ic01715b9a55444d3df6b5d4097e78cb8ac082b3e
2022-03-16 22:44:25 +01:00
jenkins-bot
5ec380a8f6 Merge "Integration test for extension registration" 2022-03-16 17:05:36 +00:00
Alexander Vorwerk
006c5a1314 Hard deprecate PageProps::getInstance()
No usages in Wikimedia-deployed extensions left.

Bug: T289544
Change-Id: Ia94a913d9b406c8a74ef41a82f502ebf0205667c
2022-03-15 22:58:48 +01:00
jenkins-bot
f426a261ff Merge "rdbms: Remove deprecated IDatabase functions" 2022-03-15 20:28:56 +00:00
Amir Sarabadani
46374a8e3e rdbms: Remove deprecated IDatabase functions
Soft-deprecated in 1.37, hard-deprecated in 1.38

Bug: T286694
Change-Id: Icd23271149bba3e4632d595c057a733d13707503
2022-03-15 19:33:32 +01:00
Umherirrender
e1900f228c tests: Remove unused mock of getLazyConnectionRef
Follow-Up: I82683596d644bb61a109e79dde6b0cb22c72b399
Change-Id: I20641dbfe6e3c98331c1a732781e761ceccc46f6
2022-03-15 19:08:12 +01:00
Clare Ming
47612020b5 Add option to amend robots meta tag
- Add private var, helper methods to format and set robots options.
- Add reference to new method in OutputPage::getHeadLinksArray().

Bug: T301584
Change-Id: I2652f20c9fe5f2d3e28e329d4eddc2a2ff88cf76
2022-03-14 23:03:41 +00:00
jenkins-bot
6fd4c95f5e Merge "Use updated ObjectFactory namespace" 2022-03-12 00:19:53 +00:00
jenkins-bot
f747241182 Merge "Remove &$references from $wgAutopromote in DefaultSettings" 2022-03-11 22:33:28 +00:00
daniel
1c7ffcd46a Integration test for extension registration
This adds full integration tests for extension registration, ensuring
that ExtensionProcessor and ExtensionRegistry work together as expected.

The existing tests for ExtensionProcessor and ExtensionRegistry are
converted to "pure" unit tests.

This change is intended to protect against bugs while refactoring
ExtensionProcessor and ExtensionRegistry to better integrate with the
new SettingsBuilder class.

Bug: T297166
Change-Id: I2d9cc373b8a4aa014aef93b0a8e8d83758851783
2022-03-11 21:43:41 +00:00
jenkins-bot
2d1734a291 Merge "MovePage: Propagate information about a new redirect using Status" 2022-03-11 21:40:11 +00:00
daniel
b0cbb9b8ba Remove &$references from $wgAutopromote in DefaultSettings
If we want to convert DefaultSettings to a schema, we can't use variable
references.

Change-Id: Ia53cf45f7f029e1ba4191324005fef25055d5296
2022-03-11 21:38:27 +00:00
jenkins-bot
801428d347 Merge "Tests: expected value goes first in PHPUnit assertions" 2022-03-10 20:55:22 +00:00
Jon Robson
9bd3af32fc Update installer to reflect modern logos
There are now 4 types of logos, only one of which is needed.
Update documentation in installer to reflect this.
Also make it possible to drag and drop files into the installer
and see live previews of what the logos will look like to aid
setup.

The 1x is no longer required.

Bug: T255913
Change-Id: I58226ae8fb02c32d2eeea65a50aaabbc193cb51c
2022-03-10 16:48:39 +00:00
jenkins-bot
f55817d497 Merge "Allow ContentHandler to "override" non-existent actions" 2022-03-10 03:08:09 +00:00
jenkins-bot
b9b75d9613 Merge "rdbms: make automatic connection recovery apply to more cases" 2022-03-10 00:08:35 +00:00
Alexander Vorwerk
9b09bf3112 Use updated ObjectFactory namespace
Depends-On: I99c5e5664d2401c36a9890f148eba7c25e6e8324
Depends-On: I48ab818b2965da14af15ef370aa83ad9455badd9
Depends-On: I018371e4b77911e56152ca7b2df734afc73f58a5
Change-Id: I04ebdb52102f6191d49a9cc70b1f98308299e72f
2022-03-09 23:04:51 +00:00
jenkins-bot
65ba7e2560 Merge "Allow the user to set a default number of search results" 2022-03-09 20:13:45 +00:00
jenkins-bot
5ce113a799 Merge "title: Restore boolean false Title::getTouched() for nonexistent page" 2022-03-09 15:16:34 +00:00
jenkins-bot
4acd28a17c Merge "rdbms: Hard-deprecate LoadBalancer::getLazyConnectionRef" 2022-03-09 15:14:53 +00:00
daniel
00c489cd18 title: Restore boolean false Title::getTouched() for nonexistent page
Feeding the return value of the DB query through timstamp conversion
made it so that false was turned into the current timestamp, causing
confusion and cache churn.

Bug: T298520
Change-Id: I6e10b21f6b0e40ce7e3403ffc9a41a307e945354
2022-03-09 14:56:23 +00:00
Matěj Suchánek
b1de103176 MovePage: Propagate information about a new redirect using Status
Instead of relying on the source page existence.

Also clean the integration test up a bit and avoid
passing null where string is expected.

Bug: T47348
Change-Id: I15ef9fcedb4b3f5ecc253095e07ceaffe9630b17
2022-03-09 11:15:09 +01:00
Amir Sarabadani
49a9d44b18 rdbms: Hard-deprecate LoadBalancer::getLazyConnectionRef
All deployed usages have been migrated.

Bug: T255493
Change-Id: I82683596d644bb61a109e79dde6b0cb22c72b399
2022-03-09 10:45:00 +01:00
Aaron Schulz
4cac31de4e rdbms: make automatic connection recovery apply to more cases
Rename canRecoverFromDisconnect() in order to better describe
its function. Make it use the transaction ID and query walltime
as arguments and return an ERR_* class constant instead of a bool.
Avoid retries of slow queries that yield lost connection errors.

Add methods and class constants to track session state errors
caused by the loss of named locks or temp tables. Such errors can
be resolved by a "session flush" method.

Make assertQueryIsCurrentlyAllowed() better distinguish ROLLBACK
queries from ROLLBACK TO SAVEPOINT queries. For some scenarios,
only full tranasction ROLLBACK queries should be allowed.

Add flushSession() method to Database and flushPrimarySessions()
methods to LBFactory/LoadBalancer.

Also:
* Rename wasKnownStatementRollbackError() and make it take the
  error number as an argument, similar to wasConnectionError().
  Add mysql error codes for query timeouts since they only cause
  statement rollbacks.
* Rename wasConnectionError() and mark it as protected. This is an
  internal method with no outside callers.
* Rename wasQueryTimeout(), remove some HHVM-specific code, and
  simplify the arguments.
* Make executeQuery() use a for loop for the query retry logic
  to reduce code duplication.
* Move the error state setting logic in executeQueryAttempt() up
  in order to reduce code duplication.
* Move the beginIfImplied() call in executeQueryAttempt() up to the
  retry loop in executeQuery(). This narrows the executeQueryAttempt()
  concerns to sending a single query and updating tracking fields.
* Make closeConnection() and doHandleSessionLossPreconnect() in
  DatabaseSqlite more consistent with the base class by releasing named locks.
* Mark trxStatus() as @internal.

Bug: T281451
Bug: T293859
Change-Id: I200f90e413b8a725828745f81925b54985c72180
2022-03-09 15:49:38 +11:00
Timo Tijhof
f8ecea1e5c rcfeed: Deprecate $wgRCEngines and RCFeedEngine
Follows-up 39a6e3dc4d (I8be497c623c5d92).

* Improve documentation all around and advertise 'class'
  everywhere instead of 'uri'.

* Add test coverage for RCFeed::factory().

* Deprecate the $wgRCEngines "uri to class" mapping in favour
  of specifying "class" directly in $wgRCFeeds.

* Deprecate RCFeedEngine in favour of FormattedRCFeed.
  Convert to class_alias so that UDPRCFeedEngine no longer has
  to extend the deprecated class name explicitly (for instanceof compat).

* Hard-deprecate RecentChange::getEngine.

Bug: T250628
Depends-On: Ie939e1d06b9ee2d841ec7256c8d24cc4e7e386dd
Change-Id: Ib6758d724c7200404c89c7ab157aa55f1cad9763
2022-03-08 19:50:19 +00:00
jenkins-bot
c268687d46 Merge "Hard deprecate Sanitizer::removeHTMLtags()" 2022-03-08 19:29:55 +00:00
jenkins-bot
277453fe78 Merge "Define MW_INSTALL_PATH constant and BaseDirectory config." 2022-03-08 17:44:09 +00:00
jenkins-bot
d1cfc0317d Merge "Add explicit casts between scalar types" 2022-03-08 17:32:26 +00:00
Umherirrender
6ea3d6ac2c Add explicit casts between scalar types
php internal functions like floor/round/ceil documented to return
float, most cases the result is used as int, added casts

Found by phan strict checks

Change-Id: I92daeb0f7be8a0566fd9258f66ed3aced9a7b792
2022-03-08 16:59:01 +00:00
jenkins-bot
9196a0e6ab Merge "Fix User::getRealName() test" 2022-03-08 12:08:10 +00:00
Tim Starling
b6c3bf46dc Fix User::getRealName() test
Make it do what the assertion message says

Change-Id: If63b8e664d0361a028cd1d47d614b475463b74cd
2022-03-08 20:02:14 +11:00
Tim Starling
1ae3b0ca86 Allow ContentHandler to "override" non-existent actions
Flow defines a lot of custom actions which are only implemented for its
own content type. This use case is not what we had in mind when
getActionOverrides() was introduced, but allowing it in ActionFactory
removes the need for Flow to write dummy ignored config to $wgActions.

Bug: T303237
Change-Id: I67c1ae95344b0004eb93023fae7e93de4e47888b
2022-03-08 14:17:22 +11:00
C. Scott Ananian
d6576e5dc6 Hard deprecate Sanitizer::removeHTMLtags()
Rename Sanitizer::removeHTMLtags() into an @internal method named
::internalRemoveHtmlTags() so that we can deprecate external use.

Code search:
https://codesearch.wmcloud.org/deployed/?q=removeHTMLtags&i=nope&files=&excludeFiles=&repos=

Followup-To: Ic864c01471c292f11799c4fbdac4d7d30b8bc50f
Depends-On: Iaca83ed06e9c61d8366579cd2283cba653c82319
Depends-On: I1963bfe9a99198ea02ca482a5769467ce806cd58
Depends-On: I83923d8b38d33f3638cd53958dd10f257ec21f7c
Depends-On: I018b34bb5f6e113056da9b04cc72d4318422adce
Change-Id: I202826f8b27519f7be89643e24eda47a6e3fc9f6
2022-03-07 22:04:56 -05:00
Bartosz Dziewoński
ba96351f46 Only apply transformations for &uselang=qqx when actually using it
Depends-On: I4f3b01eccf571475f1248db838a8aa6cba18b93e
Depends-On: I0a0681b332abb623fc6871ab78da9e64a79fad84
Bug: T300069
Bug: T302469
Change-Id: I45f58034117e9041fe5403dbfcf83ba25f20518d
2022-03-08 01:50:44 +00:00
Bartosz Dziewoński
04b9dd6b2f Re-apply "Show message fallback keys when using &uselang=qqx"
This affects messages created using wfMessageFallback() and related
functions, in particular many messages used for navigation tabs in
skins.

Previous attempt in 11d7d97768,
reverted in c83b530f95 due to T302469.

This attempt doesn't introduce any new placeholders to avoid that
issue.

Bug: T300069
Change-Id: Ib0e282b3864caf345e42dd7af4a529f43ae7ba67
2022-03-08 00:56:12 +00:00
jenkins-bot
5bfdcba924 Merge "tests: Avoid unsafe use of setUpBeforeClass() in ApiFormatXmlTest" 2022-03-07 22:25:04 +00:00
Aaron Schulz
5c3547a5bb tests: Avoid unsafe use of setUpBeforeClass() in ApiFormatXmlTest
This avoids "Can't create user on real database" errors that can
occur if the order of test classes changes.

Bug: T50217
Change-Id: Iccd6a2d4f207d2a9ddf62544b3a24a9db15bda55
2022-03-07 21:59:49 +00:00
Aaron Schulz
3960005202 ApiQuerySiteinfoTest: Don't access MW services in dataProvider
Bug: T297292
Change-Id: Ib310b83d26f2badb628965c62f7ca4caf1414e5b
2022-03-07 21:57:59 +00:00
jenkins-bot
fd2c1795a9 Merge "Add Sanitizer::removeSomeTags() which uses Remex to tokenize" 2022-03-06 08:35:40 +00:00
C. Scott Ananian
9f14fbd002 Add Sanitizer::removeSomeTags() which uses Remex to tokenize
The existing Sanitizer::removeHTMLtags() method, in addition to having
dodgy capitalization, uses regular expressions to parse the HTML.
That produces corner cases like T298401 and T67747 and is not guaranteed
to yield balanced or well-formed HTML.

Instead, introduce and use a new Sanitizer::removeSomeTags() method
which is guaranteed to always return balanced and well-formed HTML.

Note that Sanitizer::removeHTMLtags()/::removeSomeTags() take a callback
argument which (as far as I can tell) is never used outside core. Mark
that argument as @internal, and clean up the version used by
::removeSomeTags().

Use the new ::removeSomeTags() method in the two places where
DISPLAYTITLE is handled (following up on T67747).  The use by the
legacy parser is more difficult to replace (and would have a
performace cost), so leave the old ::removeHTMLtags() method in place
for that call site for now: when the legacy parser is replaced by
Parsoid the need for the old ::removeHTMLtags() will go away.  In a
follow-up patch we'll rename ::removeHTMLtags() and mark it @internal
so that we can deprecate ::removeHTMLtags() for external use.

Some benchmarking code added.  On my machine, with PHP 7.4, the new
method tidies short 30-character title strings at a rate of about
6764/s while the tidy-based method being replaced here managed 6384/s.
Sanitizer::removeHTMLtags blazes through short strings 20x faster
(120,915/s); some of this difference is due to the set up cost of
creating the tag whitelist and the Remex pipeline, so further
optimizations could doubtless be done if Sanitizer::removeSomeTags()
is more widely used.

Bug: T299722
Bug: T67747
Change-Id: Ic864c01471c292f11799c4fbdac4d7d30b8bc50f
2022-03-04 14:06:02 -05:00
DannyS712
3443f1e7b5 Tests: expected value goes first in PHPUnit assertions
Change-Id: I74b6d0175c2d83e403f339bdb9a557b806813ab6
2022-03-04 18:48:06 +00:00
daniel
cf581bb2ca Define MW_INSTALL_PATH constant and BaseDirectory config.
Application logic should use the BaseDirectory config variable.
Framework code should use MW_INSTALL_PATH to locate files should.

NOTE: Update https://www.mediawiki.org/wiki/Manual:$IP

Bug: T300301
Depends-On: I7142af16d692f26e90673b058029f572c1ea3991
Change-Id: Ib4caa80bb7007c4c7960a2fd370cf5da7d9ba344
2022-03-04 14:18:27 +01:00
Matěj Suchánek
aa22212ad8 Handle null in ChangeTags::modifyDisplayQuery
Some callers (notably HistoryPager) would also provide null
prior to 79577c79. This caused page history to disappear.
Cover all these special inputs with a regression test.

Bug: T303033
Change-Id: I29e885107fc4a5b090226d8161ce823157268bf0
2022-03-04 11:12:14 +01:00
jenkins-bot
e382603a60 Merge "changetags: Fix management of a '0' tag" 2022-03-03 22:40:54 +00:00
Matěj Suchánek
79577c79ff changetags: Fix management of a '0' tag
The tag wouldn't be treated as active, wouldn't be displayed
in changes lists and it wouldn't be possible to filter it,
although it was possible to create it.

The changes in ::modifyDisplayQuery are needed, because
ContribsPager may provide false.

Add a regression test for ::formatSummaryRow.

Bug: T296642
Change-Id: Iddb1e978387a0009425f6fad1821d9d15c0f5f23
2022-03-03 22:24:01 +00:00
jenkins-bot
ccaeb83680 Merge "Use HTTP 404 for BadTitleErrors instead of HTTP 400" 2022-03-02 19:35:37 +00:00
jenkins-bot
e16f857eae Merge "linker: Start of LinkTargetStore" 2022-03-02 15:12:58 +00:00
Amir Sarabadani
12e8e3b721 linker: Start of LinkTargetStore
Bug: T299419
Change-Id: I80e17fc77a4558c508a57dfa23e01fd5a11124e4
2022-03-02 14:56:30 +00:00