forked from SemanticMediaWiki/SemanticWatchlist
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathSemanticWatchlist.php
145 lines (119 loc) · 6.05 KB
/
SemanticWatchlist.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
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
<?php
/**
* Initialization file for the Semantic Watchlist extension.
*
* Documentation: https://www.mediawiki.org/wiki/Extension:Semantic_Watchlist
* Support https://github.com/SemanticMediaWiki/SemanticWatchlist/issues
*
* @license GNU GPL v3+
* @author Jeroen De Dauw < [email protected] >
*/
if ( !defined( 'MEDIAWIKI' ) ) {
die( 'Not an entry point.' );
}
if ( version_compare( $GLOBALS['wgVersion'], '1.19c', '<' ) ) {
die( '<b>Error:</b> Semantic Watchlist requires MediaWiki 1.19 or above.' );
}
if ( !defined( 'SMW_VERSION' ) ) {
die( '<b>Error:</b> You need to have <a href="https://semantic-mediawiki.org/wiki/Semantic_MediaWiki">Semantic MediaWiki</a> installed in order to use Semantic Watchlist.' );
}
if ( version_compare( SMW_VERSION, '1.9', '<' ) ) {
die( '<b>Error:</b> Semantic Watchlist requires Semantic MediaWiki 1.9 or above.' );
}
define( 'SWL_VERSION', '1.0 alpha' );
$GLOBALS['wgExtensionCredits']['semantic'][] = array(
'path' => __FILE__,
'name' => 'Semantic Watchlist',
'version' => SWL_VERSION,
'author' => array(
'[http://www.mediawiki.org/wiki/User:Jeroen_De_Dauw Jeroen De Dauw] for [http://www.wikiworks.com/ WikiWorks]',
),
'url' => 'https://www.mediawiki.org/wiki/Extension:Semantic_Watchlist',
'descriptionmsg' => 'semanticwatchlist-desc',
'license-name' => 'GPL-3.0+'
);
$GLOBALS['egSWLScriptPath'] = $GLOBALS['wgExtensionAssetsPath'] === false ? $GLOBALS['wgScriptPath'] . '/extensions/SemanticWatchlist' : $GLOBALS['wgExtensionAssetsPath'] . '/SemanticWatchlist';
$GLOBALS['wgExtensionMessagesFiles']['SemanticWatchlist'] = __DIR__ . '/SemanticWatchlist.i18n.php';
$GLOBALS['wgExtensionMessagesFiles']['SemanticWatchlistAlias'] = __DIR__ . '/SemanticWatchlist.i18n.alias.php';
$GLOBALS['wgAutoloadClasses']['SWLHooks'] = __DIR__ . '/SemanticWatchlist.hooks.php';
$GLOBALS['wgAutoloadClasses']['ApiAddWatchlistGroup'] = __DIR__ . '/api/ApiAddWatchlistGroup.php';
$GLOBALS['wgAutoloadClasses']['ApiDeleteWatchlistGroup'] = __DIR__ . '/api/ApiDeleteWatchlistGroup.php';
$GLOBALS['wgAutoloadClasses']['ApiEditWatchlistGroup'] = __DIR__ . '/api/ApiEditWatchlistGroup.php';
$GLOBALS['wgAutoloadClasses']['ApiQuerySemanticWatchlist'] = __DIR__ . '/api/ApiQuerySemanticWatchlist.php';
$GLOBALS['wgAutoloadClasses']['SWLChangeSet'] = __DIR__ . '/includes/SWL_ChangeSet.php';
$GLOBALS['wgAutoloadClasses']['SWLEdit'] = __DIR__ . '/includes/SWL_Edit.php';
$GLOBALS['wgAutoloadClasses']['SWLEmailer'] = __DIR__ . '/includes/SWL_Emailer.php';
$GLOBALS['wgAutoloadClasses']['SWLGroup'] = __DIR__ . '/includes/SWL_Group.php';
$GLOBALS['wgAutoloadClasses']['SWLGroups'] = __DIR__ . '/includes/SWL_Groups.php';
$GLOBALS['wgAutoloadClasses']['SWLPropertyChange'] = __DIR__ . '/includes/SWL_PropertyChange.php';
$GLOBALS['wgAutoloadClasses']['SWLPropertyChanges'] = __DIR__ . '/includes/SWL_PropertyChanges.php';
$GLOBALS['wgAutoloadClasses']['SWLCustomTexts'] = __DIR__ . '/includes/SWL_CustomTexts.php';
$GLOBALS['wgAutoloadClasses']['SpecialSemanticWatchlist'] = __DIR__ . '/specials/SpecialSemanticWatchlist.php';
$GLOBALS['wgAutoloadClasses']['SpecialWatchlistConditions'] = __DIR__ . '/specials/SpecialWatchlistConditions.php';
$GLOBALS['wgSpecialPages']['SemanticWatchlist'] = 'SpecialSemanticWatchlist';
$GLOBALS['wgSpecialPageGroups']['SemanticWatchlist'] = 'changes';
$GLOBALS['wgSpecialPages']['WatchlistConditions'] = 'SpecialWatchlistConditions';
$GLOBALS['wgSpecialPageGroups']['WatchlistConditions'] = 'changes';
$GLOBALS['wgAPIModules']['addswlgroup'] = 'ApiAddWatchlistGroup';
$GLOBALS['wgAPIModules']['deleteswlgroup'] = 'ApiDeleteWatchlistGroup';
$GLOBALS['wgAPIModules']['editswlgroup'] = 'ApiEditWatchlistGroup';
$GLOBALS['wgAPIListModules']['semanticwatchlist'] = 'ApiQuerySemanticWatchlist';
$moduleTemplate = array(
'localBasePath' => __DIR__,
'remoteBasePath' => $GLOBALS['egSWLScriptPath']
);
$GLOBALS['wgResourceModules']['ext.swl.watchlist'] = $moduleTemplate + array(
'styles' => array( 'specials/ext.swl.watchlist.css' ),
'scripts' => array(),
'dependencies' => array(),
'messages' => array()
);
$GLOBALS['wgResourceModules']['ext.swl.watchlistconditions'] = $moduleTemplate + array(
'styles' => array( 'specials/ext.swl.watchlistconditions.css' ),
'scripts' => array(
'specials/jquery.watchlistcondition.js',
'specials/ext.swl.watchlistconditions.js'
),
'dependencies' => array(),
'messages' => array(
'swl-group-name',
'swl-group-legend',
'swl-group-properties',
'swl-properties-list',
'swl-group-remove-property',
'swl-group-add-property',
'swl-group-page-selection',
'swl-group-save',
'swl-group-saved',
'swl-group-saving',
'swl-group-remove',
'swl-group-category',
'swl-group-namespace',
'swl-group-concept',
'swl-group-confirm-remove',
'swl-custom-legend',
'swl-custom-remove-property',
'swl-custom-text-add',
'swl-custom-input',
)
);
require_once 'SemanticWatchlist.settings.php';
$GLOBALS['wgAvailableRights'][] = 'semanticwatch';
$GLOBALS['wgAvailableRights'][] = 'semanticwatchgroups';
// TEMPORARY until the Composer classmap is fixed
$GLOBALS['wgAutoloadClasses']['SWL\Setup'] = __DIR__ . '/src/Setup.php';
$GLOBALS['wgAutoloadClasses']['SWL\Database\DatabaseUpdater'] = __DIR__ . '/src/Database/DatabaseUpdater.php';
$GLOBALS['wgAutoloadClasses']['SWL\MediaWiki\Hooks\PersonalUrls'] = __DIR__ . '/src/MediaWiki/Hooks/PersonalUrls.php';
$GLOBALS['wgAutoloadClasses']['SWL\MediaWiki\Hooks\UserSaveOptions'] = __DIR__ . '/src/MediaWiki/Hooks/UserSaveOptions.php';
$GLOBALS['wgAutoloadClasses']['SWL\MediaWiki\Hooks\ExtensionSchemaUpdater'] = __DIR__ . '/src/MediaWiki/Hooks/ExtensionSchemaUpdater.php';
$GLOBALS['wgAutoloadClasses']['SWL\MediaWiki\Hooks\GetPreferences'] = __DIR__ . '/src/MediaWiki/Hooks/GetPreferences.php';
$GLOBALS['egSwlSqlDatabaseSchemaPath'] = __DIR__ . '/src/Database/SqlDatabaseSchema.sql';
/**
* @codeCoverageIgnore
*
* @since 1.0
*/
call_user_func( function () {
$setup = new \SWL\Setup( $GLOBALS, __DIR__ );
$setup->run();
} );