I believe this makes the code less brittle, and also makes it a bit
more obvious what these strings are meant to represent.
Change-Id: Ia39b5c80af4b495931d0a68fd091b783645dd709
Mostly used find-and-replace:
Find:
/\*[\*\s]+@var (I?[A-Z](\w+)(?:Interface)?)[\s\*]+/\s*(private|protected|public) (\$[a-z]\w+;\n)((?=\s*/\*[\*\s]+@var (I?[A-Z](\w+)(?:Interface)?))\n|)
Replace with:
\3 \1 \4
More could be done, but to keep this patch reasonably sized, I only
changed the most obvious and unambiguously correct cases.
In some cases, I also removed redundant doc comments on the
constructor, and re-ordered the properties to match the constructor.
Change-Id: I7eb97640c0543ae10bf2431623a5f7efdc3349b7
Use StatsFactory for emitting metrics from PageStore and add assertions
for the new metrics.
Bug: T359374
Change-Id: Id099f54eb79a2dce078259cf9c13e548c1ec56f2
Passing an argument of type Generator for the $haystack parameter is
deprecated. Support for this will be removed in PHPUnit 10.
Bug: T342110
Change-Id: Id7c33972836be815622e1495ad2bcbbf952b7493
This is inconsistent with the access pattern of other constants in
MediaWiki. it's also confusing (e.g. it's unclear to a newcomer why
UserFactory is implementing IDBAccessObject) and it's prone to clashes
(e.g. BagOStuff class has a clashing constant).
It has been already announced: https://w.wiki/9DAX
Bug: T354194
Change-Id: Ic2357634b8385d65b55db2b557191419b06c40e0
Just methods where adding "static" to the declaration was enough, I
didn't do anything with providers that used $this.
Initially by search and replace. There were many mistakes which I
found mostly by running the PHPStorm inspection which searches for
$this usage in a static method. Later I used the PHPStorm "make static"
action which avoids the more obvious mistakes.
Bug: T332865
Change-Id: I47ed6692945607dfa5c139d42edbd934fa4f3a36
This just makes the class overly complex and defies the whole point of
having this class in the first place (=delaying getting db connections).
It makes it harder to read and understand and specially polymorphic
arguments are quite confusing.
It also would break the reloading db on the fly (I6c3ffde62f6e), users
of DBConnectionRef should not know about the underlying connection, this
class is trying encpsulate that and accepting connection in constructor
breaks this encapsulation.
Bug: T298485
Depends-On: I951ab99ae766788dbae8bd338aaae114a388b21f
Change-Id: I743c0565504c65c4dedf29f2a36d4c386601fda0
These are needed PageStoreRecord::REQUIRED_FIELDS and that's why putting
PageStore on top of LinkCache caused a lot of increase in db reads.
Bug: T297669
Change-Id: If77c2f9879d7bae71eb59944efd8b3798d16aa46
Calling getPageById when the page ID is known was supposed to improve
query performance, but since it bypasses LinkCache, it ended up causing a
spike in database queries.
This optimization can be re-introduced once we also cache PageRecords by ID.
Bug: T296063
Change-Id: Ia4ee75b7b5a71d7d858f818d6467793bc642697b
In a preview rendering the TitleExists hook is set globally
by ParserOptions::setupFakeRevision, so PageStore can't really
trust the result of Title::exists.
Bug: T295931
Change-Id: I9a98fa95ae7c732f2b9724810cd477815e838dcc
addGoodLinkObj() has many optional arguments, but omitting them actually
means corrupting the cache.
Nearly all existing callers are in tests.
So LinkCacheTestTrait::addGoodLinkObject() was created only
for testing. It is better to have this method in the
trait, because building the row directly in each test
would make these tests brittle against schema changes.
The only usage in WMF production code was in WikiPage and has been
fixed.
Bug: T284955
Change-Id: I03a2bd9ed64fcc0281ee29a286c8db395a9e03d9
This makes the data stored by LinkCache compatible with PageStoreRecord,
so we can use LinkCache inside PageStore.
This causes PageStore to make use of local caching as well as WANObjectCache.
Note that getPageById() does not yet benefit from cache, but does
populate the cache.
Bug: T278940
Change-Id: Icc27a0d9299a3e4ce45521daef87ad06ec06f064
In order to prevent bad titles from entering the database,
PageIdentityValue should not allow instances that have obviously broken
dbeys, just like it does not allow construction for a special page.
Note however that for now, we allow PageReferenceValue to represent
thigns that are not actual pages, such as titles like "User:#1234" which
are used in the block log to represent autoblock targets. Similarly,
a PageReferenceValue can represent a special page.
This patch introduces a convenience method for constructing
PageIdentityValues in a context where it is uncertain whetehr the title
is valid, providing an opportunity to the caller to report in which
context the bad values were found.
In addition, this patch adds some documentation and testing, to clarify
the semantics of methods in PageStore with respect to invalid and non-
proper titles.
Bug: T282070
Change-Id: I8a44d9e73dda8fe38d009847332946809767d0fa
This explores the idea of a PageReference type which represents a
namespace/dbkey pair.
Every ProperPageIdentity is a PageReference. Some LinkTargets can be
mapped to a PageReference.
Bug: T279522
Change-Id: Id8b0c781fce329adcc4770f4840b2ba0108f6898
Title::getPageLanguage has complex logic to determine the effictive
language of the page. PageRecord is a storage layer primitive and should
not haveknowledge of such logic, nor should PageStore.
The effective content language of a page needs to be determined
programmatically, see discussion on the ticket.
Bug: T278591
Change-Id: Ic26f6f7690499b3dd87982e3822881fd473cfd68
PageStore is unused so far, usage will be demonstrated in follow-up
patches.
For now, this only implements the lookup (read) functionality of
PageStore.
Bug: T195069
Change-Id: I25cb9945795ecaf2d0b816a5abc7362424d11ba4