Hard deprecate Article::getUser and WikiPage::getUser fallback
WikiPage::getUser requires a user if the audience is FOR_THIS_USER Bug: T248291 Change-Id: I07f349420595e68e94c2aec5c84b808163ee3b4f
This commit is contained in:
parent
0d2c52919c
commit
e1156f95d9
3 changed files with 14 additions and 1 deletions
|
|
@ -603,6 +603,8 @@ because of Phabricator reports.
|
|||
is set to something other than the default of 'public')
|
||||
- WikiPage::getCreator (only when the 'audience' parameter is set to
|
||||
Revision::FOR_THIS_USER)
|
||||
- WikiPage::getUser (only when the 'audience' parameter is set to
|
||||
Revision::FOR_THIS_USER)
|
||||
- WikiPage::getUserText (only when the 'audience' parameter is set to
|
||||
Revision::FOR_THIS_USER)
|
||||
- LogPage::addEntry
|
||||
|
|
@ -616,6 +618,7 @@ because of Phabricator reports.
|
|||
WikiPage::doDeleteArticleReal.
|
||||
* Article::getComment is deprecated. Instead, use WikiPage::getComment.
|
||||
* Article::getCreator is deprecated. Instead, use WikiPage::getCreator.
|
||||
* Article::getUser is deprecated. Instead, use WikiPage::getUser.
|
||||
* Article::getUserText is deprecated. Instead, use WikiPage::getUserText.
|
||||
* LocalFileDeleteBatch was migrated to a new constructor signature with the
|
||||
user as the second parameter. Support for the old signature is hard
|
||||
|
|
|
|||
|
|
@ -2640,12 +2640,14 @@ class Article implements Page {
|
|||
|
||||
/**
|
||||
* Call to WikiPage function for backwards compatibility.
|
||||
* @deprecated since 1.35
|
||||
* @see WikiPage::getUser
|
||||
* @param int $audience
|
||||
* @param User|null $user
|
||||
* @return int
|
||||
*/
|
||||
public function getUser( $audience = RevisionRecord::FOR_PUBLIC, User $user = null ) {
|
||||
wfDeprecated( __METHOD__, '1.35' );
|
||||
return $this->mPage->getUser( $audience, $user );
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -818,12 +818,20 @@ class WikiPage implements Page, IDBAccessObject {
|
|||
* 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
|
||||
* to the $audience parameter (not passing for FOR_THIS_USER is deprecated since 1.35)
|
||||
* @return int User ID for the user that made the last article revision
|
||||
*/
|
||||
public function getUser( $audience = RevisionRecord::FOR_PUBLIC, User $user = null ) {
|
||||
$this->loadLastEdit();
|
||||
if ( $this->mLastRevision ) {
|
||||
if ( $audience === RevisionRecord::FOR_THIS_USER && $user === null ) {
|
||||
wfDeprecated(
|
||||
__METHOD__ . ' using FOR_THIS_USER without a user',
|
||||
'1.35'
|
||||
);
|
||||
global $wgUser;
|
||||
$user = $wgUser;
|
||||
}
|
||||
return $this->mLastRevision->getUser( $audience, $user );
|
||||
} else {
|
||||
return -1;
|
||||
|
|
|
|||
Loading…
Reference in a new issue