* @file
*/
+use Wikimedia\Rdbms\Database;
use Wikimedia\Rdbms\IDatabase;
use MediaWiki\Linker\LinkTarget;
use MediaWiki\MediaWikiServices;
}
/**
- * Constructor
- *
* @param object|array $row Either a database row or an array
* @throws MWException
* @access private
* Revision::FOR_PUBLIC to be displayed to all users
* Revision::FOR_THIS_USER to be displayed to the given user
* Revision::RAW get the ID regardless of permissions
- * @param User $user User object to check for, only if FOR_THIS_USER is passed
+ * @param User|null $user User object to check for, only if FOR_THIS_USER is passed
* to the $audience parameter
* @return int
*/
* 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 $user User object to check for, only if FOR_THIS_USER is passed
+ * @param User|null $user User object to check for, only if FOR_THIS_USER is passed
* to the $audience parameter
* @return string
*/
* 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 $user User object to check for, only if FOR_THIS_USER is passed
+ * @param User|null $user User object to check for, only if FOR_THIS_USER is passed
* to the $audience parameter
* @return string
*/
return RecentChange::newFromConds(
[
- 'rc_user_text' => $this->getUserText( Revision::RAW ),
+ 'rc_user_text' => $this->getUserText( self::RAW ),
'rc_timestamp' => $dbr->timestamp( $this->getTimestamp() ),
'rc_this_oldid' => $this->getId()
],
? $this->getPreviousRevisionId( $dbw )
: $this->mParentId,
'rev_sha1' => $this->mSha1 === null
- ? Revision::base36Sha1( $this->mText )
+ ? self::base36Sha1( $this->mText )
: $this->mSha1,
];
$dbw->insert( 'revision', $row, __METHOD__ );
- $this->mId = $rev_id !== null ? $rev_id : $dbw->insertId();
+ if ( $this->mId === null ) {
+ // Only if nextSequenceValue() was called
+ $this->mId = $dbw->insertId();
+ }
// Assertion to try to catch T92046
if ( (int)$this->mId === 0 ) {
}
}
- $content = $this->getContent( Revision::RAW );
+ $content = $this->getContent( self::RAW );
$prefixedDBkey = $title->getPrefixedDBkey();
$revId = $this->mId;