mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/TitleBlacklist
synced 2024-11-15 18:19:45 +00:00
d97448856c
* Invalidate cached blacklist after save completion of MediaWiki:Titleblacklist rather than during edit filtering. Should help avoid race conditions which would leave you with the old version cached. * Some minor whitespace & style cleanup * Some output escaping cleanup
51 lines
1.7 KiB
PHP
51 lines
1.7 KiB
PHP
<?php
|
|
if ( !defined( 'MEDIAWIKI' ) ) {
|
|
exit(1);
|
|
}
|
|
|
|
$wgExtensionCredits['other'][] = array(
|
|
'name' => 'Title Blacklist',
|
|
'author' => 'VasilievVV',
|
|
'version' => '1.4',
|
|
'url' => 'http://www.mediawiki.org/wiki/Extension:Title_Blacklist',
|
|
'description' => 'Allows to forbid creation of pages with specified titles'
|
|
);
|
|
|
|
$wgExtensionMessagesFiles['TitleBlacklist'] = dirname( __FILE__ ) . '/TitleBlacklist.i18n.php';
|
|
$wgAutoloadClasses['TitleBlacklist'] = dirname( __FILE__ ) . '/TitleBlacklist.list.php';
|
|
$wgAutoloadClasses['TitleBlacklistHooks'] = dirname( __FILE__ ) . '/TitleBlacklist.hooks.php';
|
|
|
|
$wgExtensionFunctions[] = 'efInitTitleBlacklist';
|
|
|
|
// Sources of TitleBlacklist
|
|
define( 'TBLSRC_MSG', 0 ); // For internal usage
|
|
define( 'TBLSRC_LOCALPAGE', 1 ); // Local wiki page
|
|
define( 'TBLSRC_URL', 2 ); // Load blacklist from URL
|
|
define( 'TBLSRC_FILE', 3 ); // Load from file
|
|
$wgTitleBlacklistSources = array();
|
|
|
|
$wgTitleBlacklistCaching = array(
|
|
'warningchance' => 100,
|
|
'expiry' => 900,
|
|
'warningexpiry' => 600,
|
|
);
|
|
|
|
$wgAvailableRights[] = 'tboverride';
|
|
$wgGroupPermissions['sysop']['tboverride'] = true;
|
|
|
|
function efInitTitleBlacklist() {
|
|
global $wgTitleBlacklist;
|
|
$wgTitleBlacklist = new TitleBlacklist();
|
|
wfLoadExtensionMessages( 'TitleBlacklist' );
|
|
efSetupTitleBlacklistHooks();
|
|
}
|
|
|
|
function efSetupTitleBlacklistHooks() {
|
|
global $wgHooks;
|
|
$wgHooks['getUserPermissionsErrors'][] = 'TitleBlacklistHooks::userCan';
|
|
$wgHooks['AbortMove'][] = 'TitleBlacklistHooks::abortMove';
|
|
$wgHooks['UploadVerification'][] = 'TitleBlacklistHooks::verifyUpload';
|
|
$wgHooks['EditFilter'][] = 'TitleBlacklistHooks::validateBlacklist';
|
|
$wgHooks['ArticleSaveComplete'][] = 'TitleBlacklistHooks::clearBlacklist';
|
|
}
|