Index: trunk/phase3/includes/Revision.php |
— | — | @@ -564,20 +564,15 @@ |
565 | 565 | } |
566 | 566 | # Use page_latest if ID is not given |
567 | 567 | if( !$this->mId ) { |
568 | | - $revID = $db->selectField( 'page', 'page_latest', |
| 568 | + $prevID = $db->selectField( 'page', 'page_latest', |
569 | 569 | array( 'page_id' => $this->mPage ), |
570 | 570 | __METHOD__ ); |
571 | 571 | } else { |
572 | | - $revID = $this->mId; |
| 572 | + $prevId = $db->selectField( 'revision', 'rev_id', |
| 573 | + array( 'rev_page' => $this->mPage, 'rev_id < ' . $this->mId ), |
| 574 | + __METHOD__, |
| 575 | + array( 'ORDER BY' => 'rev_id DESC' ) ); |
573 | 576 | } |
574 | | - if( !$revID ) { |
575 | | - return 0; |
576 | | - } |
577 | | - $prevId = $db->selectField( 'revision', 'rev_id', |
578 | | - array( 'rev_page' => $this->mPage, 'rev_id < ' . $revID ), |
579 | | - __METHOD__, |
580 | | - array( 'ORDER BY' => 'rev_id DESC' ) ); |
581 | | - # Always return an integer |
582 | 577 | return intval($prevId); |
583 | 578 | } |
584 | 579 | |