aboutsummaryrefslogtreecommitdiffstats
path: root/includes/Storage/NameTableStoreFactory.php
Commit message (Collapse)AuthorAgeFilesLines
* Use type declaration on undocumented private functionsUmherirrender2025-04-021-1/+1
| | | | Change-Id: I0d8d2237500ed6f18439410c902d47c42e4119bc
* Add namespace to remaining parts of Wikimedia\ObjectCacheJames D. Forrester2024-09-271-1/+1
| | | | | Bug: T353458 Change-Id: I3b736346550953e3b2977c14dc3eb10edc07cf97
* nametablestore: simplify NameTableStore::acquireId() and update commentsAaron Schulz2024-09-241-2/+2
| | | | | | | | | | | | | Make store() handle cache purging upon new ID insertion and fetching of the winning ID when raced out. This avoids the reloadMap() call. Remove connection flag hack in reloadMap() given 0cb0f0ba7. Remove comments about retryStore() logic removed in 505bd8e70f. Clean up return types for the ID:name arrays. Change-Id: Ic57eb5e2b59da67c6511b935d9e68ffb595028fa
* Add missing documentation to class properties in NameTableStoreFactoryUmherirrender2024-09-071-2/+2
| | | | | | | | | | | | Add doc-typehints to class properties found by the PropertyDocumentation sniff to improve the documentation. Once the sniff is enabled it avoids that new code is missing type declarations. This is focused on documentation and does not change code. This also avoid false positive from phan Change-Id: I4b182fda29e9cb9719c26fd01a609de2453be56d
* Import InvalidArgumentException at top of the sourceEbrahim Byagowi2024-05-191-1/+2
| | | | | | | | | | | | | | It was asked in a patch review to apply fully import InvalidArgumentException where possible. I was guessing some of my other already merged patches have but turned out such thing exists other places style so for the sake of consistency I've turned rest of inline import of the specific exception at top of the file. There are instances of source files that aren't in any namespace but have fully qualified import which this patch doesn't touch. Change-Id: I4071fc698b65746d9594cf4d5f45bae82843d436
* tests: Avoid database usage when possibleDaimona Eaytoy2023-07-311-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | We would like to remove DB access in non-database PHPUnit tests. As a first step, avoid database usage in tested code when possible. In particular: - In NameTableStoreFactory, avoid domain ID normalization if the provided ID is already false. - In SpecialDoubleRedirects, do not acquire a DB connection until it's needed (which is just one place). - Use editPage() in TitleDefTest instead of a DIY implementation, and add `@group Database` accordingly. - Avoid parsing titles in ContentHandler tests that don't need to parse titles. Among the many dependencies of parsing titles is the interwiki lookup, which requires DB access. - Also remove test cases that used the "Gadget" namespace; it doesn't exist in core, so these pages were actually in the mainspace. - Mock the database in CategoriesRdfTest. The only two methods that use the database were already being mocked. - Add `@group Database` to test classes that are intentionally using the Database, mainly via getTestUser(). Bug: T155147 Change-Id: I9385fe14cfeb6b7b7378cc322d510034c4ee0711
* Storage: Minor docs and file header cleanupTimo Tijhof2022-11-041-0/+1
| | | | | | | | | | | | | | | | | | | | | | | * Move description and ingroup annotations from PHP file docblock to class docblock, where IDEs and Doxygen (and humans!) tend to read it from. This is in part evidences by the fact that for numerous classes, the file docblock was copy-pasted and actually about a different class. Follows-up Ia3b9b8c22 (page), I301f471f86 (language), I216d85c6df (PageEditStash), and others that apply similar doc improvements. * Add missing `@defgroup` for page. Without this, the group is ignored and not added in the sidebar at <https://doc.wikimedia.org/mediawiki-core/master/php/> * Clean up the file header, similar to other commits under <https://gerrit.wikimedia.org/r/q/message:ingroup+owner:Krinkle>. Change-Id: I94de8299c184fee8c05b7108448255fcf36f8260
* phan: Disable null_casts_as_any_type settingUmherirrender2022-03-211-0/+2
| | | | | | | | | | | Make phan stricter about null types by setting null_casts_as_any_type to false (the default in mediawiki-phan-config) Remaining false positive issues are suppressed. The suppression and the setting change can only be done together Bug: T242536 Bug: T301991 Change-Id: I0f295382b96fb3be8037a01c10487d9d591e7e01
* Remove some more comments that literally repeat the codeThiemo Kreuz2021-12-091-1/+1
| | | | | | | | Nothing to learn from these. You can find a longer explanation in the comments in I93751e6. Change-Id: I195aae70fc282b58be5b18160783f27d38605d15
* build: Updating dependencieslibraryupgrader2021-07-221-4/+4
| | | | | | | | | | | | | | 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
* 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
* Coding style: Auto-fix MediaWiki.Classes.UnsortedUseStatements.UnsortedUseJames D. Forrester2020-01-101-2/+2
| | | | Change-Id: I94a0ae83c65e8ee419bbd1ae1e86ab21ed4d8210
* rdbms: Database::selectDB() update the domain and handle failure betterAaron Schulz2018-10-101-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | LoadBalancer uses Database::getDomainId() for deciding which keys to use in the foreign connection handle arrays. This method should reflect any changes made to the DB selection. If the query fails, then do not change domain field. This is the sort of approach that LoadBalancer is expects in openForeignConnection(). Also, throw an exception when selectDB() fails. The db/schema/prefix fields of Database no longer exist in favor of just using the newer currentDomain field. Also: * Add IDatabase::selectDomain() method and made selectDB() wrap it. * Extract the DB name from sqlite files if not explicitly provided. * Fix inconsistent open() return values from Database subclasses. * Make a relationSchemaQualifier() method to handle the concern of omitting schema names in queries. The means that getDomainId() can still return the right value, rather than confusingly omitt the schema. * Make RevisionStore::checkDatabaseWikiId() account for the domain schema. Unlike d2a4d614fce09c, this does not incorrectly assume the storage is always for the current wiki domain. Also, LBFactorySingle sets the local domain so it is defined even in install.php. * Make RevisionStoreDbTestBase actually set the LoadBalancer local domain. * Make RevisionTest::testLoadFromTitle() account for the domain schema. Bug: T193565 Change-Id: I6e51cd54c6da78830b38906b8c46789c79498ab5
* Introduce NameTableStoreFactoryTim Starling2018-09-041-0/+149
With a separate service for each of the NameTableStore tables, it wasn't possible to instantiate a NameTableStore for a foreign wiki, leading to the inelegant situation of having RevisionStoreFactory construct a new NameTableStoreFactory every time a RevisionStore for a foreign wiki was requested. These NameTableStore objects were not tracked in any structured way, so there was no way to reset them for tests. So, introduce NameTableStoreFactory, which tracks object instances for both local and remote table access. This also avoids having schema details in ServiceWiring.php. Depends-On: I5c78cfb8bf90eca935a3264592366f63517c4fad Bug: T202641 Change-Id: Ic0f2d1d94bad9dcc047ff19a1f92db89b7e014ce