X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=includes%2FStorage%2FRevisionStore.php;h=e0ee06ad85b823511236e933f4284db3e29d08c1;hb=3e2fdb71ed8dab35934ce289d5e559153326028c;hp=09501096d9a3b993cb9b53ae78b4e6673ee8eb3d;hpb=8c1458b828329949046b92cd41a6fe8500c37bb1;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/Storage/RevisionStore.php b/includes/Storage/RevisionStore.php index 09501096d9..e0ee06ad85 100644 --- a/includes/Storage/RevisionStore.php +++ b/includes/Storage/RevisionStore.php @@ -562,10 +562,13 @@ class RevisionStore implements IDBAccessObject, RevisionFactory, RevisionLookup /** * MCR migration note: this replaces Revision::isUnpatrolled * + * @todo This is overly specific, so move or kill this method. + * * @param RevisionRecord $rev + * * @return int Rcid of the unpatrolled row, zero if there isn't one */ - public function isUnpatrolled( RevisionRecord $rev ) { + public function getRcIdIfUnpatrolled( RevisionRecord $rev ) { $rc = $this->getRecentChange( $rev ); if ( $rc && $rc->getAttribute( 'rc_patrolled' ) == 0 ) { return $rc->getAttribute( 'rc_id' ); @@ -953,7 +956,7 @@ class RevisionStore implements IDBAccessObject, RevisionFactory, RevisionLookup * @param string $timestamp * @return RevisionRecord|null */ - public function getRevisionFromTimestamp( $title, $timestamp ) { + public function getRevisionByTimestamp( $title, $timestamp ) { return $this->newRevisionFromConds( [ 'rev_timestamp' => $timestamp, @@ -1656,6 +1659,21 @@ class RevisionStore implements IDBAccessObject, RevisionFactory, RevisionLookup * * MCR migration note: this replaces Revision::getParentLengths * + * @param int[] $revIds + * @return int[] associative array mapping revision IDs from $revIds to the nominal size + * of the corresponding revision. + */ + public function getRevisionSizes( array $revIds ) { + return $this->listRevisionSizes( $this->getDBConnection( DB_REPLICA ), $revIds ); + } + + /** + * Do a batched query for the sizes of a set of revisions. + * + * MCR migration note: this replaces Revision::getParentLengths + * + * @deprecated use RevisionStore::getRevisionSizes instead. + * * @param IDatabase $db * @param int[] $revIds * @return int[] associative array mapping revision IDs from $revIds to the nominal size @@ -1689,11 +1707,14 @@ class RevisionStore implements IDBAccessObject, RevisionFactory, RevisionLookup * MCR migration note: this replaces Revision::getPrevious * * @param RevisionRecord $rev + * @param Title $title if known (optional) * * @return RevisionRecord|null */ - public function getPreviousRevision( RevisionRecord $rev ) { - $title = $this->getTitle( $rev->getPageId(), $rev->getId() ); + public function getPreviousRevision( RevisionRecord $rev, Title $title = null ) { + if ( $title === null ) { + $title = $this->getTitle( $rev->getPageId(), $rev->getId() ); + } $prev = $title->getPreviousRevisionID( $rev->getId() ); if ( $prev ) { return $this->getRevisionByTitle( $title, $prev ); @@ -1707,11 +1728,14 @@ class RevisionStore implements IDBAccessObject, RevisionFactory, RevisionLookup * MCR migration note: this replaces Revision::getNext * * @param RevisionRecord $rev + * @param Title $title if known (optional) * * @return RevisionRecord|null */ - public function getNextRevision( RevisionRecord $rev ) { - $title = $this->getTitle( $rev->getPageId(), $rev->getId() ); + public function getNextRevision( RevisionRecord $rev, Title $title = null ) { + if ( $title === null ) { + $title = $this->getTitle( $rev->getPageId(), $rev->getId() ); + } $next = $title->getNextRevisionID( $rev->getId() ); if ( $next ) { return $this->getRevisionByTitle( $title, $next );