- $continue = 2;
- $db = wfGetDB( DB_REPLICA );
- $revSelectFields = Revision::selectFields();
-
- $row = null;
- while ( $continue ) {
- $row = $db->selectRow(
- [ 'revision' ],
- $revSelectFields,
- [
- 'rev_page' => $this->getId()
- ],
- __METHOD__,
- [
- 'ORDER BY' => 'rev_timestamp ASC'
- ]
- );
-
- if ( $row ) {
- $continue = 0;
- } else {
- $db = wfGetDB( DB_MASTER );
- $continue--;
- }
+ $rev = $this->mTitle->getFirstRevision();
+ if ( !$rev ) {
+ $rev = $this->mTitle->getFirstRevision( Title::GAID_FOR_UPDATE );