aboutsummaryrefslogtreecommitdiffstats
path: root/includes/filebackend
Commit message (Collapse)AuthorAgeFilesLines
* Fix uses of TempFSFileFactory's old class aliasJames D. Forrester2025-03-171-1/+1
| | | | | | | Follow-up to 0fe5cc829ecfc7b0476d69821c446516483d24fe. Bug: T382910 Change-Id: I8bd2e5d5815f37944ec4bfc5f586701a1116069b
* filebackend: Remove dependencies on MediaWiki codedaniel2025-01-081-0/+2
| | | | | | | | | | | | Why: - code under include/libs must not depend on MediaWiki code What: - replaced DeferredUpdates with a callback - replaced MWTimestamp with ConvertibleTimestamp Bug: T382910 Change-Id: I85bc06364af65bdd5a4e16474ad8a6f644d4f940
* filebackend: Check for old alias in FileBackendMultiWriteUmherirrender2024-10-221-1/+2
| | | | | | | | | When the config contains the old class name, the change to the new namespaced class in 1b29f07440f2c8fd039987feb1a075b9d683c841 breaks existing configs. Follow-Up: I73fb416573f5af600e529d224b5beb5d2e3d27d3 Change-Id: I5236609dbef5c28c4d220680c501b5813f940e8f
* Use namespaced classesUmherirrender2024-10-211-2/+2
| | | | | | | Changes to the use statements done automatically via script Addition of missing use statement done manually Change-Id: I73fb416573f5af600e529d224b5beb5d2e3d27d3
* Add namespace to remaining parts of Wikimedia\Mime and Wikimedia\StatsJames D. Forrester2024-09-271-1/+1
| | | | | Bug: T353458 Change-Id: If0137003ab625017d322d57870448a02569668c3
* Add namespace to remaining parts of Wikimedia\ObjectCacheJames D. Forrester2024-09-271-1/+1
| | | | | Bug: T353458 Change-Id: I3b736346550953e3b2977c14dc3eb10edc07cf97
* Remove unchecked exception annotationsAdam Wight2024-09-171-3/+0
| | | | | | | | | | | | | | | Callers should not catch an unchecked exception, so it doesn't belong in a function signature. Unchecked exceptions indicate a coding error, which by definition the code will not be able to handle correctly. If any of these exceptions were supposed to be in response to an edge case, user input, or initial conditions, then they should be changed to a runtime error. If the exception class cannot be changed, then the annotation should include a comment explaining its purpose and prognosis. Bug: T240672 Change-Id: I2e640b9737cb68090a8e1cb70067d1b74037d647
* Add namespace to the root classes of ObjectCacheEbrahim Byagowi2024-07-101-1/+1
| | | | | | | | | And deprecated aliases for the the no namespaced classes. ReplicatedBagOStuff that already is deprecated isn't moved. Bug: T353458 Change-Id: Ie01962517e5b53e59b9721e9996d4f1ea95abb51
* Add namespace and deprecation alias to FileBackendGroupEbrahim Byagowi2024-05-201-0/+12
| | | | | | | | | This patch introduces a namespace declaration for the MediaWiki\FileBackend to FileBackendGroup and establishes a class alias marked as deprecated since version 1.43. Bug: T353458 Change-Id: Id33b6bfa56131978900199786b0082481c6c54a5
* Add namespace and deprecation alias to FileBackendEbrahim Byagowi2024-05-191-0/+1
| | | | | | | | | This patch introduces a namespace declaration for the Wikimedia\FileBackend to FileBackend and establishes a class alias marked as deprecated since version 1.43. Bug: T353458 Change-Id: Id897687b1d679fd7d179e3a32e617aae10ebff33
* build: Upgrade mediawiki/mediawiki-phan-config from 0.13.0 to 0.14.0 manuallyJames D. Forrester2024-02-101-4/+4
| | | | | | | | | | | * Switch out raw Exceptions, mostly for InvalidArgumentExceptions. * Fake exceptions triggered to give Monolog a backtrace are for some reason "traditionally" RuntimeExceptions, instead, so we continue to use that pattern in remaining locations. * Just entirely give up on PostgresResultWrapper's resource vs. object mess. * Drop now-unneeded false positive hits. Change-Id: Id183ab60994cd9c6dc80401d4ce4de0ddf2b3da0
* Deprecate ConfiguredReadOnlyMode serviceAmir Sarabadani2023-09-121-5/+5
| | | | | | | | | | | | | | | | Currently, we have two services: ReadOnlyMode and ConfiguredReadOnlyMode. The former takes the latter and can easily support every functionality of CRO. I added methods to support that functionality (the current class is quite small so it's not adding a lot more to a monster class) and basically fully deprecate the service itself to improve developer experience. It is only called in two extensions in production with straightforward fix so I directly went with hard-deprecation. Bug: T343917 Depends-On: Icec0ad3f30c471b428efe80dfb9129f55a351194 Change-Id: I421fd5c8fee7af41c059419c2bbc85b8dccc04ed
* Reorg: Move three output related classes to includes/Output/Amir Sarabadani2023-09-051-0/+1
| | | | | | | | | | And namesapce them: - StreamFile - OutputHandler - OutputPage Bug: T321882 Change-Id: Iedf8d88c595e580f2d8f0734c92aa5c45618ba33
* Reorg: Move Status to MediaWiki\Status\Amir Sarabadani2023-08-251-0/+1
| | | | | | | | | | This class is used heavily basically everywhere, moving it to Utils wouldn't make much sense. Also with this change, we can move StatusValue to MediaWiki\Status as well. Bug: T321882 Depends-On: I5f89ecf27ce1471a74f31c6018806461781213c3 Change-Id: I04c1dcf5129df437589149f0f3e284974d7c98fa
* Drop LockManagerGroup::getDefault() and getAny(), deprecated since 1.35James D. Forrester2023-08-161-34/+0
| | | | Change-Id: I18cb4da74369703aead42df689b54d43d70f094f
* rdbms: Move ReadOnlyMode and ConfiguredReadOnlyMode to rdbms libraryAmir Sarabadani2023-05-041-1/+1
| | | | | | | | | | | | The db/ directory does not have an owner and it's a mess in general. These classes don't depend on anything in core except the rdbms library. Let's simply move it there. In other words, Krinkle made me do it. Since the class was moved in I6202e52ba73 merged less than a week ago, no need to alias anything. Bug: T321882 Change-Id: I24ceeb8bf765a50f441270136acd612359d50aa2
* Reorg: Move ReadOnlyMode classes to db/Amir Sarabadani2023-04-281-0/+1
| | | | | | | | They are not suitable to go to rdbms library as they depend on mediawiki pieces, the second best place is the db/ directory. Bug: T321882 Change-Id: I6202e52ba7306d74261206c2ba7930c5f1a0a18e
* Merge "Use short array destructuring instead of list()"jenkins-bot2022-10-211-1/+1
|\
| * Use short array destructuring instead of list()Tim Starling2022-10-211-1/+1
| | | | | | | | | | | | | | | | Introduced in PHP 7.1. Because it's shorter and looks nice. I used regex replacement. Change-Id: I0555e199d126cd44501f859cb4589f8bd49694da
* | Use the null coalescing assignment operatorTim Starling2022-10-211-3/+2
|/ | | | | | | | Available since PHP 7.4. Automated search, manual replacement. Change-Id: Ibb163141526e799bff08cfeb4037b52144bb39fa
* lockmanager: remove MysqlLockManager and DBLockManagerAaron Schulz2022-10-141-133/+0
| | | | | | | | | | This obscure class could only be used by running file_locks.sql and customizing $wgLockManagers. It was not worth the overhead of having to maintain it. Remove DBLockManager since there are no subclasses now. Change-Id: Id7e3fde02dfca02271bcec039be5c079de9de830
* filebackend: Remove LBFactory dep from LockManager serviceTimo Tijhof2022-08-022-15/+3
| | | | | | | | | | | | | | | | | | This was added during the conversation to a service class in commit 5a6c18a086 (Iaa7354f31), but the code it was for is unused and was shortly after removed in commit 37022e2e (Ifa00c59ab), thus leaving this unused dependency behind. The motiviation for this change is that Parser is used during the installer (maintenance/install.php) with DB services naturally disabled, and Parser has the dependency chain Parser -> BadFileLookup -> RepoGroup (hidden) -> FileBackendGroup -> LockManagerGroup. Solving the hidden part is proposed in I9de42a26cd, but fails as LockManagerGroup currently depends on LBFactory which makes it crash in db-less environments. Change-Id: Icaad0acbed2957c1f86e4089dd221a8cdcb1a1ae
* Ensure that strlen() does not get passed a (valid) nullMark A. Hershberger2022-07-121-1/+1
| | | | | | | Seen in FileBackendGroupIntegrationTest::testGuessMimeInternal(). Bug: T289926 Change-Id: I8bf50d0fc026b2880427d3d75d57e38d4e2989d3
* docs: Move, clarify and cross-ref "DI Principles" for easy referenceTimo Tijhof2022-06-061-2/+2
| | | | | | | | Loosely based on https://phabricator.wikimedia.org/T218555, https://phabricator.wikimedia.org/T242835#6064656, and https://phabricator.wikimedia.org/T302627#7846955. Change-Id: Ib649297ba28d75eca3c96235124a97ea38dde72c
* Use MainConfigNames instead of string literals, #4Aryeh Gregor2022-04-261-7/+8
| | | | | | | | | | | | | | | | | | | | | 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
* Use updated ObjectFactory namespaceAlexander Vorwerk2022-03-091-1/+1
| | | | | | | Depends-On: I99c5e5664d2401c36a9890f148eba7c25e6e8324 Depends-On: I48ab818b2965da14af15ef370aa83ad9455badd9 Depends-On: I018371e4b77911e56152ca7b2df734afc73f58a5 Change-Id: I04ebdb52102f6191d49a9cc70b1f98308299e72f
* LockManager: distinguish conflicts from other kinds of lock errorsTim Starling2021-11-091-3/+1
| | | | | | | | | With a user-friendly error message which uses both technical and non-technical language, without the irrelevant detail of filebackend URLs. Bug: T283045 Change-Id: I8704f405d38acdffae7bd4ea5b91f3f591fc2ebc
* Merge "Simpler RedisLockManager configuration"jenkins-bot2021-11-031-1/+2
|\
| * Simpler RedisLockManager configurationTim Starling2021-11-021-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* | Drop experimental FileJournal system without deprecationJames D. Forrester2021-11-013-207/+1
|/ | | | | | | The feature was introduced in 2012 with d19f54602f (just before the gerrit migration). Change-Id: Ia3f59ad0ddeb1f610947b14e22b0694ff4c6ed84
* Remove LockManagerGroup::singleton() and ::destroySingletons()Alexander Vorwerk2021-09-171-24/+0
| | | | | | | both deprecated since 1.34. Bug: T249030 Change-Id: Ide18730c12af503259c98a0380e34a075ecd7128
* Remove FileBackendGroup::singleton() and ::destroySingletons()Alexander Vorwerk2021-09-151-21/+0
| | | | | | | both deprecated since 1.35, hard deprecated since 1.37 and unused. Bug: T249025 Change-Id: Ie4759fa3fa25202d623317acb444079f10e33817
* Tag various new 'primary' methods as `@since 1.37`James D. Forrester2021-09-021-0/+1
| | | | Change-Id: Icbbbc84154174da1bd9398990679857898f418d5
* Merge "Same code style and formatting for exists-style SQL queries"jenkins-bot2021-08-241-9/+3
|\
| * Same code style and formatting for exists-style SQL queriesThiemo Kreuz2021-08-121-9/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* | Support fluent interface for StatusValueTChin2021-08-021-6/+2
|/ | | | | | | Also refactored some calls to use it. Bug: T287485 Change-Id: If9e96ce87dc3f3641e9b3ebe093f92d8fa49b9ee
* build: Updating dependencieslibraryupgrader2021-07-222-2/+2
| | | | | | | | | | | | | | 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
* Follow-up I68198bc3: Hard-deprecate getMasterDB() methodsJames D. Forrester2021-07-151-1/+1
| | | | | | | | Also switch one use that we missed in the rebase. Bug: T254646 Depends-On: I632610dec1aa6bb59af5423e6f86164fc791aadd Change-Id: I9873c889f943fcbd7d867d534a7857f20ef0c5dc
* Replace getMasterDB methods with getPrimaryDBJames D. Forrester2021-07-141-7/+19
| | | | | Bug: T254646 Change-Id: I68198bc39b174ea1920b4acc2617cb6c6ce406e9
* Hard deprecate FileBackendGroup::singleton() and ::destroySingletons()ZabeMath2021-05-041-2/+7
| | | | | | | both deprecated since 1.35. Bug: T249025 Change-Id: I271187e8c5ad68459cfad4c0966c8c14d225512f
* Hard deprecate LockManagerGroup::singleton() and ::destroySingletons()ZabeMath2021-05-031-2/+5
| | | | | | | both deprecated since 1.34. Bug: T249030 Change-Id: Ic8747430dae6d9ebe8ca52841cf0d998968dfc2f
* Replace uses of DB_MASTER with DB_PRIMARYJames D. Forrester2021-04-291-1/+1
| | | | | | Just an auto-replace from codesniffer for now. Change-Id: I5240dc9ac5929d291b0ef1c743ea2bfd3f428266
* Use static closures where safe to useUmherirrender2021-02-111-1/+1
| | | | | | | | | 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
* Improve docs in FileJournal classUmherirrender2020-11-271-2/+2
| | | | Change-Id: Ib3aaec1a9ea33c227b3002816907e42d1a970b76
* filebackend: convert DBFileJournal to using CONN_TRX_AUTOCOMMITAaron Schulz2020-11-251-9/+2
| | | | | | | This avoids the hack of needing an untracked LoadBalancer just to get an auto-commit mode connection Change-Id: I143d92a9c55af9b94f39e5f49bb0aef9e6ab92e5
* Remove documentation that literally repeats the codeThiemo Kreuz2020-10-271-2/+0
| | | | | | | | | | | | | | | 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
* Mark CONSTRUCTOR_OPTIONS as internalAryeh Gregor2020-08-211-1/+1
| | | | | | | | 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
* Pass function name to database functionsUmherirrender2020-06-071-1/+1
| | | | | | Useful for logging Change-Id: Ia2160fb6be5fc93f28ab51f7ae23d7f078247481
* mime: Update usage of MimeAnalyzer methodsOri Livneh2020-05-281-1/+1
| | | | | | | Follow-up to I93bd71ec1. Bug: T252228 Change-Id: I45c9fc592c9e41e0868e7d965206d4c04f4f92e1
* Coding style: Auto-fix MediaWiki.Classes.UnsortedUseStatements.UnsortedUseJames D. Forrester2020-01-103-3/+3
| | | | Change-Id: I94a0ae83c65e8ee419bbd1ae1e86ab21ed4d8210