aboutsummaryrefslogtreecommitdiffstats
path: root/includes/block
Commit message (Collapse)AuthorAgeFilesLines
...
* rdbms: Create IReadableDatabase::andExpr() / ::orExpr()Umherirrender2024-07-111-7/+7
| | | | | | | | | | | | | | | | | | | | | Avoid the call to internal constructor of AndExpressionGroup and OrExpressionGroup by creating a factory function similiar as the IReadableDatabase::expr function for Expression objects. This is also a replacement for calls to ISQLPlatform::makeList with LIST_AND or LIST_OR argument to reduce passing sql as string to the query builders. Created two functions to allow the return type to be set for both expression group to allow further calls of ->and() or ->or() on the returned object. Depending on the length of the array argument to makeList() it is sometimes hard to see if the list gets converted to AND or OR, having the operator in the function name makes it easier to read, so two functions are helpful in this case as well. Bug: T358961 Change-Id: Ica29689cbd0b111b099bb09b20845f85ae4c3376
* Add "implements Stringable" to every class with "function __toString()"Bartosz Dziewoński2024-06-131-1/+2
| | | | | | | | | | | | | In PHP 8, but not in PHP 7.4, every class with a __toString() function implicitly implements the Stringable interface. Therefore, the behavior of checks like "instanceof Stringable" differs between these PHP versions when such classes are involved. Make every such class implement the interface so that the behavior will be consistent. The PHP 7.4 fallback for the Stringable interface is provided by symfony/polyfill-php80. Change-Id: I3f0330c2555c7d3bf99b654ed3c0b0303e257ea1
* Use RawSQLValue for some SET clauses in update/upsertUmherirrender2024-05-291-4/+5
| | | | Change-Id: I03c068c4bf098ab073989a0ea32a0f87fe878727
* Replace IDatabase::buildLike with expression builderUmherirrender2024-05-181-2/+2
| | | | | Bug: T361023 Change-Id: I0fcb61ff1b15931477bce3c8f850a8ce97405a36
* block: Deprecate and stop using $wgBlockTargetMigrationStageTim Starling2024-05-105-728/+290
| | | | | | | | | | | | | * Deprecate and stop using $wgBlockTargetMigrationStage. Remove block_target migration code. * Make the $schema parameters to DatabaseBlockStore methods default to SCHEMA_BLOCK. Avoid passing these parameters where possible. * Remove cleanupBlocks.php * Deprecate DatabaseBlock static methods which try to present the old schema for b/c. Bug: T362133 Change-Id: I845bad8cc09a4528fef46a6f9d490ebdec881d99
* block: Fix overly broad block selection in getRangeCond()Tim Starling2024-05-081-14/+19
| | | | | | | | | | | | | | | | | In the new schema, getRangeCond() with a specified range of say 1.2.0.0/16 would match blocks of narrower range with the same start, e.g. 1.2.0.0/24, because a match of bt_ip_hex was sufficient, but that is the same as the start of the range. So, when searching for single IP blocks, add a condition requiring bt_range_start IS NULL. This affects the bkip parameter to ApiQueryBlocks and searches from Special:BlockList. Add regression test. Change-Id: Ie3943befb8a02cc4939624f7bad48ae50056cd7d
* block: Fix inadequate GROUP BY in HideUserUtils::addFieldToBuilder()Tim Starling2024-05-081-11/+13
| | | | | | | | | | With the new schema and sql_mode=ONLY_FULL_GROUP_BY, we get an error from LocalIdLookup::lookupCentralIds() due to user_name not being in the GROUP BY. So, just use a subquery, identical to the one used by getExpression(). Change-Id: If22561b5ce5762a33fc8aa13ee9406990c8ae8ce
* Merge "Migrate to IReadableDatabase::newSelectQueryBuilder with queryInfo"jenkins-bot2024-05-051-24/+15
|\
| * Migrate to IReadableDatabase::newSelectQueryBuilder with queryInfoUmherirrender2024-05-041-24/+15
| | | | | | | | | | | | | | | | | | | | | | This is using SelectQueryBuilder::queryInfo to interact with legacy code In the long term this needs refactor to get a SelectQueryBuilder from the class instead of a query info array. Bug: T344971 Depends-On: I5dff80a2819bba4e923654ef31816a54269354b3 Change-Id: Ibf44e7de30e71fe8dd6447f77dfd0bf726be0a9b
* | Block: Drop AbstractBlock::getPermissionsErrorWMDE-Fisch2024-05-041-27/+0
| | | | | | | | | | Bug: T362636 Change-Id: I6ddfa089aee47451819a92eaae100c1cc8486d20
* | Block: Drop DatabaseBlock::purgeExpiredWMDE-Fisch2024-05-041-11/+0
|/ | | | | Bug: T362636 Change-Id: I85fe2ba5da844678bfeb66f84d0c406fd8f7b19c
* Stop using LoadBalancer::getConnectionRef() so it can be hard-deprecatedAmir Sarabadani2024-04-301-1/+1
| | | | | Bug: T326274 Change-Id: I90493d7cd4c21fdc022bcc19765fc04d986a9c8f
* Ignore/fix MediaWiki.Commenting.PropertyDocumentation.WrongStyleTaavi Väänänen2024-04-221-1/+1
| | | | | | | | Fix the real issues found by this sniff, and convert the remaining false positive ignores to per-line ignores so that any more real issues won't be added. Change-Id: I18e75d59df327e2d93a3a487c115e92b9f268722
* Fix some line indentUmherirrender2024-04-201-7/+7
| | | | Change-Id: I8f82724197d20f9289d80e138d80310f1eab29f2
* block: Typehint delta in DatabaseBlockStore for sql safetyUmherirrender2024-04-181-1/+1
| | | | | | | A non-typehinted argument could be a raw sql string ending in the sql statement, using typehint makes sure this is an safe integer Change-Id: I2c1eef4dd2a05b9bb1329b79749502a242804687
* Merge "Use explicit value checks where "0" is valid input"jenkins-bot2024-03-301-1/+1
|\
| * Use explicit value checks where "0" is valid inputMatěj Suchánek2024-02-221-1/+1
| | | | | | | | | | | | | | User "0", page "0" and edit summary "0" are all valid. Treating them as empty may cause subtle inconsistencies. Change-Id: I90a92bfb972cca840e5d8060dac3f116a22990db
* | Drop old class_aliases for before MW 1.39 that were missedJames D. Forrester2024-03-201-3/+0
| | | | | | | | | | | | | | The RandomPage alias was dropped in an earlier commit, so group the release note entry in with these. Change-Id: I207d7463ced1a1bb8b8ac749eba175fc0037a217
* | Standardise all our class alias deprecation comments for ease of greppingJames D. Forrester2024-03-191-3/+1
| | | | | | | | Change-Id: I7f85d931d3b79da23e87b4e5692b2e14be8fcaa0
* | block: Clarify function of HideUserUtils aliases and use them consistentlyTim Starling2024-03-191-3/+6
| | | | | | | | | | | | | | | | | | | | | | * Add a comment explaining why we need table aliases in HideUserUtils subqueries. * Use the table aliases consistently in inner field references. While this does not appear to be strictly necessary, since unprefixed fields refer to the inner query by default, it helps to improve the clarity of the code. Change-Id: Id68684ea12060a259dc87e66edd63b925da2c3b1
* | Merge "block: Fix DatabaseBlockStore::newLoad index usage"jenkins-bot2024-03-181-4/+9
|\ \
| * | block: Fix DatabaseBlockStore::newLoad index usageTim Starling2024-03-181-4/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | There's no index on bt_user_text alone, only one that is prefixed with bt_ip_hex. So include a condition on bt_ip_hex when searching for blocks by username. Bug: T360165 Change-Id: I99ed17ed66449ab7c3f76c98d90f91a75fbd8fd5
* | | Merge "block: Use a scalar subquery in HideUserUtils::getExpression"jenkins-bot2024-03-171-4/+6
|\| |
| * | block: Use a scalar subquery in HideUserUtils::getExpressionTim Starling2024-03-151-4/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | On en.wikipedia.org, MariaDB chooses to materialize the subquery, copying about 810,000 rows to a temporary table. So, use a dependent scalar subquery, which is not eligible for this "optimisation". Bug: T360163 Change-Id: I7819a6870871687ea96f92dfd3f8fe581b54cc24
* | | Use IConnectionProvider in DatabaseBlockStoreUmherirrender2024-03-142-10/+10
|/ / | | | | | | | | | | Allows to type-hint IReadableDatabase for the replica Change-Id: I7b08808c754e9570a78de03bf32deb6c7d561c9c
* | Fix autoblock updateTim Starling2024-02-281-26/+50
| | | | | | | | | | | | | | | | | | | | | | | | | | When updating an autoblock due to a reblock, use the correct reason message instead of the parent block reason. If the reblock causes the parent block to expire before the autoblock, adjust the autoblock expiry time downwards. Adapt testUpdateBlock() to be a regression test for these two bugs. Bug: T351173 Change-Id: I19843e4971106250cf9644ef68d68d6e33c6e3ab
* | block: Pass wikiId to DatabaseBlock::getId in DatabaseBlockStoreUmherirrender2024-02-221-1/+1
|/ | | | | | | For cross-wiki autoblock support Bug: T358208 Change-Id: I9396f289237769a7b5fc9e1a8c575116abaf7609
* Merge "block: Include bt_auto in acquireTarget() conditions"jenkins-bot2024-02-161-2/+6
|\
| * block: Include bt_auto in acquireTarget() conditionsTim Starling2024-02-131-2/+6
| | | | | | | | | | | | | | | | | | | | When searching for an existing block_target row to use for a new block of an IP address, include bt_auto in the conditions. Otherwise, if there is an existing autoblock, the new block will fail due to a mismatch of bt_count, leaking information about the private IP address. Bug: T357366 Change-Id: If873ca590aadd29ab0b9d672a99438d70c4292d9
* | Namespace Message, move to appropriate directoryJames D. Forrester2024-02-145-5/+5
|/ | | | | Bug: T353458 Change-Id: I088cbc53fbcdb974e5b05b45a62e91709dacc024
* block: When inserting in write-both mode, ensure the ID remains synchronisedTim Starling2024-02-131-1/+13
| | | | | | | | The block ID is exposed in various places and must be consistent between the two schemas. Bug: T357366 Change-Id: I5b104242341ebcfec8f33a904c771d61d236dca2
* DatabaseBlock: Deprecate methods relying on global stateAlexander Vorwerk2024-02-101-0/+4
| | | | Change-Id: Idf8662deeac081acd1348e729ebd7f240864f7a9
* Namespace includes/contextJames D. Forrester2024-02-081-1/+1
| | | | | Bug: T353458 Change-Id: I4dbef138fd0110c14c70214282519189d70c94fb
* DatabaseBlock: Fetch correct DatabaseBlockStoreAlexander Vorwerk2024-02-081-2/+6
| | | | | | | Bug: T284873 Bug: T291849 Bug: T291994 Change-Id: I2254e41d02ceaadff9b84e75127ca848bc920d08
* Merge "Move creation of BlockErrorFormatter into FormatterFactory"jenkins-bot2024-02-022-40/+40
|\
| * Move creation of BlockErrorFormatter into FormatterFactorydaniel2024-01-262-40/+40
| | | | | | | | | | | | | | | | The idea is that all formatters that need the user language or other request specific context should be instantiated by FormatterFactory. Change-Id: I8334cc89dcf0f293298b82e004116be50a90f0d1
* | Merge "BlockUser: parse expiries using ExpiryDef::normalizeExpiry"jenkins-bot2024-02-021-11/+5
|\ \
| * | BlockUser: parse expiries using ExpiryDef::normalizeExpiryMusikAnimal2024-02-021-11/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This should act identical to before, apart for support of expiry before unix epoch. This shouldn't be a real world use-case, rather the check for a negative expiry was for PHP 5 support when -1 was returned instead of false. Bug: T248196 Change-Id: I803c99f20844a4ccf151b454e75f7d4d128f429c
* | | Make use of the [ ... ] operator instead of array_mergethiemowmde2024-01-311-1/+1
| |/ |/| | | | | | | | | | | | | The array spread operator is documented to behave identical to array_merge. The syntax is just much shorter and easier to read in situations like this, in my opinion. Change-Id: I3b016e896e552af53d87d5e72436dc4e29070ce1
* | Merge "Allow temporary accounts to be blocked with 'hideuser' enabled"jenkins-bot2024-01-232-17/+1
|\ \
| * | Allow temporary accounts to be blocked with 'hideuser' enabledDreamy Jazz2024-01-222-17/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Why: * The ability to block temporary account usernames with 'hideuser' needs to be added so that we can hide the username of temporary accounts in the case of accidental logged out edits by editors. * This brings similar behaviour how IP addresses are hidden on WMF wikis, as the IP addresses are hidden for logged out edits using the suppression tool. Blocking the account with 'hideuser' allows all edits to be hidden plus also prevent further editing using that temporary account. What: * This reverts commit 878602ad970770a3576673f6a804effc33000076. Bug: T355430 Change-Id: I7b38d2bf0155df479a179c69c91cfe1987bd234a
* | | Change uses of getDBLoadBalancerFactory() to getConnectionProvider()Bartosz Dziewoński2024-01-221-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Update cases where one of the IConnectionProvider methods is called immediately. This doesn't really change anything, but I hope it helps promote getConnectionProvider() as the common way to do this. Follow-up to 8604c384f624273f46b653ec252ffaed30e6ff89. Change-Id: Id0e7d02bab0c570343c2b1f03c70b44ee39db112
* | | Use UserFactory::newAnonymousUmherirrender2024-01-221-2/+1
|/ / | | | | | | | | Bug: T325686 Change-Id: Ia7ce7df94c233a4534625d250229806fb21d8017
* | Merge "block: Use dbdomain to check for local in BlockUtilsFactory"jenkins-bot2024-01-181-3/+9
|\ \
| * | block: Use dbdomain to check for local in BlockUtilsFactoryUmherirrender2024-01-121-3/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | There are small different on postgres when comparing wiki id and db domain: 'postgres-unittest_' vs. 'postgres-mediawiki-unittest_' The factories for blocks - DatabaseBlockStoreFactory - BlockRestrictionStoreFactory - BlockUtilsFactory should do the same check for consistency Follow-Up: I46699071bbdbbde650061dece6b67a0c58444523 Change-Id: Idf20e7b3624c686ec87cc1d3b07baa6e9735b8ee
* | | Merge "Drop User::blockedFor() and AbstractBlock::getReason(), deprecated in ↵jenkins-bot2024-01-122-29/+0
|\ \ \ | |/ / |/| | | | | 1.35"
| * | Drop User::blockedFor() and AbstractBlock::getReason(), deprecated in 1.35James D. Forrester2023-12-112-29/+0
| | | | | | | | | | | | | | | Bug: T277511 Change-Id: I35c16f92470e65126db8961ee3599256c96ec554
* | | Merge "Don't allow passing a db to DatabaseBlockStore::insertBlock"jenkins-bot2024-01-122-45/+14
|\ \ \
| * | | Don't allow passing a db to DatabaseBlockStore::insertBlockAlexander Vorwerk2024-01-012-45/+14
| | | | | | | | | | | | | | | | | | | | Bug: T291849 Change-Id: I5f5cec791eb2999d7295440248f74fba79156b6f
* | | | Merge "DatabaseBlockStore: Fix type of $expectedTargetCount in doc"jenkins-bot2024-01-121-2/+2
|\| | |