Index: trunk/extensions/WikiTrust/includes/WikiTrustBase.php |
— | — | @@ -735,33 +735,13 @@ |
736 | 736 | |
737 | 737 | /* Utility function which returns the revid of the revision which is |
738 | 738 | * currently being displayed. |
739 | | - * It tries to do this using the global wgArticle object, and if this fails |
740 | | - * queries the DB directly. |
741 | 739 | * |
742 | 740 | * This is a replacement for getRevFTitle() and eliminates 1 db call. |
743 | 741 | */ |
744 | 742 | static function util_getRevFArticle() |
745 | 743 | { |
746 | | - // If no revid, assume it is the most recent one. |
747 | | - // Try using the article object, and only if this fails use the Title. |
748 | | - global $wgArticle; |
749 | | - $rev_id = 0; |
750 | | - if (method_exists($wgArticle, "getLatest")) |
751 | | - $rev_id = $wgArticle->getLatest(); |
752 | | - else { // Otherwise, ask the db for the latest revid for the given pageid. |
753 | | - global $wgTitle; |
754 | | - $rev_id = 0; |
755 | | - $page_id = $wgTitle->getArticleID(); |
756 | | - $dbr = wfGetDB( DB_SLAVE ); |
757 | | - $res = $dbr->select('page', array('page_latest'), |
758 | | - array('page_id' => $page_id), array()); |
759 | | - if ($res && $dbr->numRows($res) > 0) { |
760 | | - $row = $dbr->fetchRow($res); |
761 | | - $rev_id = $row['page_latest']; |
762 | | - } |
763 | | - $dbr->freeResult( $res ); |
764 | | - } |
765 | | - return $rev_id; |
| 744 | + global $wgTitle; |
| 745 | + return $wgTitle->getLatestRevID(); |
766 | 746 | } |
767 | 747 | |
768 | 748 | // Returns the current revid from the $out object. |