- function getNext() {
- $next = $this->mTitle->getNextRevisionID( $this->mId );
- if ( $next ) {
- return Revision::newFromTitle( $this->mTitle, $next );
+ public function getNext() {
+ if( $this->getTitle() ) {
+ $next = $this->getTitle()->getNextRevisionID( $this->getId() );
+ if ( $next ) {
+ return Revision::newFromTitle( $this->getTitle(), $next );
+ }
+ }
+ return null;
+ }
+
+ /**
+ * Get previous revision Id for this page_id
+ * This is used to populate rev_parent_id on save
+ * @param Database $db
+ * @return int
+ */
+ private function getPreviousRevisionId( $db ) {
+ if( is_null($this->mPage) ) {
+ return 0;
+ }
+ # Use page_latest if ID is not given
+ if( !$this->mId ) {
+ $prevId = $db->selectField( 'page', 'page_latest',
+ array( 'page_id' => $this->mPage ),
+ __METHOD__ );