Commit graph

498 commits

Author SHA1 Message Date
jenkins-bot
395e60b088 Merge "Simpler RedisLockManager configuration" 2021-11-03 22:38:18 +00:00
Tim Starling
06fc5ddb56 Simpler RedisLockManager configuration
I set up a local test instance with RedisLockManager, but some things
seemed more complicated than they needed to be. So:

* Add lockManager option to $wgLocalFileRepo, which becomes the
  lockManager of the auto-generated file backend.
* Made srvsByBucket be optional. I made the same change to the identical
  code in MemcLockManager and DBLockManager, but I didn't test them.
* Improved doc comments for RedisLockManager::__construct() and
  $wgLocalFileRepo.

Change-Id: I8ce430b8e849589d4ea87c90a56ee3659da085a0
2021-11-02 18:28:23 +11:00
James D. Forrester
20fd877da4 Drop experimental FileJournal system without deprecation
The feature was introduced in 2012 with d19f54602f (just before
the gerrit migration).

Change-Id: Ia3f59ad0ddeb1f610947b14e22b0694ff4c6ed84
2021-11-01 14:08:09 +11:00
Alexander Vorwerk
3f421aba14 Remove LockManagerGroup::singleton() and ::destroySingletons()
both deprecated since 1.34.

Bug: T249030
Change-Id: Ide18730c12af503259c98a0380e34a075ecd7128
2021-09-17 00:25:44 +02:00
Alexander Vorwerk
da26927c73 Remove FileBackendGroup::singleton() and ::destroySingletons()
both deprecated since 1.35, hard deprecated since 1.37 and unused.

Bug: T249025
Change-Id: Ie4759fa3fa25202d623317acb444079f10e33817
2021-09-15 19:21:30 +02:00
James D. Forrester
86f3270bda Tag various new 'primary' methods as @since 1.37
Change-Id: Icbbbc84154174da1bd9398990679857898f418d5
2021-09-02 11:58:19 -07:00
jenkins-bot
ae8522b34c Merge "Same code style and formatting for exists-style SQL queries" 2021-08-24 17:44:17 +00:00
Thiemo Kreuz
46f26dff03 Same code style and formatting for exists-style SQL queries
Queries that query a value "1" are expected to return either
that "1" (possibly as a string), or false. It's safe to simply
cast this to bool and use it as it is.

Queries for COUNT(*) are expected to return that number,
possibly as a string. It's not possible for such a query to
return false. And even if, casting to 0 is fine.

I found an existing code style where the table name and the
"1" are on the same line as the selectField() method name, and
applied it to all similar queries.

Change-Id: I9453196281871c03ef03f653f43762eb9284342f
2021-08-12 11:37:58 +02:00
TChin
fa5d3dba51 Support fluent interface for StatusValue
Also refactored some calls to use it.

Bug: T287485
Change-Id: If9e96ce87dc3f3641e9b3ebe093f92d8fa49b9ee
2021-08-02 15:14:11 -04:00
libraryupgrader
5357695270 build: Updating dependencies
composer:
* mediawiki/mediawiki-codesniffer: 36.0.0 → 37.0.0
  The following sniffs now pass and were enabled:
  * Generic.ControlStructures.InlineControlStructure
  * MediaWiki.PHPUnit.AssertCount.NotUsed

npm:
* svgo: 2.3.0 → 2.3.1
  * https://npmjs.com/advisories/1754 (CVE-2021-33587)

Change-Id: I2a9bbee2fecbf7259876d335f565ece4b3622426
2021-07-22 03:36:05 +00:00
James D. Forrester
9fe4138f3d Follow-up I68198bc3: Hard-deprecate getMasterDB() methods
Also switch one use that we missed in the rebase.

Bug: T254646
Depends-On: I632610dec1aa6bb59af5423e6f86164fc791aadd
Change-Id: I9873c889f943fcbd7d867d534a7857f20ef0c5dc
2021-07-15 09:12:17 +01:00
James D. Forrester
597376e12c Replace getMasterDB methods with getPrimaryDB
Bug: T254646
Change-Id: I68198bc39b174ea1920b4acc2617cb6c6ce406e9
2021-07-14 16:21:04 -07:00
ZabeMath
08c87c13a3 Hard deprecate FileBackendGroup::singleton() and ::destroySingletons()
both deprecated since 1.35.

Bug: T249025
Change-Id: I271187e8c5ad68459cfad4c0966c8c14d225512f
2021-05-04 21:03:41 +02:00
ZabeMath
79aa859e5a Hard deprecate LockManagerGroup::singleton() and ::destroySingletons()
both deprecated since 1.34.

Bug: T249030
Change-Id: Ic8747430dae6d9ebe8ca52841cf0d998968dfc2f
2021-05-03 18:42:31 +00:00
James D. Forrester
df5eb22f83 Replace uses of DB_MASTER with DB_PRIMARY
Just an auto-replace from codesniffer for now.

Change-Id: I5240dc9ac5929d291b0ef1c743ea2bfd3f428266
2021-04-29 09:24:31 -07:00
Umherirrender
8de3b7d324 Use static closures where safe to use
This is micro-optimization of closure code to avoid binding the closure
to $this where it is not needed.

Created by I25a17fb22b6b669e817317a0f45051ae9c608208

Change-Id: I0ffc6200f6c6693d78a3151cb8cea7dce7c21653
2021-02-11 00:13:52 +00:00
Umherirrender
8eb9e8b6e8 Improve docs in FileJournal class
Change-Id: Ib3aaec1a9ea33c227b3002816907e42d1a970b76
2020-11-27 16:43:16 +01:00
Aaron Schulz
e6cd8f8823 filebackend: convert DBFileJournal to using CONN_TRX_AUTOCOMMIT
This avoids the hack of needing an untracked LoadBalancer just
to get an auto-commit mode connection

Change-Id: I143d92a9c55af9b94f39e5f49bb0aef9e6ab92e5
2020-11-25 21:26:57 +00:00
Thiemo Kreuz
1fc8d79ac6 Remove documentation that literally repeats the code
For example, documenting the method getUser() with "get the User
object" does not add any information that's not already there.
But I have to read the text first to understand that it doesn't
document anything that's not already obvious from the code.

Some of this is from a time when we had a PHPCS sniff that was
complaining when a line like `@param User $user` doesn't end
with some descriptive text. Some users started adding text like
`@param User $user The User` back then. Let's please remove
this.

Change-Id: I0ea8d051bc732466c73940de9259f87ffb86ce7a
2020-10-27 19:20:26 +00:00
Aryeh Gregor
a24e8a06b5 Mark CONSTRUCTOR_OPTIONS as internal
These were never meant to be part of the public interface and should not
ever have been marked with @since. They're only useful for constructing
the respective objects, which no outside users should be doing.

Change-Id: I86e01272d46fc72af32172d8a12b9180971d4613
2020-08-21 00:18:45 -04:00
Umherirrender
fd1ed0c092 Pass function name to database functions
Useful for logging

Change-Id: Ia2160fb6be5fc93f28ab51f7ae23d7f078247481
2020-06-07 14:16:52 +02:00
Ori Livneh
19931e069f mime: Update usage of MimeAnalyzer methods
Follow-up to I93bd71ec1.

Bug: T252228
Change-Id: I45c9fc592c9e41e0868e7d965206d4c04f4f92e1
2020-05-28 20:13:47 +00:00
James D. Forrester
4f2d1efdda Coding style: Auto-fix MediaWiki.Classes.UnsortedUseStatements.UnsortedUse
Change-Id: I94a0ae83c65e8ee419bbd1ae1e86ab21ed4d8210
2020-01-10 09:32:25 -08:00
apaskulin
4d24ad65c9 docs: Remove ingroup tag from Markdown files
This patch fixes the nesting issue in the Doxygen navigation
by removing the @ingroup tag from class-level Markdown files.
These files will now appear as top-level files in the
navigation and are discoverable via links on the class pages.

Bug: T87796
Change-Id: I370bfea3bf2a6816724d04b15107658f1c336f0f
2019-11-12 16:11:30 -08:00
Umherirrender
337ecb0514 Add missing @param and @return to documentation
Change-Id: Ibc5849cc8ea7e7c4eb30ded9c1cfa5f52187c377
2019-11-10 22:12:58 +00:00
Aryeh Gregor
84cf385db0 Deprecate FileJournal::factory
Instead, the constructors for FileJournal and NullFileJournal should be
treated as stable. I would have added @stable, but our linting doesn't
recognize it yet and doesn't let.

Bug: T235066
Change-Id: I7741055b4f00197d1346ebbfebc14f20238a06f3
2019-11-04 15:17:56 +01:00
jenkins-bot
605bf24772 Merge "docs: Convert class-level documentation files to Markdown" 2019-11-01 01:43:29 +00:00
apaskulin
80221c0aff docs: Convert class-level documentation files to Markdown
The FileRepo, FileBackend, and JobQueue classes include documentation
files that don’t appear in the generated Doxygen docs. This PR:

* Converts these files to Markdown
* Links to each file from the respective class description
* Adds an ingroup tag so the files appear in the sidebar at the
  module level
* Updates the exclude pattern in the Doxyfile to surface these pages

Bug: T87796
Change-Id: I94f0636ab489d741ab505f15da43a5d63c1ca61a
2019-10-31 11:03:13 -07:00
jenkins-bot
a1cc2a6e12 Merge "Hard-deprecate LockManagerGroup::getDefault/getAny" 2019-10-30 12:02:39 +00:00
Aryeh Gregor
b0795a2550 Hard-deprecate LockManagerGroup::getDefault/getAny
These appear to be unused. Moreover, their behavior doesn't match their
documentation. getDefault() claims to return NullLockManager if no lock
manager could be found, but really returns it if there's no lock manager
named 'default'. getAny() claims to throw if no lock manager can be
found, but actually throws if no lock manager is named 'default' or
'fsLockManager'. The behavior can be easily replicated by just using
get() yourself and catching any exception.

Bug: T234227
Change-Id: Iad083847f45d6e017a3f7dbfece1f9c155c5efd6
2019-10-29 14:48:44 +02:00
Aryeh Gregor
0d3d6be18d Convert FileBackendGroup to service
Bug: T234228
Change-Id: I25575f565eba122cdf971a5945572811d17fa3e1
2019-10-25 10:46:20 +03:00
Daimona Eaytoy
95dc119527 Fix new phan errors, part 2
Still mostly doc-only.

Bug: T231636
Change-Id: I65cec6c716ce6859e14da00a12ef71e03603e59a
2019-10-12 10:35:09 +00:00
Aaron Schulz
a775c6888b filebackend: avoid use of wfWikiId() in FileBackendGroup
Also warn when there is a risk of automatic backend domain collisions

Change-Id: Id488b5b947ef5fe8f4b0a8e96560bfd44fcc0327
2019-09-24 18:52:44 -07:00
Aryeh Gregor
5bbcaef231 FileJournal tests
100% unit test coverage for FileJournal and NullFileJournal. 100%
integration test coverage for DBFileJournal. Unit tests for
DBFileJournal once it supports injection.

I removed FileJournal and NullFileJournal from the list of classes that
FileBackendTest tests. It doesn't actually test them, it just happens to
run code from them without checking its correctness at all.

Depends-On: Ic22075bb5e81b7c2c4c1b8647547aa55306a10a7
Change-Id: I46d10ab7b87c23937aa04d7ec1922abfcf3bd611
2019-09-03 10:12:41 +00:00
jenkins-bot
694ca68b23 Merge "Integration tests for FileBackendGroup" 2019-08-28 17:09:44 +00:00
Aryeh Gregor
bd2a439502 Integration tests for FileBackendGroup
100% coverage except for one bit of the code that I didn't understand.
Unit tests to come, together with rewrite as a service.

Change-Id: Ib01758d994a9e5587a4fcb5edc3d80010ef05615
2019-08-28 11:21:44 +03:00
Aryeh Gregor
37022e2e89 LockManagerGroup tweaks
One small change that was supposed to be in 5a6c18a086 but didn't make
it into the patch version that got merged, and removal of some long-dead
code.

phan objected to the use of new $class without being explicitly
reassured that $class is, in fact, a string. I don't know why.

Change-Id: Ifa00c59ab4464109414f21db37e3a6db21decdf3
2019-08-28 10:49:37 +03: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
Fomafix
bb94f4964d Use local variabe $services instead of MediaWikiServices::getInstance()
Change-Id: Ieb6230231d9b916fd1366e7b473db00c87ac4428
2019-08-26 16:12:05 +02: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
Aaron Schulz
69f50aacea Code style cleanups to FileBackendGroup
Set domainId in register() instead of on every config() call.
Use array_merge() to make the override precedence clearer.

Change-Id: I8792281cd9f1a4018255f9a9b87126c909095e68
2019-08-01 20:04:53 +00:00
Aaron Schulz
c2d96ef394 filebackend: avoid use of LoadBalancer::newMainLB() in LockManagerGroup
Change-Id: Iffe9f75ddc9cdbea8a4b5e1932dd55ae325f9dbc
2019-07-16 06:31:15 +00:00
Kunal Mehta
4ef179e335 Fix/suppress misc phan errors (#5)
Add lots of missing return statements, or remove incorrect doc blocks.

Change-Id: I0881e98fbb9d0d4cf79ecc824064d24538055d3f
2019-04-05 15:53:37 -07:00
Aaron Schulz
d0dde42439 Avoid use of deprecated "wikiId" parameter for FileBackend
Also cleaned up the parameter/field naming for DBFileJournal

Change-Id: I70f2a870706f0813311a694cb8ea31ced58dcabb
2019-03-29 15:24:09 -07:00
Aaron Schulz
c25d8111be filebackend: change "profiler" parameter in FileBackend so it works again
The Profiler::profileIn and Profiler::profileOut methods are just stubs.
Use a callback to the Profile::scopedProfileIn method instead.

Change-Id: I7b493c145357994f61faebfbe3f65d38d2e6da42
2019-03-14 23:03:09 +00:00
Aaron Schulz
5196ac32c6 Rename WikiMap DB domain ID methods to reduce confusion with web domains
Those added in this same release do not need alias methods.

Change-Id: I05feeb9b0b13afe43aea1f95551965489cdbe094
2019-02-06 12:28:45 -08:00
Aaron Schulz
dcd0a3d534 Add isCurrentWikiId()/isCurrentWikiDomain()/getCurrentWikiDomain() to WikiMap
Use these in place of various wfWikiID() calls.

Also cleanup UserRightsProxy wiki ID variable names and removed unused
and poorly named getDBname() method.

Change-Id: Ib28889663989382d845511f8d34712b08317f60e
2018-10-29 14:53:37 -07:00
Aaron Schulz
e4558d4885 filebackend: let any specific backend value of "readOnly" override the default
Previously, only different reason strings could override, but there was
no way to override the read-only mode to being off.

Change-Id: I4266694034bfbdada90d4be96bcbc1a37f5b5409
2018-07-19 17:11:39 +01:00
Bartosz Dziewoński
485f66f174 Use PHP 7 '??' operator instead of '?:' with 'isset()' where convenient
Find: /isset\(\s*([^()]+?)\s*\)\s*\?\s*\1\s*:\s*/
Replace with: '\1 ?? '

(Everywhere except includes/PHPVersionCheck.php)
(Then, manually fix some line length and indentation issues)

Then manually reviewed the replacements for cases where confusing
operator precedence would result in incorrect results
(fixing those in I478db046a1cc162c6767003ce45c9b56270f3372).

Change-Id: I33b421c8cb11cdd4ce896488c9ff5313f03a38cf
2018-05-30 18:06:13 -07:00
Thiemo Kreuz
645d96b0e1 Fix and improve PHPDoc type hints in FileBackend and FileRepo
Change-Id: I311b4a6777946b451d70c6fdb2133dbbd73f159f
2018-04-19 10:32:09 +02:00