aboutsummaryrefslogtreecommitdiffstats
path: root/includes/filerepo/ForeignDBViaLBRepo.php
Commit message (Collapse)AuthorAgeFilesLines
* Namespace all remaining files in includes/filerepoJames D. Forrester2025-03-191-0/+8
| | | | | Bug: T353458 Change-Id: I35864ad9bd48701703c51367d62f8ebde963c52d
* Remove trivial 1-line PHPDocs that just repeat the codethiemowmde2025-01-161-3/+0
| | | | | | | | | | | | | I assume these are all either auto-generated by an IDE or the language-level type declarations have been added later. In any case the comments don't add any new information to what the code already says. This is just extra clutter that makes the code harder to read, I would argue. There are many, many more comments like this. In this patch I intentionally focus on the most trivial 1-line comments. Change-Id: Ia294bf4ce0d8a77036842fe25884bc175c2b0e7d
* Change more uses of getDBLoadBalancerFactory() to getConnectionProvider()Bartosz Dziewoński2024-01-231-1/+1
| | | | | | | | | | | Some less trivial cases. Also update variable names. 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: I6657d783375fac5c7fa856b884ff1fb09285e94c
* Replace deprecated MWExceptionDaimona Eaytoy2024-01-161-2/+4
| | | | | Bug: T328220 Change-Id: Ic45438d9e6bbf127f1415add81ab902044765840
* filerepo: Switch to use IConnectionProvider where possibleAmir Sarabadani2023-09-121-9/+11
| | | | | | | It uses db factory in some places and that should be properly cleaned up Bug: T330641 Change-Id: I310199ce7b2e46d08392204d26e77690dc6afd20
* Create shared interface for foreign db reposRyan Schmidt2023-06-131-1/+1
| | | | | | | | | | | | | | | | | | | | Right now, Extension:TimedMediaHandler hardcodes checks for ForeignDBViaLBRepo, which makes it inoperable for wikis making use of ForeignDBRepo or an extension-provided foreign repo that exposes direct access to the remote MW database. Introducing a new interface in core will allow TimedMediaHandler to check for this interface instead of specific implementations of foreign db repos. I wasn't quite sure what methods to populate the interface with, since all current implementations extend from LocalRepo, and most things that interact with it largely expect (close to) the full API surface that LocalRepo provides. Rather than duplicating all of those methods in the interface, I opted for providing two methods that any custom implementations would be required to override should they extend from LocalRepo as a base class. I'm open to other approaches here, however. Bug: T63986 Change-Id: I76b43e77f44e90eef5f3d2ac05ef203ed3085bd2
* Fix even more PHPStorm inspections (#3)Tim Starling2023-03-251-0/+1
| | | | | | | | | | | | | | | * Inappropriate @inheritDoc usage. Arguably all @inheritDoc is inappropriate but these are the ones PHPStorm flags as misleading due to the method not being inherited. * Doc comment type does not match actual argument/return type. * I replaced "@return void|never" with "@return void" since never means never, it doesn't make sense for it to be conditional. If a method can return (even if that is unlikely) then @return contains the type that it returns. "@return never" means that there is no such type because the method never returns. * Incomplete/partial/broken doc tags Change-Id: Ide86bd6d2b44387f37d234c2b059d6fbc42ec962
* Remove deprecated getMasterDB methodsMatěj Suchánek2022-11-171-5/+0
| | | | | | They have been deprecated since 1.37 and are unused. Change-Id: I626525eead68e3ba50564ac629a86c7c8dc9dd73
* filerepo: Clean up file and class doc commentsTimo Tijhof2022-04-071-4/+1
| | | | | | | | | | | | | | | | * Remove copy-paste descriptions that are unrelated to the file. * Move any useful information from file block to class block. * Ensure any relevant `ingroup` is set on the class block. * Remove left-over ingroup and class description from file block, which pollutes the doc index for no gain. * Mark some obscure classes that have no references outside core in Codesearch Everywhere as internal. Change-Id: If2360596b4a7511db7439b4b9867b0600ce2d5f8
* 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-1/+6
| | | | | Bug: T254646 Change-Id: I68198bc39b174ea1920b4acc2617cb6c6ce406e9
* 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
* filerepo: clean up shared cache keys to avoid key metrics clutterAaron Schulz2020-10-211-24/+6
| | | | | | | This avoids statsd metrics with names that begin with DB domains Bug: T261534 Change-Id: I69fa4482c639bd49bdc2dec48a8dcdd74d455432
* filerepo: use makeGlobalKey() in ForiegnDBViaLBRepo::getSharedCacheKey()Aaron Schulz2020-05-221-10/+1
| | | | | | | | | | | Keys used by multiple wikis should use this key generation method. It also means settings like "coalesceKeys" in WANObjectCache will correctly identify these keys as being global. This change should be deployed on all wikis at once. Bug: T253405 Change-Id: Ie19613ef7643af92aeb56db203e3d79139143231
* Fix more Squiz.Scope.MethodScope.MissingReedy2020-05-181-5/+5
| | | | Change-Id: I44cd7ba39a898a27f0f66cf34238ab95370d2279
* filerepo: clean up File::getRepo() subclass return type commentsAaron Schulz2020-03-191-7/+0
| | | | Change-Id: I7fbe19c96cc41e9f4534e56853fd119b74b2603c
* Fix new phan errors, part 5Daimona Eaytoy2019-10-181-0/+1
| | | | | | | | | | | | | Some of the errors are suppressed because they're phan false positives. The idea behind this is that they'll be fixed in a future version of phan, and we'll just have to remove the suppressions. Note: I'm disabling UnusedPluginSuppression so that we can start suppressing issues even if they're still disabled. The sniff should be re-enabled as soon as we upgrade phan. Bug: T231636 Change-Id: I0f7fa06a9e03fbb86c7a5eb6e50a850bb258a7f7
* Unsuppress PhanParamsTooManyDaimona Eaytoy2019-10-101-2/+2
| | | | | | | This is the last repo-wide suppressed issue. Hurrah. Bug: T231636 Change-Id: I3dc939f115bea14848c9c40bc52a7601f86ca0a7
* Remove unused fields in ForeignDBViaLBRepoAaron Schulz2018-10-211-9/+3
| | | | Change-Id: Ia60139c5670ad572058cf39c7e7bf78972d29d9f
* Replace wfGetLBUmherirrender2018-05-021-3/+15
| | | | | | @deprecated since 1.27 Change-Id: Ibdd49fdfc0d1511503e1ed2173a592c612996c53
* Use ::class to resolve class names in includes filesUmherirrender2018-01-271-2/+2
| | | | | | | This helps to find renamed or misspelled classes earlier. Phan will check the class names Change-Id: I07a925c2a9404b0865e8a8703864ded9d14aa769
* build: Prepare for mediawiki/mediawiki-codesniffer to 0.9.0Umherirrender2017-06-261-1/+1
| | | | | | | | | | | | The used phpcs has a bug, so the version 0.9.0 could not be enforced at the moment. Will be fixed in next version, see T167168 Changed: - Remove duplicate newline at end of file - Add space between function and ( for closures - and -> &&, or -> || Change-Id: I4172fb08861729bccd55aecbd07e029e2638d311
* Clean up get_class() in /includes/filerepo and /includes/resourceloaderTimo Tijhof2017-03-071-1/+1
| | | | | | | | * get_class() -> __CLASS__ (same as self::class) * get_called_class() -> static::class * get_class($this) -> static::class Change-Id: Ic4f9b150ddc35e25f51297de7fc12410d421be4d
* Rename getSlaveDB() FileRepo method to getReplicaDB()Aaron Schulz2016-11-181-1/+1
| | | | | | The old name is left as an alias. Change-Id: I60ab2cd5ce05df4247d5e25b017d2debee56554e
* Use getConnectionRef() in ForeignDBViaLBRepoAaron Schulz2016-10-051-5/+4
| | | | | | This assures that reuseConnection() will be called. Change-Id: I6b9eb695d08045433ebb3204c0f72bcf63f21568
* Cleanups and IDEA warning fixes to FileRepo classesAaron Schulz2016-09-191-0/+3
| | | | Change-Id: I98247b299c31b93df183981adc517187cb4aefe5
* Rename DB_SLAVE constant to DB_REPLICAAaron Schulz2016-09-051-1/+1
| | | | | | | | | This is more consistent with LoadBalancer, modern, and inclusive of master/master mysql, NDB cluster, and MariaDB galera cluster. The old constant is an alias now. Change-Id: I0b37299ecb439cc446ffbe8c341365d1eef45849
* Convert all array() syntax to []Kunal Mehta2016-02-171-5/+5
| | | | | | | | | | Per wikitech-l consensus: https://lists.wikimedia.org/pipermail/wikitech-l/2016-February/084821.html Notes: * Disabled CallTimePassByReference due to false positives (T127163) Change-Id: I2c8ce713ce6600a0bb7bf67537c87044c7a45c4b
* Update more docs and type hints to use IDatabaseAaron Schulz2015-10-061-2/+2
| | | | Change-Id: I8c8d85b32a8aba21e14d2a2dde4c25eb509186c1
* Support for storing files under SHA-1 namesAaron Schulz2015-07-211-0/+10
| | | | | | | | | | | | * Added a "storageLayout" flag to LocalRepo config (supports "sha1") * Added a simple migration script to copy files the SHA1 paths * Currently works with img_auth.php + thumb_handler.php for URLs * Added visibility to some LocalFile methods * Simple tests for the wrapper class. Co-Authored-By: Gilles Dubuc <gdubuc@wikimedia.org> Change-Id: Iad46ad669c8ae3c02d10da10c3f7a16fe161663f Bug: T1210
* Fix ForeignDBViaLBRepo faviconGergő Tisza2014-02-241-0/+4
| | | | | | | | | Due to the weird inheritance structure of the FileRepo tree, ForeignDBViaLBRepo inherited the wrong getInfo behavior and returned the favicon of the local wiki. Change-Id: I4892247c0e4a2e05c9148efe089f0ff52459bbd0 Mingle: https://wikimedia.mingle.thoughtworks.com/projects/multimedia/cards/253
* Update documentation for file repo related classesSiebrand Mazeland2013-12-041-1/+10
| | | | Change-Id: I626d972f92934afc9349e11d3a5550c4044dcb53
* Declare visibility on class properties of file repo classesSiebrand Mazeland2013-11-251-3/+5
| | | | Change-Id: Ia608df217bb893dddae3219b3315cb44e82f5092
* Update formatting of file repo classesSiebrand Mazeland2013-11-231-0/+1
| | | | Change-Id: I780070e07352d84d7cda7628994b28b04e8a1ebf
* Remove a bunch of trailing spaces and unneeded newlinesumherirrender2012-10-191-1/+1
| | | | Change-Id: I7db616db8c969567d420c0161fa207b366e292b6
* Improved/added parameter documentationReedy2012-05-181-0/+9
| | | | Change-Id: Ie48852acb434f6b62fda0b13b13e076f833d8975
* Added missing GPLv2 headers in some places.Alexandre Emsenhuber2012-05-071-1/+16
| | | | | | Also made file/class documentation more consistent. Change-Id: Iad15427368d13a6cc11c8512b7265e8c7b8878a5
* [FileRepo] Various code cleanups.Aaron Schulz2012-04-051-8/+2
| | | | | | | | | | | | | | | | | | * Made File::isHashed() wrap FileRepo::getHashLevels(). Removed now-used FileRepo::isHashed(). * Removed FileRepo::simpleClean(). Not useful anymore since the paths in Status errors don't have $IP or upload dirs anymore. * Removed code in FileRepo::fileExistsBatch() and FileRepo::cleanupBatch() to handle FS file paths, which should never be passed in anymore. Likewise, removed FILES_ONLY parameter. * Removed FileRepo::append()/appendFinish() stub functions. * Added FileRepo::assertWritableRepo() function to better handle repos that are read-only by design rather than the hack of overwriting each function (several were missed). * Added FileBackend::isPathTraversalFree() function and used it in FileRepo::validateFilename() to avoid duplication. * Tweaked FileRepo::freeTemp() to avoid file locking and made FileRepo::cleanupBatch() return a Status. * Moved FileRepo::cleanupDeletedBatch() near FileRepo::deleteBatch(). * Added type hinting to a few places. * Tweaked some misleading doc comments and added function visibility markers. Change 1: * Simplified NullRepo to also use assertWritableRepo(). It is currently only used by a single unit test. Change-Id: I1cd0f4971011772e38e5156f94ffc50325372f28
* More return documentationSam Reed2012-02-091-0/+1
| | | | Notes: http://mediawiki.org/wiki/Special:Code/MediaWiki/111101
* Merged FileBackend branch. Manually avoiding merging the many prop-only ↵Aaron Schulz2011-12-201-0/+1
| | | | | | | changes SVN likes to sprinkle in (easy to spot from the change list). Did not add SwiftFileBackend.php as it still is in development. Notes: http://mediawiki.org/wiki/Special:Code/MediaWiki/106752
* * added file description headersAlexandre Emsenhuber2010-09-041-0/+7
| | | | | | | * changed a @ingroup Media to FileRepo Notes: http://mediawiki.org/wiki/Special:Code/MediaWiki/72385
* Bug 19240 (bad image list performance regression):Tim Starling2009-06-171-0/+15
| | | | | | | | | | | | | | | | * Don't connect to the commons DB on cache hits, in order to determine the cache key name. Removed remnants of that bright idea from GlobalFunctions.php. * Fixed total failure of negative caching in checkRedirect() due to memcached stripping trailing spaces from string values. Probably never worked. Also: * Respect hasSharedCache in foreign repos. Recently-added code was apparently ignorant of this setting. * Renamed getMemcKey() to getSharedCacheKey() to make its function more clear, introduced getLocalCacheKey() to do the other thing. Fixed its parameters to be like wfMemcKey() and used it in more places. * Used getLocalCacheKey() in various places instead of wfMemc(), to avoid having multiple repositories overwrite each others' caches. * Fixed the BagOStuff bug that the FIXME in LocalRepo::checkRedirect() appears to refer to. * Removed getMasterDB() and getSlaveDB() from FileRepo, it's incorrect to assume that a repo other than a LocalRepo has an associated database. * Made FileRepo::invalidateImageRedirect() a stub, to match FileRepo::checkRedirect(). Moved the functionality to LocalRepo where checkRedirect() is concretely implemented. Notes: http://mediawiki.org/wiki/Special:Code/MediaWiki/52024
* Forgot to remove the newFileFrom row thingies from ForeignDBRepoBryan Tong Minh2008-05-301-6/+0
| | | | Notes: http://mediawiki.org/wiki/Special:Code/MediaWiki/35612
* * Use a proper factory for newFromRow Bryan Tong Minh2008-05-301-0/+1
| | | | | | | * Don't remove found files from the $titles parameter in findFiles Notes: http://mediawiki.org/wiki/Special:Code/MediaWiki/35595
* Hack around borkage with findFiles() on ForeignDBViaLBRepo by copying ↵Brion Vibber2008-05-291-0/+6
| | | | | | | | | newFileFromRow() from ForeignDBRepo. Probably this is all wrong, and both classes should be ripped out a bit and told to use the defined factory functions? Notes: http://mediawiki.org/wiki/Special:Code/MediaWiki/35576
* WARNING: HUGE COMMITAlexandre Emsenhuber2008-05-201-0/+1
| | | | | | | | | | | | | | | | | | Doxygen documentation update: * Changed alls @addtogroup to @ingroup. @addtogroup adds the comment to the group description, but doesn't add the file, class, function, ... to the group like @ingroup does. See for example http://svn.wikimedia.org/doc/group__SpecialPage.html where it's impossible to see related files, classes, ... that should belong to that group. * Added @file to file description, it seems that it should be explicitely decalred for file descriptions, otherwise doxygen will think that the comment document the first class, variabled, function, ... that is in that file. * Removed some empty comments * Removed some ?> Added following groups: * ExternalStorage * JobQueue * MaintenanceLanguage One more thing: there are still a lot of warnings when generating the doc. Notes: http://mediawiki.org/wiki/Special:Code/MediaWiki/35098
* * Introduced LBFactory -- an abstract class for configuring database load ↵Tim Starling2008-03-301-0/+37
balancers and connecting to foreign DBs. * Wrote two concrete implementations. LBFactory_Simple is for general installations. LBFactory_Multi will replace the runtime configuration used on Wikimedia and allow load-balanced connections to any DB. * Ported Special:Userrights, CentralAuth and OAI audit to the LBFactory system. * Added ForeignDBViaLBRepo, a file repository which uses LBFactory. * Removed $wgLoadBalancer and $wgAlternateMaster * Improved the query group concept to allow failover and lag control * Improved getReaderIndex(), it will now try all servers before waiting, instead of waiting after each. * Removed the $fail parameter to getConnection(), obsolete. * Removed the useless force() function. * Abstracted the replication position interface to allow for future non-MySQL support. * Rearranged Database.php. Added a few debugging features. * Removed ancient benet-specific hack from waitForSlave.php Notes: http://mediawiki.org/wiki/Special:Code/MediaWiki/32578