Exemple #1
0
 /**
  * Get previous revision Id for this page_id
  * This is used to populate rev_parent_id on save
  *
  * @param IDatabase $db
  * @return int
  */
 private function getPreviousRevisionId($db)
 {
     if ($this->mPage === null) {
         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__);
     } else {
         $prevId = $db->selectField('revision', 'rev_id', array('rev_page' => $this->mPage, 'rev_id < ' . $this->mId), __METHOD__, array('ORDER BY' => 'rev_id DESC'));
     }
     return intval($prevId);
 }