$form->setDisplayFormat( 'vform' ); // throws exception
Instead, do this:
$form = HTMLForm::factory( 'vform', … );
+* Deprecated Revision methods getRawUser(), getRawUserText() and getRawComment().
== Compatibility ==
* @return string HTML fragment
*/
public static function revComment( Revision $rev, $local = false, $isPublic = false ) {
- if ( $rev->getRawComment() == "" ) {
+ if ( $rev->getComment( Revision::RAW ) == "" ) {
return "";
}
if ( $rev->isDeleted( Revision::DELETED_COMMENT ) && $isPublic ) {
$editCount = 0;
$moreRevs = false;
foreach ( $res as $row ) {
- if ( $rev->getRawUserText() != $row->rev_user_text ) {
+ if ( $rev->getUserText( Revision::RAW ) != $row->rev_user_text ) {
if ( $verify &&
( $row->rev_deleted & Revision::DELETED_TEXT
|| $row->rev_deleted & Revision::DELETED_USER
* Fetch revision's user id without regard for the current user's permissions
*
* @return string
+ * @deprecated since 1.25, use getUser( Revision::RAW )
*/
public function getRawUser() {
- return $this->mUser;
+ wfDeprecated( __METHOD__, '1.25' );
+ return $this->getUser( self::RAW );
}
/**
} elseif ( $audience == self::FOR_THIS_USER && !$this->userCan( self::DELETED_USER, $user ) ) {
return '';
} else {
- return $this->getRawUserText();
+ if ( $this->mUserText === null ) {
+ $this->mUserText = User::whoIs( $this->mUser ); // load on demand
+ if ( $this->mUserText === false ) {
+ # This shouldn't happen, but it can if the wiki was recovered
+ # via importing revs and there is no user table entry yet.
+ $this->mUserText = $this->mOrigUserText;
+ }
+ }
+ return $this->mUserText;
}
}
* Fetch revision's username without regard for view restrictions
*
* @return string
+ * @deprecated since 1.25, use getUserText( Revision::RAW )
*/
public function getRawUserText() {
- if ( $this->mUserText === null ) {
- $this->mUserText = User::whoIs( $this->mUser ); // load on demand
- if ( $this->mUserText === false ) {
- # This shouldn't happen, but it can if the wiki was recovered
- # via importing revs and there is no user table entry yet.
- $this->mUserText = $this->mOrigUserText;
- }
- }
- return $this->mUserText;
+ wfDeprecated( __METHOD__, '1.25' );
+ return $this->getUserText( self::RAW );
}
/**
* Fetch revision comment without regard for the current user's permissions
*
* @return string
+ * @deprecated since 1.25, use getComment( Revision::RAW )
*/
public function getRawComment() {
- return $this->mComment;
+ wfDeprecated( __METHOD__, '1.25' );
+ return $this->getComment( self::RAW );
}
/**
$dbr = wfGetDB( DB_SLAVE );
return RecentChange::newFromConds(
array(
- 'rc_user_text' => $this->getRawUserText(),
+ 'rc_user_text' => $this->getUserText( Revision::RAW ),
'rc_timestamp' => $dbr->timestamp( $this->getTimestamp() ),
'rc_this_oldid' => $this->getId()
),
}
// No DB query needed if $old and $new are the same or successive revisions:
if ( $old->getId() === $new->getId() ) {
- return ( $old_cmp === '>' && $new_cmp === '<' ) ? array() : array( $old->getRawUserText() );
+ return ( $old_cmp === '>' && $new_cmp === '<' ) ?
+ array() :
+ array( $old->getUserText( Revision::RAW ) );
} elseif ( $old->getId() === $new->getParentId() ) {
if ( $old_cmp === '>=' && $new_cmp === '<=' ) {
- $authors[] = $old->getRawUserText();
- if ( $old->getRawUserText() != $new->getRawUserText() ) {
- $authors[] = $new->getRawUserText();
+ $authors[] = $old->getUserText( Revision::RAW );
+ if ( $old->getUserText( Revision::RAW ) != $new->getUserText( Revision::RAW ) ) {
+ $authors[] = $new->getUserText( Revision::RAW );
}
} elseif ( $old_cmp === '>=' ) {
- $authors[] = $old->getRawUserText();
+ $authors[] = $old->getUserText( Revision::RAW );
} elseif ( $new_cmp === '<=' ) {
- $authors[] = $new->getRawUserText();
+ $authors[] = $new->getUserText( Revision::RAW );
}
return $authors;
}
}
if ( $revision->userCan( Revision::DELETED_USER, $user ) ) {
if ( $this->fld_user ) {
- $vals['user'] = $revision->getRawUserText();
+ $vals['user'] = $revision->getUserText( Revision::RAW );
}
- $userid = $revision->getRawUser();
+ $userid = $revision->getUser( Revision::RAW );
if ( !$userid ) {
$vals['anon'] = '';
}
$anyHidden = true;
}
if ( $revision->userCan( Revision::DELETED_COMMENT, $user ) ) {
- $comment = $revision->getRawComment();
+ $comment = $revision->getComment( Revision::RAW );
if ( $this->fld_comment ) {
$vals['comment'] = $comment;
$users = $this->mNewPage->getAuthorsBetween( $oldRev, $newRev, $limit );
$numUsers = count( $users );
- if ( $numUsers == 1 && $users[0] == $newRev->getRawUserText() ) {
+ if ( $numUsers == 1 && $users[0] == $newRev->getUserText( Revision::RAW ) ) {
$numUsers = 0; // special case to say "by the same user" instead of "by one other user"
}
// Get the last edit not by this guy...
// Note: these may not be public values
- $user = intval( $current->getRawUser() );
- $user_text = $dbw->addQuotes( $current->getRawUserText() );
+ $user = intval( $current->getUser( Revision::RAW ) );
+ $user_text = $dbw->addQuotes( $current->getUserText( Revision::RAW ) );
$s = $dbw->selectRow( 'revision',
array( 'rev_id', 'rev_timestamp', 'rev_deleted' ),
array( 'rev_page' => $current->getPage(),
'title' => $article->getTitle(), // used to derive default content model
)
);
- $user = User::newFromName( $revision->getRawUserText(), false );
+ $user = User::newFromName( $revision->getUserText( Revision::RAW ), false );
$content = $revision->getContent( Revision::RAW );
//NOTE: article ID may not be known yet. prepareSave() should not modify the database.
$wasnew = $article->updateIfNewerOn( $dbw, $revision, $previousRevId );
if ( $created || $wasnew ) {
// Update site stats, link tables, etc
- $user = User::newFromName( $revision->getRawUserText(), false );
+ $user = User::newFromName( $revision->getUserText( Revision::RAW ), false );
$article->doEditUpdates(
$revision,
$user,