Manual talk:$wgProxyList

From MediaWiki.org
Jump to navigation Jump to search

What's the best way to make use of the stopforumspam list? Just create a big $wgProxyList array with all those IPs, and update it periodically?

I wonder what would be the best way to automate the updating. It would probably be beneficial to create some mirrors of http://www.stopforumspam.com/downloads so that there would be easier access to the list for those who want to download it from a shared hosting environment. Leucosticte (talk) 08:15, 15 March 2014 (UTC)

Reading from a file[edit]

I noticed that User::isLocallyBlockedProxy() contains:

if ( !is_array( $wgProxyList ) ) {
	// Load from the specified file
	$wgProxyList = array_map( 'trim', file( $wgProxyList ) );
}

What kind of format would that file need to be in? Leucosticte (talk) 14:02, 15 March 2014 (UTC)

Reading from a file, cont'd[edit]

I tried putting this little snippet in LocalSettings.php:

$wgGotOpenProxyList = false;
$wgProxyListFile = '/home/stauffenbergssh/childwiki.net/w/images/e/e3/Bannedips.csv';
function getOpenProxyList( $article, $fields ) {
        global $wgGotOpenProxyList, $wgProxyList, $wgProxyListFile;
        if ( !$wgGotOpenProxyList ) {
                if ( file_exists( $wgProxyListFile ) ) {
                        $contents = file_get_contents( $wgProxyListFile );
                        if ( $contents ) {
                                $wgProxyList = explode( ',', $contents );
                        }
                }
        }
        $wgGotOpenProxyList = true;
        return true;
}

It works when the file is short, but not when it's long; when it's several megabytes, I get the white screen of death (even though I set up error reporting). That kinda defeats the point of using a file rather than a wiki page. Leucosticte (talk) 15:27, 15 March 2014 (UTC)

White page with mediawiki 1.30[edit]

Work good with mediawiki 1.28 / 1.29 / 1.29.1
With mediawiki 1.30, the login page not work. White page.
When i comment this line, login page work good :
#require_once("$IP/extensions/bannedips.php");
Then, i suppose, this script not work with mediawiki 1.30
The french translation for the 1.30 mediawiki documentation say : L'utilisation d'un tableau associatif pour $wgProxyList, où l'adresse IP est dans la clé au lieu de la valeur, est déconseillée (par exemple ['127.0.0.1' => 'valeur']). Veuillez convertir ces tableaux en tableaux indexés / séquentiels (par exemple ['127.0.0.1']).
Then, replace the old method in this file /extensions/bannedips.php :
<?php
$wgProxyList = array(
'1.0.135.30',
'1.0.137.139',
'1.0.178.169',
'1.0.178.218',
'1.0.178.58',
);
by
<?php
$wgProxyList = array(
['1.0.135.30'],
['1.0.137.139'],
['1.0.178.169'],
['1.0.178.218'],
['1.0.178.58']
);
This method work i can use login page and i'm now connected, but, was very long, need a lot capacity.
The total list of ips can not be used.
The access time is far too long.
Semblait avoir été résolu mais la nouvelle méthode est très lente, et, depuis un autre wiki, le warning suivant est affiché :
Warning: IPSet: Bad mask  from 'Array', ignored in /homepages/38/d548381562/htdocs/CLPublic/wiki/vendor/wikimedia/ip-set/src/IPSet.php on line 125
J'ai supprimé l'extension pour le moment.
Then, read the next step : https://phabricator.wikimedia.org/T182841#3842010