Hard deprecate not passing a user to WikiPage::getCreator when needed
If $audience is FOR_USER, user is needed Bug: T248291 Change-Id: Idc4429baa7f7f2a028eb5378d8e2c2a32f1d3761
This commit is contained in:
parent
9bd64ace82
commit
656b9bdf34
2 changed files with 11 additions and 1 deletions
|
|
@ -599,6 +599,8 @@ because of Phabricator reports.
|
|||
- LogEventsList::userCanViewLogType
|
||||
- LogEventsList::getExcludeClause (only used when the 'audience' parameter
|
||||
is set to something other than the default of 'public')
|
||||
- WikiPage::getCreator (only when the 'audience' parameter is set to
|
||||
Revision::FOR_THIS_USER)
|
||||
- LogPage::addEntry
|
||||
- FileDeleteForm::doDelete
|
||||
- OldLocalFile::userCan
|
||||
|
|
|
|||
|
|
@ -837,12 +837,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 User|null
|
||||
*/
|
||||
public function getCreator( $audience = RevisionRecord::FOR_PUBLIC, User $user = null ) {
|
||||
$revision = $this->getOldestRevision();
|
||||
if ( $revision ) {
|
||||
if ( $audience === RevisionRecord::FOR_THIS_USER && $user === null ) {
|
||||
wfDeprecated(
|
||||
__METHOD__ . ' using FOR_THIS_USER without a user',
|
||||
'1.35'
|
||||
);
|
||||
global $wgUser;
|
||||
$user = $wgUser;
|
||||
}
|
||||
$userName = $revision->getUserText( $audience, $user );
|
||||
return User::newFromName( $userName, false );
|
||||
} else {
|
||||
|
|
|
|||
Loading…
Reference in a new issue