Mediawiki/Anonymous IP Hash: Difference between revisions
Antonizoon (talk | contribs) No edit summary |
Antonizoon (talk | contribs) No edit summary |
||
Line 8: | Line 8: | ||
// likely end up with useless crud after IDs expire | // likely end up with useless crud after IDs expire | ||
$wgDisableAnonTalk = true; | $wgDisableAnonTalk = true; | ||
function AnonUsername() { | function AnonUsername($IP) { | ||
$key = | $key = $IP.'PUT RANDOM TEXT HERE'; | ||
# Alternatively, you can use this function to further anonymize, but it makes it harder to ban: dmY = new ID per day, WY = per week. | # Alternatively, you can use this function to further anonymize, but it makes it harder to ban robots: dmY = new ID per day, WY = per week. | ||
#$key = | #$key = $IP.'PUT RANDOM TEXT HERE'.gmdate('dmY'); | ||
return 'ID:'.substr(crypt(md5($key), 'id'), 2, 8); | return 'ID:'.substr(crypt(md5($key), 'id'), 2, 8); | ||
} | } | ||
Line 26: | Line 26: | ||
and change it to: | and change it to: | ||
$this->mName = AnonUsername(); | $this->mName = AnonUsername( $this->getRequest()->getIP() ); | ||
3. In <code>includes/user/User.php</code>, (Mediawiki 1.27.1: getBlockedStatus() Line 1600) find the line that says: | 3. In <code>includes/user/User.php</code>, (Mediawiki 1.27.1: getBlockedStatus() Line 1600) find the line that says: | ||
Line 34: | Line 34: | ||
and change it to: | and change it to: | ||
: AnonUsername(); | : AnonUsername( $this->getRequest()->getIP() ); | ||
You will need to repeat this mod whenever you update MediaWiki, since obviously an update replaces the system files. And of course the lines may vary, but have generally been similar. | You will need to repeat this mod whenever you update MediaWiki, since obviously an update replaces the system files. And of course the lines may vary, but have generally been similar. |
Revision as of 19:00, 9 December 2016
Here's the gist of my anon ID hack to MediaWiki. I can't really package it as an extension or anything because it involves hacking things that apparently aren't supposed to be hacked, but it's not hard to do. - Halcy
1. Add the following to your LocalSettings.php:
// you can leave anon talk pages on, but you'll // likely end up with useless crud after IDs expire $wgDisableAnonTalk = true; function AnonUsername($IP) { $key = $IP.'PUT RANDOM TEXT HERE'; # Alternatively, you can use this function to further anonymize, but it makes it harder to ban robots: dmY = new ID per day, WY = per week. #$key = $IP.'PUT RANDOM TEXT HERE'.gmdate('dmY'); return 'ID:'.substr(crypt(md5($key), 'id'), 2, 8); }
2. In includes/user/User.php
, (Mediawiki 1.27.1: getName() Line 2109) find the line that says:
$this->mName = IP::sanitizeIP( $this->getRequest()->getIP() );
and change it to:
$this->mName = AnonUsername( $this->getRequest()->getIP() );
3. In includes/user/User.php
, (Mediawiki 1.27.1: getBlockedStatus() Line 1600) find the line that says:
: IP::sanitizeIP( $wgUser->getRequest()->getIP() );
and change it to:
: AnonUsername( $this->getRequest()->getIP() );
You will need to repeat this mod whenever you update MediaWiki, since obviously an update replaces the system files. And of course the lines may vary, but have generally been similar.
aa tags
On a slightly related note, I hacked an extension together for <aa> tags.
- Music:DQN-kun / >>6 is not a panda