| @@ 3911-3927 (lines=17) @@ | ||
| 3908 | * @param int $flags Title::GAID_FOR_UPDATE |
|
| 3909 | * @return int|bool Old revision ID, or false if none exists |
|
| 3910 | */ |
|
| 3911 | public function getPreviousRevisionID( $revId, $flags = 0 ) { |
|
| 3912 | $db = ( $flags & self::GAID_FOR_UPDATE ) ? wfGetDB( DB_MASTER ) : wfGetDB( DB_SLAVE ); |
|
| 3913 | $revId = $db->selectField( 'revision', 'rev_id', |
|
| 3914 | [ |
|
| 3915 | 'rev_page' => $this->getArticleID( $flags ), |
|
| 3916 | 'rev_id < ' . intval( $revId ) |
|
| 3917 | ], |
|
| 3918 | __METHOD__, |
|
| 3919 | [ 'ORDER BY' => 'rev_id DESC' ] |
|
| 3920 | ); |
|
| 3921 | ||
| 3922 | if ( $revId === false ) { |
|
| 3923 | return false; |
|
| 3924 | } else { |
|
| 3925 | return intval( $revId ); |
|
| 3926 | } |
|
| 3927 | } |
|
| 3928 | ||
| 3929 | /** |
|
| 3930 | * Get the revision ID of the next revision |
|
| @@ 3936-3952 (lines=17) @@ | ||
| 3933 | * @param int $flags Title::GAID_FOR_UPDATE |
|
| 3934 | * @return int|bool Next revision ID, or false if none exists |
|
| 3935 | */ |
|
| 3936 | public function getNextRevisionID( $revId, $flags = 0 ) { |
|
| 3937 | $db = ( $flags & self::GAID_FOR_UPDATE ) ? wfGetDB( DB_MASTER ) : wfGetDB( DB_SLAVE ); |
|
| 3938 | $revId = $db->selectField( 'revision', 'rev_id', |
|
| 3939 | [ |
|
| 3940 | 'rev_page' => $this->getArticleID( $flags ), |
|
| 3941 | 'rev_id > ' . intval( $revId ) |
|
| 3942 | ], |
|
| 3943 | __METHOD__, |
|
| 3944 | [ 'ORDER BY' => 'rev_id' ] |
|
| 3945 | ); |
|
| 3946 | ||
| 3947 | if ( $revId === false ) { |
|
| 3948 | return false; |
|
| 3949 | } else { |
|
| 3950 | return intval( $revId ); |
|
| 3951 | } |
|
| 3952 | } |
|
| 3953 | ||
| 3954 | /** |
|
| 3955 | * Get the first revision of the page |
|