Pergunta

I have an extension that needs to access the IP addresses associated with a recent change entry.

From the revision ID, I can access the Revision object and in turn the associated RecentChange but neither have any obvious methods to get the originating IP. It can only get the IP if it was an anonymous edit.

I have set $wgPutIPinRC so the IPs will be in the recentchanges table.

How can I get the IP address for the change?

Foi útil?

Solução

It is not directly exposed as a property, but it is stored in the class as an attribute. These can be read using the RecentChange::getAttribute() method passing the field name of rc_ip:

$ip_address = $this->recentchange->getAttribute( 'rc_ip' );

This still requires $wgPutIPinRC to be set for the data to be recorded in the first place.

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top