+ $rec = $this->getRevisionByConditions(
+ [ 'ar_timestamp' => $dbr->timestamp( $timestamp ) ]
+ );
+ return $rec ? new Revision( $rec ) : null;
+ }
+
+ /**
+ * Return the archived revision with the given ID.
+ *
+ * @param int $revId
+ * @return Revision|null
+ */
+ public function getArchivedRevision( $revId ) {
+ // Protect against code switching from getRevision() passing in a timestamp.
+ Assert::parameterType( 'integer', $revId, '$revId' );
+
+ $rec = $this->getRevisionByConditions( [ 'ar_rev_id' => $revId ] );
+ return $rec ? new Revision( $rec ) : null;
+ }
+
+ /**
+ * @param array $conditions
+ * @param array $options
+ *
+ * @return RevisionRecord|null
+ */
+ private function getRevisionByConditions( array $conditions, array $options = [] ) {
+ $dbr = wfGetDB( DB_REPLICA );
+ $arQuery = $this->getRevisionStore()->getArchiveQueryInfo();
+
+ $conditions = $conditions + [
+ 'ar_namespace' => $this->title->getNamespace(),
+ 'ar_title' => $this->title->getDBkey(),
+ ];