*/
class Revision implements IDBAccessObject {
protected $mId;
+
+ /**
+ * @var int|null
+ */
protected $mPage;
protected $mUserText;
protected $mOrigUserText;
protected $mComment;
protected $mText;
protected $mTextRow;
+
+ /**
+ * @var null|Title
+ */
protected $mTitle;
protected $mCurrent;
protected $mContentModel;
protected $mContentFormat;
+
+ /**
+ * @var Content
+ */
protected $mContent;
+
+ /**
+ * @var null|ContentHandler
+ */
protected $mContentHandler;
// Revision deletion constants
* @param $flags Integer Bitfield (optional)
* @return Revision or null
*/
- public static function newFromTitle( $title, $id = 0, $flags = null ) {
+ public static function newFromTitle( $title, $id = 0, $flags = 0 ) {
$conds = array(
'page_namespace' => $title->getNamespace(),
'page_title' => $title->getDBkey()
} else {
// Use a join to get the latest revision
$conds[] = 'rev_id=page_latest';
- // Callers assume this will be up-to-date
- $flags = is_int( $flags ) ? $flags : self::READ_LATEST; // b/c
}
return self::newFromConds( $conds, (int)$flags );
}
* @param $flags Integer Bitfield (optional)
* @return Revision or null
*/
- public static function newFromPageId( $pageId, $revId = 0, $flags = null ) {
+ public static function newFromPageId( $pageId, $revId = 0, $flags = 0 ) {
$conds = array( 'page_id' => $pageId );
if ( $revId ) {
$conds['rev_id'] = $revId;
} else {
// Use a join to get the latest revision
$conds[] = 'rev_id = page_latest';
- // Callers assume this will be up-to-date
- $flags = is_int( $flags ) ? $flags : self::READ_LATEST; // b/c
}
return self::newFromConds( $conds, (int)$flags );
}
* @param $row
* @param $overrides array
*
+ * @throws MWException
* @return Revision
*/
public static function newFromArchiveRow( $row, $overrides = array() ) {
* Constructor
*
* @param $row Mixed: either a database row or an array
+ * @throws MWException
* @access private
*/
function __construct( $row ) {
* @return String
*/
public function getText( $audience = self::FOR_PUBLIC, User $user = null ) {
- wfDeprecated( __METHOD__, '1.21' );
+ ContentHandler::deprecated( __METHOD__, '1.21' );
$content = $this->getContent( $audience, $user );
return ContentHandler::getContentText( $content ); # returns the raw content text, if applicable
* @param $user User object to check for, only if FOR_THIS_USER is passed
* to the $audience parameter
* @since 1.21
- * @return Content
+ * @return Content|null
*/
public function getContent( $audience = self::FOR_PUBLIC, User $user = null ) {
if( $audience == self::FOR_PUBLIC && $this->isDeleted( self::DELETED_TEXT ) ) {
* or Revision::getSerializedData() as appropriate.
*/
public function getRawText() {
- wfDeprecated( __METHOD__, "1.21" );
-
+ ContentHandler::deprecated( __METHOD__, "1.21" );
return $this->getText( self::RAW );
}
$handler = $this->getContentHandler();
$format = $this->getContentFormat();
- $title = $this->getTitle();
if( is_null( $this->mText ) ) {
// Load text on demand:
/**
* Returns the content handler appropriate for this revision's content model.
*
+ * @throws MWException
* @return ContentHandler
*/
public function getContentHandler() {
* number on success and dies horribly on failure.
*
* @param $dbw DatabaseBase: (master connection)
+ * @throws MWException
* @return Integer
*/
public function insertOn( $dbw ) {