$rootPage = strtok( $title->getText(), '/' );
$userFromTitle = User::newFromName( $rootPage, 'usable' );
if ( !$userFromTitle || $userFromTitle->getId() === 0 ) {
$rootPage = strtok( $title->getText(), '/' );
$userFromTitle = User::newFromName( $rootPage, 'usable' );
if ( !$userFromTitle || $userFromTitle->getId() === 0 ) {
switch ( $this->getRequest()->getText( 'direction' ) ) {
case 'next':
# output next revision, or nothing if there isn't one
switch ( $this->getRequest()->getText( 'direction' ) ) {
case 'next':
# output next revision, or nothing if there isn't one
- $previd = $this->getTitle()->getPreviousRevisionID( $oldid );
- $oldid = $previd ?: -1;
+ $oldRev = $rl->getRevisionById( $oldid );
+ if ( $oldRev ) {
+ $prevRev = $rl->getPreviousRevision( $oldRev );
+ }
+ $oldid = $prevRev ? $prevRev->getId() : -1;
- // Use getRawVal instead of getVal because we only
- // need to match against known strings, there is no
- // storing of localised content or other user input.
+ // Optimisation: Avoid slow getVal(), this isn't user-generated content.