Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ParserOptions::getUser was deprecated in MediaWiki 1.36 #31

Open
imerr opened this issue Mar 29, 2022 · 2 comments
Open

ParserOptions::getUser was deprecated in MediaWiki 1.36 #31

imerr opened this issue Mar 29, 2022 · 2 comments

Comments

@imerr
Copy link

imerr commented Mar 29, 2022

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

@calebgcooper
Copy link

This extension no longer works in 1.38 and 1.39 due to getUser() being removed completely

See release notes:
https://gerrit.wikimedia.org/r/plugins/gitiles/mediawiki/core/+/REL1_38/RELEASE-NOTES-1.38

This comment:

  • Parser::getUser and ::mUser, as well as ParserOptions::getUser, deprecated since 1.37, has been removed.

@JeroenDeDauw
Copy link

I have a fix for this at https://github.com/JeroenDeDauw/HeaderFooter/commits/fix-mw36

And I am considering to maintain a fork of this extension since the maintainers are absent.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants