| @@ 3924-3940 (lines=17) @@ | ||
| 3921 | * @param int $flags Title::GAID_FOR_UPDATE |
|
| 3922 | * @return int|bool Old revision ID, or false if none exists |
|
| 3923 | */ |
|
| 3924 | public function getPreviousRevisionID( $revId, $flags = 0 ) { |
|
| 3925 | $db = ( $flags & self::GAID_FOR_UPDATE ) ? wfGetDB( DB_MASTER ) : wfGetDB( DB_SLAVE ); |
|
| 3926 | $revId = $db->selectField( 'revision', 'rev_id', |
|
| 3927 | [ |
|
| 3928 | 'rev_page' => $this->getArticleID( $flags ), |
|
| 3929 | 'rev_id < ' . intval( $revId ) |
|
| 3930 | ], |
|
| 3931 | __METHOD__, |
|
| 3932 | [ 'ORDER BY' => 'rev_id DESC' ] |
|
| 3933 | ); |
|
| 3934 | ||
| 3935 | if ( $revId === false ) { |
|
| 3936 | return false; |
|
| 3937 | } else { |
|
| 3938 | return intval( $revId ); |
|
| 3939 | } |
|
| 3940 | } |
|
| 3941 | ||
| 3942 | /** |
|
| 3943 | * Get the revision ID of the next revision |
|
| @@ 3949-3965 (lines=17) @@ | ||
| 3946 | * @param int $flags Title::GAID_FOR_UPDATE |
|
| 3947 | * @return int|bool Next revision ID, or false if none exists |
|
| 3948 | */ |
|
| 3949 | public function getNextRevisionID( $revId, $flags = 0 ) { |
|
| 3950 | $db = ( $flags & self::GAID_FOR_UPDATE ) ? wfGetDB( DB_MASTER ) : wfGetDB( DB_SLAVE ); |
|
| 3951 | $revId = $db->selectField( 'revision', 'rev_id', |
|
| 3952 | [ |
|
| 3953 | 'rev_page' => $this->getArticleID( $flags ), |
|
| 3954 | 'rev_id > ' . intval( $revId ) |
|
| 3955 | ], |
|
| 3956 | __METHOD__, |
|
| 3957 | [ 'ORDER BY' => 'rev_id' ] |
|
| 3958 | ); |
|
| 3959 | ||
| 3960 | if ( $revId === false ) { |
|
| 3961 | return false; |
|
| 3962 | } else { |
|
| 3963 | return intval( $revId ); |
|
| 3964 | } |
|
| 3965 | } |
|
| 3966 | ||
| 3967 | /** |
|
| 3968 | * Get the first revision of the page |
|