@@ 3953-3969 (lines=17) @@ | ||
3950 | * @param int $flags Title::GAID_FOR_UPDATE |
|
3951 | * @return int|bool Old revision ID, or false if none exists |
|
3952 | */ |
|
3953 | public function getPreviousRevisionID( $revId, $flags = 0 ) { |
|
3954 | $db = ( $flags & self::GAID_FOR_UPDATE ) ? wfGetDB( DB_MASTER ) : wfGetDB( DB_REPLICA ); |
|
3955 | $revId = $db->selectField( 'revision', 'rev_id', |
|
3956 | [ |
|
3957 | 'rev_page' => $this->getArticleID( $flags ), |
|
3958 | 'rev_id < ' . intval( $revId ) |
|
3959 | ], |
|
3960 | __METHOD__, |
|
3961 | [ 'ORDER BY' => 'rev_id DESC' ] |
|
3962 | ); |
|
3963 | ||
3964 | if ( $revId === false ) { |
|
3965 | return false; |
|
3966 | } else { |
|
3967 | return intval( $revId ); |
|
3968 | } |
|
3969 | } |
|
3970 | ||
3971 | /** |
|
3972 | * Get the revision ID of the next revision |
|
@@ 3978-3994 (lines=17) @@ | ||
3975 | * @param int $flags Title::GAID_FOR_UPDATE |
|
3976 | * @return int|bool Next revision ID, or false if none exists |
|
3977 | */ |
|
3978 | public function getNextRevisionID( $revId, $flags = 0 ) { |
|
3979 | $db = ( $flags & self::GAID_FOR_UPDATE ) ? wfGetDB( DB_MASTER ) : wfGetDB( DB_REPLICA ); |
|
3980 | $revId = $db->selectField( 'revision', 'rev_id', |
|
3981 | [ |
|
3982 | 'rev_page' => $this->getArticleID( $flags ), |
|
3983 | 'rev_id > ' . intval( $revId ) |
|
3984 | ], |
|
3985 | __METHOD__, |
|
3986 | [ 'ORDER BY' => 'rev_id' ] |
|
3987 | ); |
|
3988 | ||
3989 | if ( $revId === false ) { |
|
3990 | return false; |
|
3991 | } else { |
|
3992 | return intval( $revId ); |
|
3993 | } |
|
3994 | } |
|
3995 | ||
3996 | /** |
|
3997 | * Get the first revision of the page |