Go to the documentation of this file.
25 'label-message' =>
'wikieditor-toolbar-preference',
26 'section' =>
'editing/editor',
30 'usebetatoolbar' =>
true,
33 'ext.wikiEditor.toolbar',
36 'ext.wikiEditor.toolbar.styles',
42 'usebetatoolbar-cgd' => [
44 'label-message' =>
'wikieditor-toolbar-dialogs-preference',
45 'section' =>
'editing/editor',
49 'usebetatoolbar-cgd' =>
true,
50 'usebetatoolbar' =>
true,
53 'ext.wikiEditor.dialogs',
61 'wikieditor-preview' => [
63 'label-message' =>
'wikieditor-preview-preference',
64 'section' =>
'editing/labs',
68 'wikieditor-preview' =>
true,
71 'ext.wikiEditor.preview',
76 'wikieditor-publish' => [
78 'label-message' =>
'wikieditor-publish-preference',
79 'section' =>
'editing/labs',
83 'wikieditor-publish' =>
true,
86 'ext.wikiEditor.publish',
106 if ( !isset( $wgWikiEditorFeatures[
$name] ) || $wgWikiEditorFeatures[
$name][
'global'] ) {
111 if ( $wgWikiEditorFeatures[
$name][
'user'] ) {
112 if ( isset( self::$features[
$name][
'requirements'] ) ) {
113 foreach ( self::$features[
$name][
'requirements']
as $requirement =>
$value ) {
138 if ( !class_exists(
'EventLogging' ) ) {
142 if ( $data[
'editingSessionId'][0] >
'0' ) {
153 'editor' =>
'wikitext',
154 'platform' =>
'desktop',
155 'integration' =>
'page',
156 'page.id' =>
$page->getId(),
157 'page.title' =>
$title->getPrefixedText(),
158 'page.ns' =>
$title->getNamespace(),
159 'page.revid' =>
$page->getRevision() ?
$page->getRevision()->getId() : 0,
160 'user.id' =>
$user->getId(),
161 'user.editCount' =>
$user->getEditCount() ?: 0,
165 if (
$user->isAnon() ) {
166 $data[
'user.class'] =
'IP';
169 return EventLogging::logEvent(
'Edit', 13457736, $data );
186 $outputPage->addModuleStyles(
'ext.wikiEditor.styles' );
189 foreach ( self::$features
as $name => $feature ) {
190 if ( !self::isEnabled(
$name ) ) {
193 if ( isset( $feature[
'stylemodules'] ) ) {
194 $outputPage->addModuleStyles( $feature[
'stylemodules'] );
196 if ( isset( $feature[
'modules'] ) ) {
197 $outputPage->addModules( $feature[
'modules'] );
206 if ( class_exists(
'EventLogging' ) && !
$request->wasPosted() ) {
208 $data[
'editingSessionId'] = self::getEditingStatsId();
209 if (
$request->getVal(
'section' ) ) {
210 $data[
'action.init.type'] =
'section';
212 $data[
'action.init.type'] =
'page';
214 if (
$request->getHeader(
'Referer' ) ) {
216 $data[
'action.init.mechanism'] =
'new';
218 $data[
'action.init.mechanism'] =
'click';
221 $data[
'action.init.mechanism'] =
'url';
224 self::doEventLogging(
'init',
$article, $data );
244 $req = $outputPage->getContext()->getRequest();
245 $editingStatsId =
$req->getVal(
'editingStatsId' );
246 if ( !$editingStatsId || !
$req->wasPosted() ) {
247 $editingStatsId = self::getEditingStatsId();
250 $outputPage->addHTML(
255 'name' =>
'editingStatsId',
256 'id' =>
'editingStatsId',
257 'value' => $editingStatsId
273 if ( self::isEnabled(
'toolbar' ) ) {
276 'class' =>
'wikiEditor-oldToolbar'
297 global $wgWikiEditorFeatures;
299 foreach ( self::$features
as $name => $feature ) {
301 isset( $feature[
'preferences'] ) &&
302 ( !isset( $wgWikiEditorFeatures[
$name] ) || $wgWikiEditorFeatures[
$name][
'user'] )
304 foreach ( $feature[
'preferences']
as $key =>
$options ) {
305 $defaultPreferences[$key] =
$options;
320 $vars[
'mw.msg.wikieditor'] =
wfMessage(
'sig-text',
'~~~~' )->inContentLanguage()->text();
336 $testModules[
'qunit'][
'ext.wikiEditor.toolbar.test'] = [
337 'scripts' => [
'tests/qunit/ext.wikiEditor.toolbar.test.js' ],
338 'dependencies' => [
'ext.wikiEditor.toolbar' ],
339 'localBasePath' => __DIR__,
340 'remoteExtPath' =>
'WikiEditor',
354 $enabledModules = [];
355 foreach ( self::$features
as $name => $feature ) {
356 $enabledModules[
$name] = self::isEnabled(
$name );
359 $vars[
'wgWikiEditorEnabledModules'] = $enabledModules;
369 $requiredMagicWords = [
380 foreach ( $requiredMagicWords
as $name ) {
391 if ( self::$statsId ) {
392 return self::$statsId;
407 if (
$request->getVal(
'editingStatsId' ) ) {
408 self::doEventLogging(
411 [
'editingSessionId' =>
$request->getVal(
'editingStatsId' ) ]
428 if (
$request->getVal(
'editingStatsId' ) ) {
430 $data[
'editingSessionId'] =
$request->getVal(
'editingStatsId' );
433 $action =
'saveSuccess';
435 $action =
'saveFailure';
436 $errors =
$status->getErrorsArray();
438 if ( isset( $errors[0][0] ) ) {
439 $data[
'action.saveFailure.message'] = $errors[0][0];
443 $data[
'action.saveFailure.type'] =
'editConflict';
445 $data[
'action.saveFailure.type'] =
'editPageDeleted';
446 } elseif ( isset( $errors[0][0] ) && $errors[0][0] ===
'abusefilter-disallowed' ) {
447 $data[
'action.saveFailure.type'] =
'extensionAbuseFilter';
448 } elseif ( isset( $editPage->
getArticle()->getPage()->ConfirmEdit_ActivateCaptcha ) ) {
450 $data[
'action.saveFailure.type'] =
'extensionCaptcha';
451 } elseif ( isset( $errors[0][0] ) && $errors[0][0] ===
'spamprotectiontext' ) {
452 $data[
'action.saveFailure.type'] =
'extensionSpamBlacklist';
456 $data[
'action.saveFailure.type'] =
'responseUnknown';
459 self::doEventLogging( $action,
$article, $data );
static resourceLoaderGetConfigVars(&$vars)
static editPageAttemptSave(EditPage $editPage)
This is attached to the MediaWiki 'EditPage::attemptSave' hook.
error also a ContextSource you ll probably need to make sure the header is varied on $request
$wgVersion
MediaWiki version number.
static editPageShowEditFormInitial( $editPage, $outputPage)
EditPage::showEditForm:initial hook.
this hook is for auditing only RecentChangesLinked and Watchlist RecentChangesLinked and Watchlist Do not use this to implement individual filters if they are compatible with the ChangesListFilter and ChangesListFilterGroup structure use sub classes of those in conjunction with the ChangesListSpecialPageStructuredFilters hook This hook can be used to implement filters that do not implement that or custom behavior that is not an individual filter e g Watchlist and Watchlist you will want to construct new ChangesListBooleanFilter or ChangesListStringOptionsFilter objects When constructing you specify which group they belong to You can reuse existing or create your you must register them with $special registerFilterGroup removed from all revisions and log entries to which it was applied This gives extensions a chance to take it off their books as the deletion has already been partly carried out by this point or something similar the user will be unable to create the tag set $status
please add to it if you re going to add events to the MediaWiki code where normally authentication against an external auth plugin would be creating a account $user
this hook is for auditing only $req
static & get( $id)
Factory: creates an object representing an ID.
static doEventLogging( $action, $article, $data=[])
Log stuff to EventLogging's Schema:Edit - see https://meta.wikimedia.org/wiki/Schema:Edit If you don'...
static generateHex( $chars, $forceStrong=false)
Generate a run of (ideally) cryptographically random data and return it in hexadecimal string format.
Allows to change the fields on the form that will be generated $name
const CONTENT_MODEL_WIKITEXT
injection txt This is an overview of how MediaWiki makes use of dependency injection The design described here grew from the discussion of RFC T384 The term dependency this means that anything an object needs to operate should be injected from the the object itself should only know narrow no concrete implementation of the logic it relies on The requirement to inject everything typically results in an architecture that based on two main types of and essentially stateless service objects that use other service objects to operate on the value objects As of the beginning MediaWiki is only starting to use the DI approach Much of the code still relies on global state or direct resulting in a highly cyclical dependency which acts as the top level factory for services in MediaWiki which can be used to gain access to default instances of various services MediaWikiServices however also allows new services to be defined and default services to be redefined Services are defined or redefined by providing a callback the instantiator that will return a new instance of the service When it will create an instance of MediaWikiServices and populate it with the services defined in the files listed by thereby bootstrapping the DI framework Per $wgServiceWiringFiles lists includes ServiceWiring php
static editPageAttemptSaveAfter(EditPage $editPage, Status $status)
This is attached to the MediaWiki 'EditPage::attemptSave:after' hook.
Generic operation result class Has warning/error list, boolean status and arbitrary value.
namespace and then decline to actually register it file or subcat img or subcat $title
do that in ParserLimitReportFormat instead use this to modify the parameters of the image and a DIV can begin in one section and end in another Make sure your code can handle that case gracefully See the EditSectionClearerLink extension for an example zero but section is usually empty its values are the globals values before the output is cached $page
static element( $element, $attribs=null, $contents='', $allowShortTag=true)
Format an XML element with given attributes and, optionally, text content.
static EditPageBeforeEditToolbar(&$toolbar)
EditPageBeforeEditToolbar hook.
when a variable name is used in a it is silently declared as a new masking the global
static configuration should be added through ResourceLoaderGetConfigVars instead & $vars
magicword txt Magic Words are some phrases used in the wikitext They are used for two that looks like templates but that don t accept any parameter *Parser functions(like {{fullurl:...}}, {{#special:...}}) $magicWords['en']
static isEnabled( $name)
Checks if a certain option is enabled.
static getMagicWords(&$vars)
Expose useful magic words which are used by the wikieditor toolbar.
static resourceLoaderTestModules(&$testModules, &$resourceLoader)
ResourceLoaderTestModules hook.
The edit page/HTML interface (split from Article) The actual database and text munging is still in Ar...
error also a ContextSource you ll probably need to make sure the header is varied on and they can depend only on the ResourceLoaderContext such as when responding to a resource loader request or generating HTML output & $resourceLoader
static getEditingStatsId()
Gets a 32 character alphanumeric random string to be used for stats.
static makeGlobalVariablesScript(&$vars)
MakeGlobalVariablesScript hook.
static editPageShowEditFormFields( $editPage, $outputPage)
EditPage::showEditForm:fields hook.
This document is intended to provide useful advice for parties seeking to redistribute MediaWiki to end users It s targeted particularly at maintainers for Linux since it s been observed that distribution packages of MediaWiki often break We ve consistently had to recommend that users seeking support use official tarballs instead of their distribution s and this often solves whatever problem the user is having It would be nice if this could such as
static rawElement( $element, $attribs=[], $contents='')
Returns an HTML element in a string.
Using a hook running we can avoid having all this option specific stuff in our mainline code Using the function array $article
const AS_CONFLICT_DETECTED
Status: (non-resolvable) edit conflict.
either a unescaped string or a HtmlArmor object after in associative array form externallinks including delete and has completed for all link tables whether this was an auto creation default is conds Array Extra conditions for the No matching items in log is displayed if loglist is empty msgKey Array If you want a nice box with a set this to the key of the message First element is the message additional optional elements are parameters for the key that are processed with wfMessage() -> params() ->parseAsBlock() - offset Set to overwrite offset parameter in $wgRequest set to '' to unset offset - wrap String Wrap the message in html(usually something like "<
static getPreferences( $user, &$defaultPreferences)
GetPreferences hook.
const AS_ARTICLE_WAS_DELETED
Status: article was deleted while editing and param wpRecreate == false or form was not posted.
this hook is for auditing only RecentChangesLinked and Watchlist RecentChangesLinked and Watchlist Do not use this to implement individual filters if they are compatible with the ChangesListFilter and ChangesListFilterGroup structure use sub classes of those in conjunction with the ChangesListSpecialPageStructuredFilters hook This hook can be used to implement filters that do not implement that or custom behavior that is not an individual filter e g Watchlist and Watchlist you will want to construct new ChangesListBooleanFilter or ChangesListStringOptionsFilter objects When constructing you specify which group they belong to You can reuse existing or create your you must register them with $special registerFilterGroup removed from all revisions and log entries to which it was applied This gives extensions a chance to take it off their books as the deletion has already been partly carried out by this point or something similar the user will be unable to create the tag set and then return false from the hook function Ensure you consume the ChangeTagAfterDelete hook to carry out custom deletion actions as context called by AbstractContent::getParserOutput May be used to override the normal model specific rendering of page content as context as context $options