-
Notifications
You must be signed in to change notification settings - Fork 1
/
ArticleProtection.php
87 lines (73 loc) · 3.07 KB
/
ArticleProtection.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
<?php
if ( ! defined( 'MEDIAWIKI' ) )
die();
/**
* Extension to manage article permissions
*
* @file
* @author Nischay Nahata <[email protected]> for Wikiworks
* @ingroup Extensions
* @licence GNU GPL v3 or later
*/
define( 'ArticleProtection_VERSION', '0.1 beta' );
$wgExtensionCredits['specialpage'][] = array(
'path' => __FILE__,
'name' => 'ArticleProtection',
'version' => ArticleProtection_VERSION,
'author' => array(
'[http://www.mediawiki.org/wiki/User:Nischayn22 Nischay Nahata] for [http://www.wikiworks.com/ WikiWorks]',
),
'url' => 'https://www.mediawiki.org/wiki/Extension:ArticleProtection',
'descriptionmsg' => 'article-protection-desc'
);
// Autoloading classes
$wgAutoloadClasses['ArticleProtectionHooks'] = dirname( __FILE__ ) . '/ArticleProtection.hooks.php';
$wgAutoloadClasses['ApiArticleProtection'] = __DIR__ . '/ArticleProtection_Api.php';
// Api classes
$wgAPIModules['article_protection'] = 'ApiArticleProtection';
// Hooks
$wgHooks['LoadExtensionSchemaUpdates'][] = 'ArticleProtectionHooks::onSchemaUpdate';
$wgHooks['ArticleInsertComplete'][] = 'ArticleProtectionHooks::onArticleInsertComplete';
$wgHooks['TitleQuickPermissions'][] = 'ArticleProtectionHooks::onTitleQuickPermissions';
$wgHooks['SkinTemplateNavigation'][] = 'ArticleProtectionHooks::onSkinTemplateNavigation';
$wgHooks['UserGetRights'][] = 'ArticleProtectionHooks::onUserGetRights';
$wgHooks['BeforePageDisplay'][] = 'ArticleProtectionHooks::BeforePageDisplay';
$wgHooks['APIEditBeforeSave'][] = 'ArticleProtectionHooks::onAPIEditBeforeSave';
// Register for log
$wgLogTypes[] = 'ArticleProtection';
$wgLogActionsHandlers['ArticleProtection/*'] = 'LogFormatter';
// Special pages
$wgAutoloadClasses['SpecialArticleProtection'] = dirname( __FILE__ ) . '/SpecialArticleProtection.php';
$wgSpecialPages['ArticleProtection'] = 'SpecialArticleProtection';
// i18n messages
$wgExtensionMessagesFiles['ArticleProtection'] = __DIR__ . '/ArticleProtection.i18n.php';
// To add or remove articles change the values in this array on your LocalSettings.php file.
// The constant values can be found on https://www.mediawiki.org/wiki/Manual:Namespace_constants
$articleProtectionNS = array( NS_MAIN, NS_USER, NS_PROJECT, NS_FILE, NS_TEMPLATE );
// Maximum allowed editors for a page
$apMaxEditors = 20;
$wgResourceModules['ext.articleprotection.edit'] = array(
'styles' => array( 'ArticleProtection.css' ),
'scripts' => 'ArticleProtection.js',
'localBasePath' => __DIR__,
'remoteExtPath' => 'ArticleProtection',
'position' => 'top' // available since r85616
);
$wgResourceModules['ext.articleprotection.view'] = array(
'styles' => array( 'ArticleProtection.css' ),
'localBasePath' => __DIR__,
'remoteExtPath' => 'ArticleProtection',
'position' => 'top' // available since r85616
);
$wgResourceModules['ext.articleprotection.pageview'] = array(
'scripts' => array( 'ArticleProtectionNavigation.js' ),
'localBasePath' => __DIR__,
'remoteExtPath' => 'ArticleProtection',
'position' => 'top', // available since r85616
'dependencies' => array(
'mediawiki.jqueryMsg',
),
'messages' => array(
'pages-link',
),
);