简体   繁体   English

通过php API登录MediaWiki

[英]MediaWiki login through php api

Is possible to write a hook for MediaWiki using php to login with a particular user name and password when a certain event takes place? 发生特定事件时,是否可以使用php为MediaWiki编写钩子以使用特定的用户名和密码登录? I looked through the MediaWiki api and it seems that $wgUser has only a logout function and does not have a login function. 我查看了MediaWiki api,看来$ wgUser仅具有注销功能,而没有登录功能。

It is indeed possible to log in to a wiki using a particular user name and password--that is essentially what every authentication extension does. 实际上,可以使用特定的用户名和密码登录Wiki,这实际上是每个身份验证扩展所做的事情。 There is a whole page of the Mediawiki API dedicated to login functionality , and there is also documentation of the AuthPlugin class , which provides an interface for Mediawiki authentication and login plugins. Mediawiki API的整个页面都专门用于登录功能 ,并且还有AuthPlugin类的文档, 该类为Mediawiki身份验证和登录插件提供了接口。

If you're looking for code samples for logging into a wiki, there are php examples on the API:Login page, and you could also have a look at the extensions in the authentication and login category on Mediawiki.org. 如果您正在寻找用于登录Wiki的代码示例,则API:Login页面上有php示例,您还可以在Mediawiki.org上查看身份验证和登录类别中的扩展。

Re: $wgUser : login is handled by $wgUser 's new methods -- newFromId , newFromName , newFromConfirmationCode , etc. These functions create a new User object, which contains data and functionality specific to the account, every time someone logs into their account on the wiki. 回复: $wgUser :登录由$wgUser的新方法处理newFromIdnewFromNamenewFromConfirmationCode等。这些函数创建一个新的User对象,该对象包含每次用户登录帐户时特定于该帐户的数据和功能。在Wiki上。 There is a different set of functions for creating new accounts. 创建新帐户有一组不同的功能。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM