Functionality related to updating the page table should be moved from WikiPage into a stateless PageStore service. For this purpose, entries in the page table are to be represented by PageRecord value objects.
Introducing a PageStore seems like a good opportunity to consolidate LinkCache with the internal title cache Logic in the Title class, and allow more code to be based on LinkTarget and PageIdentity (T208776) without being bound to Title.
Ad hoc draft of service interfaces:
interface PageLookup { function getPageById( int $pageId ) : ?PageRecord; function getPage( PageIdentity $identity ) : ?PageRecord; function getPageIdentity( int $namespace, string $name ) : PageIdentity; } interface PageBatchLookup { function getPageBatch( array $rows ) : array; // PageRecord[] function getPageIdentityBatch( array $rows ) : array; // PageIdentity[] } interface PageUpdaterFactory extends PageLookup { function getPageUpdater( PageIdentity $page, User $actor ) : PageUpdater; } interface PageUpdaterBackend { // internal, for use with PageUpdater function insertPageOn( PageIdentity $page, IDatabase $dbw ); function updateRevisionOn( PageIdentity $page, RevisionRecord $revision, IDatabase $dbw, $options = [] ); } interface PageStateBackend { // internal, for use with LinksUpdate function updateTouched( PageIdentity $page, string $timestamp = null ); }
Note that this does not block T174038: Initial implementation of MCR page update interface, nor does it block T194750: Deploy Structured Data on Commons baseline .