*/
public static function newFromId( $id, $flags = 0 ) {
$rec = self::getRevisionLookup()->getRevisionById( $id, $flags );
- return $rec === null ? null : new Revision( $rec, $flags );
+ return $rec ? new Revision( $rec, $flags ) : null;
}
/**
*/
public static function newFromTitle( LinkTarget $linkTarget, $id = 0, $flags = 0 ) {
$rec = self::getRevisionLookup()->getRevisionByTitle( $linkTarget, $id, $flags );
- return $rec === null ? null : new Revision( $rec, $flags );
+ return $rec ? new Revision( $rec, $flags ) : null;
}
/**
*/
public static function newFromPageId( $pageId, $revId = 0, $flags = 0 ) {
$rec = self::getRevisionLookup()->getRevisionByPageId( $pageId, $revId, $flags );
- return $rec === null ? null : new Revision( $rec, $flags );
+ return $rec ? new Revision( $rec, $flags ) : null;
}
/**
public static function loadFromId( $db, $id ) {
wfDeprecated( __METHOD__, '1.31' ); // no known callers
$rec = self::getRevisionStore()->loadRevisionFromId( $db, $id );
- return $rec === null ? null : new Revision( $rec );
+ return $rec ? new Revision( $rec ) : null;
}
/**
*/
public static function loadFromPageId( $db, $pageid, $id = 0 ) {
$rec = self::getRevisionStore()->loadRevisionFromPageId( $db, $pageid, $id );
- return $rec === null ? null : new Revision( $rec );
+ return $rec ? new Revision( $rec ) : null;
}
/**
*/
public static function loadFromTitle( $db, $title, $id = 0 ) {
$rec = self::getRevisionStore()->loadRevisionFromTitle( $db, $title, $id );
- return $rec === null ? null : new Revision( $rec );
+ return $rec ? new Revision( $rec ) : null;
}
/**
*/
public static function loadFromTimestamp( $db, $title, $timestamp ) {
$rec = self::getRevisionStore()->loadRevisionFromTimestamp( $db, $title, $timestamp );
- return $rec === null ? null : new Revision( $rec );
+ return $rec ? new Revision( $rec ) : null;
}
/**
*/
public static function pageJoinCond() {
wfDeprecated( __METHOD__, '1.31' );
- return [ 'INNER JOIN', [ 'page_id = rev_page' ] ];
+ return [ 'JOIN', [ 'page_id = rev_page' ] ];
}
/**
* @param int $queryFlags
* @param Title|null $title
*
- * @access private
+ * @private
*/
function __construct( $row, $queryFlags = 0, Title $title = null ) {
global $wgUser;
}
/**
- * Fetch revision comment if it's available to the specified audience.
- * If the specified audience does not have access to the comment, an
- * empty string will be returned.
- *
* @param int $audience One of:
* Revision::FOR_PUBLIC to be displayed to all users
* Revision::FOR_THIS_USER to be displayed to the given user
* Revision::RAW get the text regardless of permissions
* @param User|null $user User object to check for, only if FOR_THIS_USER is passed
* to the $audience parameter
- * @return string
+ *
+ * @return string|null Returns null if the specified audience does not have access to the
+ * comment.
*/
function getComment( $audience = self::FOR_PUBLIC, User $user = null ) {
global $wgUser;
* @return Revision|null
*/
public function getPrevious() {
- $title = $this->getTitle();
- $rec = self::getRevisionLookup()->getPreviousRevision( $this->mRecord, $title );
- return $rec === null ? null : new Revision( $rec, self::READ_NORMAL, $title );
+ $rec = self::getRevisionLookup()->getPreviousRevision( $this->mRecord );
+ return $rec ? new Revision( $rec, self::READ_NORMAL, $this->getTitle() ) : null;
}
/**
* @return Revision|null
*/
public function getNext() {
- $title = $this->getTitle();
- $rec = self::getRevisionLookup()->getNextRevision( $this->mRecord, $title );
- return $rec === null ? null : new Revision( $rec, self::READ_NORMAL, $title );
+ $rec = self::getRevisionLookup()->getNextRevision( $this->mRecord );
+ return $rec ? new Revision( $rec, self::READ_NORMAL, $this->getTitle() ) : null;
}
/**
/**
* Get rev_timestamp from rev_id, without loading the rest of the row
*
- * @param Title $title
+ * @param Title $title (ignored since 1.34)
* @param int $id
* @param int $flags
* @return string|bool False if not found
*/
static function getTimestampFromId( $title, $id, $flags = 0 ) {
- return self::getRevisionStore()->getTimestampFromId( $title, $id, $flags );
+ return self::getRevisionStore()->getTimestampFromId( $id, $flags );
}
/**