2008-06-27 09:38:54 +00:00
|
|
|
<?php
|
2009-10-07 13:57:06 +00:00
|
|
|
/**
|
2008-06-27 09:38:54 +00:00
|
|
|
* Makes the required changes for the AbuseFilter extension
|
|
|
|
*/
|
|
|
|
|
2009-10-07 13:57:06 +00:00
|
|
|
require_once ( getenv( 'MW_INSTALL_PATH' ) !== false
|
|
|
|
? getenv( 'MW_INSTALL_PATH' ) . "/maintenance/commandLine.inc"
|
2008-06-27 09:38:54 +00:00
|
|
|
: dirname( __FILE__ ) . '/../../maintenance/commandLine.inc' );
|
|
|
|
|
2008-07-18 16:03:27 +00:00
|
|
|
$sqlfile = '/abusefilter.tables.sql';
|
2009-10-07 13:57:06 +00:00
|
|
|
if ( $wgDBtype == 'postgres' )
|
2008-07-18 16:03:27 +00:00
|
|
|
$sqlfile = '/abusefilter.tables.pg.sql';
|
|
|
|
|
2010-10-02 08:55:39 +00:00
|
|
|
wfGetDB( DB_MASTER )->sourceFile( dirname( __FILE__ ) . $sqlfile );
|
2008-06-27 09:38:54 +00:00
|
|
|
|
|
|
|
// Create the Abuse Filter user.
|
2010-05-27 15:56:53 +00:00
|
|
|
wfLoadExtensionMessages( 'AbuseFilter' );
|
2008-06-27 09:38:54 +00:00
|
|
|
$user = User::newFromName( wfMsgForContent( 'abusefilter-blocker' ) );
|
|
|
|
|
2009-10-07 13:57:06 +00:00
|
|
|
if ( !$user->getId() ) {
|
2008-06-27 09:38:54 +00:00
|
|
|
$user->addToDatabase();
|
|
|
|
$user->saveSettings();
|
2009-01-23 22:53:50 +00:00
|
|
|
# Increment site_stats.ss_users
|
|
|
|
$ssu = new SiteStatsUpdate( 0, 0, 0, 0, 1 );
|
|
|
|
$ssu->doUpdate();
|
2008-07-09 03:09:25 +00:00
|
|
|
} else {
|
|
|
|
// Sorry dude, we need this account.
|
|
|
|
$user->setPassword( null );
|
2008-07-09 07:02:13 +00:00
|
|
|
$user->setEmail( null );
|
2008-07-09 03:09:25 +00:00
|
|
|
$user->saveSettings();
|
2008-06-27 09:38:54 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
# Promote user so it doesn't look too crazy.
|
|
|
|
$user->addGroup( 'sysop' );
|