Commit graph

19 commits

Author SHA1 Message Date
Umherirrender
d7248d63fb Fix various documentation related to null types (part II)
The functions returning null or the class property is set explict null.
Some function should not accept null or return null.

Found by phan strict checks

Change-Id: Ie50f23249282cdb18caa332f562a3945a58d86ff
2022-03-08 23:45:31 +00:00
daniel
e42e3c1f3a PageStore: fill in some missing fields
Change-Id: I9e8bc1a43bd93863471e80f164eec66cc47a8e18
2021-12-14 14:43:11 +01:00
daniel
de63ad823a PageStore: avoid getPageById, since it bypasses caching.
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
2021-11-22 17:24:13 +01:00
Petr Pchelko
533659a43a Don't trust Title that if it exists pageId will be > 0
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
2021-11-17 15:13:09 -08:00
daniel
fd3a695230 Title: use PageStore instead of LinkCache
This causes Title to no longer look up fields in the database
individually, but use LinkCache instead to load an entire row from the
page table at once.

This patch also causes Title to use in-process caching for some
getters that did not use caching before, such as isNewPage()
and getTouched(). These methods do not appear to be used on critical
code paths that involve database updates.

Note that getTouched() used to take an options $db parametr. This
appears to be unused, and has been deprecated in favor of a $flags
parameter, for consistency with other getters on the class.

DEPLOY: Risky! This re-implements the internal caching logic of Title
and slightly modifies caching semantics in some cases. This may have
unforeseen consequences.

Bug: T285389
Depends-On: I103b9e1d2bf594bfc1b0ea12b980dd20bb911c3a
Change-Id: I2df81df7186025e001520f24fd498623c7184772
2021-11-02 23:12:47 +01:00
Lucas Werkmeister
3393545f44 Fix return type of PageStore::newSelectQueryBuilder()
Only the PageSelectQueryBuilder subclass has the methods that are
interesting for users of this method.

Bug: T291288
Change-Id: If73748cc24d2ab2ee7999db14201d7fc19b2cd34
2021-10-18 11:56:17 +02:00
jenkins-bot
1efeefe017 Merge "PageStore: Use LinkCache" 2021-09-09 20:04:47 +00:00
Umherirrender
07b499fbcf build: Update mediawiki/mediawiki-phan-config to 0.11.0
Addition and remove of suppression needs to be done with the version
update.

Change-Id: I3288b3cefa744b507eadebb67b8ab08c86517c1c
2021-09-07 17:19:05 +02:00
daniel
3b6345ca16 PageStore: Use LinkCache
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
2021-09-01 08:24:34 +00:00
Bartosz Dziewoński
3f897fdd8f PageStore: Pass query flags to getPageById() too
Follows-up 8ba4aad647,
073c90e176.

Bug: T289717
Bug: T195069
Change-Id: I7b3c9c891d235d641cc623d518bb7ad78b297c5b
2021-08-26 17:58:19 +02:00
Bartosz Dziewoński
073c90e176 PageStore: Pass query flags to getPageByName()
Follows-up 8ba4aad647.

Bug: T289717
Bug: T195069
Change-Id: I2a614915c7d9ffbc4f466204b2684478fb52f30e
2021-08-25 19:59:03 +00:00
James D. Forrester
f2f9345e39 Replace uses of DB_MASTER with DB_PRIMARY in documentation and local variables
This is just a start.

Bug: T254646
Change-Id: I9213aad4660e27afe7ff9e5d2e730cbf03911068
2021-05-14 12:40:34 -07:00
daniel
62176bec1b PageIdentityValue: apply basic validation of titles
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
2021-05-07 17:17:45 +02:00
Petr Pchelko
4ca16e8d08 Eliminate use of Title object in REST infrastructure
Change-Id: I585f0f23cac5f6dc2a4879f69f7b83828fda3dd3
2021-05-05 18:54:58 -07:00
daniel
5faa080374 Introduce PageReference
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
2021-04-13 23:32:20 +02:00
daniel
a4b73eb217 PageRecord: make language optional
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
2021-04-08 20:16:36 +02:00
daniel
fe9430947d Use PageStore in RevisionStore
This introduces PageStoreFactory as well.

Change-Id: I7abd3c6a8ea70a68e8f8e9460d3bdd8c6f45338a
2021-04-05 20:58:54 +02:00
daniel
d4b380ab27 Introduce PageSelectQueryBuilder
Change-Id: Ibcb37affa9ba1c891bc62964a3dd34b67214cfa1
2021-03-24 19:15:01 +01:00
daniel
8ba4aad647 Introduce PageStore
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
2021-03-23 15:20:03 -06:00