110 wfDeprecated( __METHOD__ .
' without $contentHandlerFactory parameter',
'1.35' );
115 $this->contentFormat = $this->contentHandlerFactory
117 ->getDefaultFormat();
148 $this->stats->increment(
'edit.failures.conflict' );
151 $this->title->getNamespace() >=
NS_MAIN &&
154 $this->stats->increment(
155 'edit.failures.conflict.byNamespaceId.' . $this->title->getNamespace()
168 $this->stats->increment(
'edit.failures.conflict.resolved' );
171 $this->title->getNamespace() >=
NS_MAIN &&
174 $this->stats->increment(
175 'edit.failures.conflict.resolved.byNamespaceId.' . $this->title->getNamespace()
180 $user->getEditCount(),
181 'edit.failures.conflict.resolved'
191 if ( $userEdits ===
null ) {
192 $userBucket =
'anon';
193 } elseif ( $userEdits > 200 ) {
194 $userBucket =
'over200';
195 } elseif ( $userEdits > 100 ) {
196 $userBucket =
'over100';
197 } elseif ( $userEdits > 10 ) {
198 $userBucket =
'over10';
200 $userBucket =
'under11';
202 $this->stats->increment( $keyPrefixBase .
'.byUserEdits.' . $userBucket );
209 return Html::rawElement(
211 [
'class' =>
'mw-explainconflict' ],
212 $this->out->msg(
'explainconflict', $this->out->msg( $this->submitLabel )->text() )->parse()
224 $classes = $builder->getTextboxProtectionCSSClasses( $this->title );
227 'aria-label' => $this->out->msg(
'edit-textarea-aria-label' )->text(),
230 $attribs += $customAttribs;
232 $attribs = $builder->mergeClassesIntoAttributes( $classes, $attribs );
234 $attribs = $builder->buildTextboxAttribs(
237 $this->out->getUser(),
241 return Html::textarea(
243 $builder->addNewLineAtEnd( $this->storedversion ),
273 $this->out->wrapWikiMsg(
'<h2>$1</h2>',
"yourdiff" );
276 $storedContent = $this->
toEditContent( $this->storedversion );
277 $handler = $this->contentHandlerFactory->getContentHandler( $this->contentModel );
278 $diffEngine = $handler->createDifferenceEngine( $this->out );
280 $diffEngine->setContent( $yourContent, $storedContent );
281 $diffEngine->showDiff(
282 $this->out->msg(
'yourtext' )->parse(),
283 $this->out->msg(
'storedversion' )->text()
286 $this->out->wrapWikiMsg(
'<h2>$1</h2>',
"yourtext" );
289 $attribs = $builder->buildTextboxAttribs(
291 [
'tabindex' => 6,
'readonly' ],
292 $this->out->getUser(),
297 Html::textarea(
'wpTextbox2', $builder->addNewLineAtEnd( $this->yourtext ), $attribs )
306 return ContentHandler::makeContent(
wfDeprecated( $function, $version=false, $component=false, $callerOffset=2)
Logs a warning that a deprecated feature was used.
A content handler knows how do deal with a specific type of content on a wiki page.
This class is a collection of static functions that serve two purposes:
Exception thrown when an unregistered content model is requested.
Helper for displaying edit conflicts in text content models to users.
incrementResolvedStats(User $user=null)
Record when a user has resolved an edit conflict.
null string $contentModel
getEditFormHtmlAfterContent()
Content to go in the edit form after textbox1.
getEditConflictMainTextBox(array $customAttribs=[])
HTML to build the textbox1 on edit conflicts.
IContentHandlerFactory $contentHandlerFactory
showEditFormTextAfterFooters()
Content to go in the edit form after the footers (templates on this page, hidden categories,...
incrementConflictStats(User $user=null)
Record a user encountering an edit conflict.
null string $contentFormat
__construct(Title $title, OutputPage $out, IBufferingStatsdDataFactory $stats, $submitLabel, ?IContentHandlerFactory $contentHandlerFactory=null)
IBufferingStatsdDataFactory $stats
setContentFormat( $contentFormat)
setContentModel( $contentModel)
setTextboxes( $yourtext, $storedversion)
incrementStatsByUserEdits( $userEdits, $keyPrefixBase)
string $submitLabel
Message key for submit button's label.
getEditFormHtmlBeforeContent()
Content to go in the edit form before textbox1.
Helps EditPage build textboxes.
This is one of the Core classes and should be read at least once by any new developers.
Represents a title within MediaWiki.
getContentModel( $flags=0)
Get the page's content model id, see the CONTENT_MODEL_XXX constants.
The User object encapsulates all of the user-specific settings (user_id, name, rights,...
Base interface for content objects.
MediaWiki adaptation of StatsdDataFactory that provides buffering functionality.
getContentHandler(string $modelID)
Returns a ContentHandler instance for the given $modelID.