Skip to content

ParserOptions::getUser was deprecated in MediaWiki 1.36 #31

@imerr

Description

@imerr
Use of ParserOptions::getUser was deprecated in MediaWiki 1.36. 
[Called from HeaderFooter::hOutputPageParserOutput in /path/to/wiki/extensions/HeaderFooter/HeaderFooter.class.php at line 12]

$action = $op->parserOptions()->getUser()->getRequest()->getVal("action");

    /**
     * Current user
     * @deprecated since 1.36. Use ::getUserIdentity instead.
     * Hard deprecated since 1.37.
     * @return User
     */
    public function getUser() {
        wfDeprecated( __METHOD__, '1.36' );
        return MediaWikiServices::getInstance()
            ->getUserFactory()
            ->newFromUserIdentity( $this->mUser );
    }

    /**
     * Get the identity of the user for whom the parse is made.
     * @since 1.36
     * @return UserIdentity
     */
    public function getUserIdentity(): UserIdentity {
        return $this->mUser;
    }

Just dropping an issue here since I noticed deprecated log spam after upgrading, not sure what the intended upgrade path for MW extensions is since they added that alternate method in in 1.36 which seems fairly "recent"

Simply replacing the call with getUserIdentity seems to work just fine from quick testing

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions