When using $wgPutIPinRC the ip from rc_ip is used, which is stored as
::1, but blocks working with 0:0:0:0:0:0:0:1, so parse the ip with the
BlockUtils::parseBlockTarget and use that value.
Also reject possible invalid types, as this is a public function and may
called with something not wanted.
The ip given via User::spreadAnyEditBlock is also ::1 and the autoblock
would be inserted, when also a regular ip block exists against ::1
Change-Id: I9c1f429a7b0ff9b2274b72c46bf850d9db9492cd
When placing an autoblock we check wether the ip is already blocked by a
user or through another autoblock. In the second case we just reset the
expiry. In the first case we simply do nothing.
The problem here is that DatabaseBlock::newFromTarget(), which is used
here, is not cross-wiki compatible, so the correct blocks will not be
loaded here if the parent block is a cross-wiki block.
So, unfortunately, we have to manually implement the query here so that
the correct blocks are loaded.
Bug: T281972
Bug: T284873
Change-Id: Ia90e3578f7c103c40e88f3b68ddcba4a13734d80
Instead of passing a custom database to DatabaseBlockStore::instertBlock
callers should rather just fetch a correct DatabaseBlockStore
using the new DatabaseBlockStoreFactory service.
Bug: T291849
Change-Id: Ia1319f35bbc5bd786d1d96d330f94255d7b3582a
The Hooks class contains deprecated functions and the whole class is
going to get removed, so remove the convenience function and inline the
code.
Bug: T335536
Change-Id: I8ef3468a64a0199996f26ef293543fcacdf2797f
The DatabaseBlockStoreFactory is a new service which allows fetching
of a wiki-specific DatabaseBlockStore by fetching the correct
LoadBalancer via a LBFactory and then injecting it into the
DatabaseBlockStore. It also creates a wiki-specific ReadOnlyMode
and BlockRestrictionStore, which are also being injected.
This is being done as a part of the project of supporting cross-wiki
blocking.
The future plan is that BlockUser and UnblockUser are being updated to
properly support creating, updating and deleting cross-wiki blocks.
BlockUser and UnblockUser are then going to use a newly injected
DatabaseBlockStoreFactory to fetch the correct DatabaseBlockStore to
then insert/update/remove the block into/from the correct database.
Bug: T291849
Change-Id: I1051beedfd67c4e2c546b9eec04b6d592d969af3
Also, added a parameters to XmlDumpWriter so that they could be
inject via WikiExporter.
Bug: T325475
Change-Id: I84b82506509e2c09dad0691af2df958a5af5b5b0
so that extensions (i.e. CheckUser) can implement their own comment
store without having a lot of code duplication
basically the comment store version of I3a6486532f2ef36
Bug: T233004
Change-Id: Ib40f99e00a514d41776ce521baf113e46d37e9cd
The motivation is to make the code less confusing. I hope this is the
case.
?? is an older PHP 7.0 feature.
??= was added in PHP 7.4, which we can finally use.
Change-Id: Id807affa52bd1151a74c064623b41d950a389560
This patch only adds and removes suppressions, which must be done in the
same patch as the version bump.
Bug: T298571
Change-Id: I4044d4d9ce82b3dae7ba0af85bf04f22cb1dd347
AbstractBlock::setTarget() will fatal if the wiki of the target
doesn't match the wiki of the block.
Bug: T281972
Bug: T284873
Change-Id: Ie696bb6442abd039635ed58439c065a1eb2d1b4f
Now largely automated:
VARS=$(grep -o "'[A-Za-z0-9_]*'" includes/MainConfigNames.php | \
tr "\n" '|' | sed "s/|$/\n/;s/'//g")
sed -i -E "s/'($VARS)'/MainConfigNames::\1/g" \
$(grep -ERIl "'($VARS)'" includes/)
Then git add -p with lots of error-prone manual checking. Then
semi-manually add all the necessary "use" lines:
vim $(grep -L 'use MediaWiki\\MainConfigNames;' \
$(git diff --cached --name-only --diff-filter=M HEAD^))
I didn't bother fixing lines that were over 100 characters unless they
were over 120 and triggered phpcs.
Bug: T305805
Change-Id: I74e0ab511abecb276717ad4276a124760a268147
We really don't need this complexity and it prevents us from improving
connection management.
MaintainableDatabase should stay but the connection ref shouldn't.
Bug: T255493
Change-Id: I867301dc7fa07cac298f8faba9cf82ca4617f50e
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
Currently an autoblock is always inserted into the database of
the local wiki, even if the block is a cross-wiki one. This is
also the one of the issues that caused T281972.
In combination with Icdf9e4f37c3bfa568c712bebceccf9cc46db2ec8
this is going to fix the wrongly performed autoblocks by the
CheckUser extension.
I1051beedfd67c4e2c546b9eec04b6d592d969af3 is still a more clean
solution that this, but since that patch is blocked on T292375,
which is probably not going to be resolved in the near future,
this patch is chosen as a temporary solution.
Bug: T281972
Bug: T284873
Change-Id: I0d42c743ec188b20b636c8ec577d6cf02a7f1059
If the wiki to which the blocker belongs does not match the wiki to
which the block belongs, things can go wrong.
Bug: T274817
Change-Id: Iab88ff2106932dffeb8b6da193e5a5e12f686cc3
The BlockRestrictionStoreFactory is a new service which allows fetching
of a wiki-specific BlockRestrictionStore by fetching the correct
LoadBalancer via a LBFactory and then injecting it into the
BlockRestrictionStore.
This is being done as a part of the project of supporting cross-wiki
blocking. Currently if a cross-wiki block with restrictions is being
created, the block is being stored in the foreign database, but the
restrictions are being stored in the local one.
Blocks were made wikiaware in I8ae8133f7e232cc75aae6b72fcd7feaeb313cba7.
Bug: T291983
Change-Id: Ia342030c31710f40c95acc75d3cc76f1ad79d806