mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/AbuseFilter.git
synced 2024-11-12 00:38:23 +00:00
Add install.php, installer which adds the blocker account if it doesn't exist, adds the tables
This commit is contained in:
parent
9c43bbe9b3
commit
2cc6bdfa5e
|
@ -363,6 +363,7 @@ class AbuseFilter {
|
|||
$block = new Block;
|
||||
$block->mAddress = $wgUser->getName();
|
||||
$block->mUser = $wgUser->getId();
|
||||
$block->mBy = User::idFromName( wfMsgForContent( 'abusefilter-blocker' ) ); // Let's say the site owner blocked them
|
||||
$block->mByName = wfMsgForContent( 'abusefilter-blocker' );
|
||||
$block->mReason = wfMsgForContent( 'abusefilter-blockreason' );
|
||||
$block->mTimestamp = wfTimestampNow();
|
||||
|
|
27
install.php
Normal file
27
install.php
Normal file
|
@ -0,0 +1,27 @@
|
|||
<?php
|
||||
|
||||
/*
|
||||
* Makes the required changes for the AbuseFilter extension
|
||||
*/
|
||||
|
||||
require_once ( getenv('MW_INSTALL_PATH') !== false
|
||||
? getenv('MW_INSTALL_PATH')."/maintenance/commandLine.inc"
|
||||
: dirname( __FILE__ ) . '/../../maintenance/commandLine.inc' );
|
||||
|
||||
//dbsource( dirname( __FILE__ ) . '/abusefilter.tables.sql' );
|
||||
|
||||
// Create the Abuse Filter user.
|
||||
wfLoadExtensionMessages( 'AbuseFilter' );
|
||||
$user = User::newFromName( wfMsgForContent( 'abusefilter-blocker' ) );
|
||||
|
||||
if (!$user->getId()) {
|
||||
$user->addToDatabase();
|
||||
$user->saveSettings();
|
||||
}
|
||||
|
||||
# Promote user so it doesn't look too crazy.
|
||||
$user->addGroup( 'sysop' );
|
||||
|
||||
# Increment site_stats.ss_users
|
||||
$ssu = new SiteStatsUpdate( 0, 0, 0, 0, 1 );
|
||||
$ssu->doUpdate();
|
Loading…
Reference in a new issue