$attribs = $overrides + [
'page' => isset( $row->ar_page_id ) ? $row->ar_page_id : null,
'id' => isset( $row->ar_rev_id ) ? $row->ar_rev_id : null,
- 'comment' => $row->ar_comment,
+ 'comment' => CommentStore::newKey( 'ar_comment' )
+ // Legacy because $row probably came from self::selectArchiveFields()
+ ->getCommentLegacy( wfGetDB( DB_REPLICA ), $row, true )->text,
'user' => $row->ar_user,
'user_text' => $row->ar_user_text,
'timestamp' => $row->ar_timestamp,
/**
* Return the list of revision fields that should be selected to create
* a new revision.
+ * @todo Deprecate this in favor of a method that returns tables and joins
+ * as well, and use CommentStore::getJoin().
* @return array
*/
public static function selectFields() {
'rev_page',
'rev_text_id',
'rev_timestamp',
- 'rev_comment',
'rev_user_text',
'rev_user',
'rev_minor_edit',
'rev_sha1',
];
+ $fields += CommentStore::newKey( 'rev_comment' )->getFields();
+
if ( $wgContentHandlerUseDB ) {
$fields[] = 'rev_content_format';
$fields[] = 'rev_content_model';
/**
* Return the list of revision fields that should be selected to create
* a new revision from an archive row.
+ * @todo Deprecate this in favor of a method that returns tables and joins
+ * as well, and use CommentStore::getJoin().
* @return array
*/
public static function selectArchiveFields() {
'ar_text',
'ar_text_id',
'ar_timestamp',
- 'ar_comment',
'ar_user_text',
'ar_user',
'ar_minor_edit',
'ar_sha1',
];
+ $fields += CommentStore::newKey( 'ar_comment' )->getFields();
+
if ( $wgContentHandlerUseDB ) {
$fields[] = 'ar_content_format';
$fields[] = 'ar_content_model';
$this->mId = intval( $row->rev_id );
$this->mPage = intval( $row->rev_page );
$this->mTextId = intval( $row->rev_text_id );
- $this->mComment = $row->rev_comment;
+ $this->mComment = CommentStore::newKey( 'rev_comment' )
+ // Legacy because $row probably came from self::selectFields()
+ ->getCommentLegacy( wfGetDB( DB_REPLICA ), $row, true )->text;
$this->mUser = intval( $row->rev_user );
$this->mMinorEdit = intval( $row->rev_minor_edit );
$this->mTimestamp = $row->rev_timestamp;
* This should only be used for proposed revisions that turn out to be null edits
*
* @since 1.28
- * @param integer $id User ID
+ * @param int $id User ID
* @param string $name User name
*/
public function setUserIdAndName( $id, $name ) {
* 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
*/
* data is compressed, and 'utf-8' if we're saving in UTF-8
* mode.
*
- * @param mixed $text Reference to a text
+ * @param mixed &$text Reference to a text
* @return string
*/
public static function compressRevisionText( &$text ) {
'rev_id' => $rev_id,
'rev_page' => $this->mPage,
'rev_text_id' => $this->mTextId,
- 'rev_comment' => $this->mComment,
'rev_minor_edit' => $this->mMinorEdit ? 1 : 0,
'rev_user' => $this->mUser,
'rev_user_text' => $this->mUserText,
: $this->mSha1,
];
+ list( $commentFields, $commentCallback ) =
+ CommentStore::newKey( 'rev_comment' )->insertWithTempTable( $dbw, $this->mComment );
+ $row += $commentFields;
+
if ( $wgContentHandlerUseDB ) {
// NOTE: Store null for the default model and format, to save space.
// XXX: Makes the DB sensitive to changed defaults.
// Only if nextSequenceValue() was called
$this->mId = $dbw->insertId();
}
+ $commentCallback( $this->mId );
// Assertion to try to catch T92046
if ( (int)$this->mId === 0 ) {
* Get the text cache TTL
*
* @param WANObjectCache $cache
- * @return integer
+ * @return int
*/
private static function getCacheTTL( WANObjectCache $cache ) {
global $wgRevisionCacheExpiry;