49 $this->uniqueId = static::class . ++self::$counter .
'x';
52 if ( empty( $this->mParams[
'fields'] ) || !is_array( $this->mParams[
'fields'] ) ) {
53 throw new MWException(
'HTMLFormFieldCloner called without any fields' );
57 if ( isset( $this->mParams[
'fields'][
'delete'] ) ) {
58 $class =
'mw-htmlform-cloner-delete-button';
59 $info = $this->mParams[
'fields'][
'delete'] + [
60 'formnovalidate' =>
true,
63 unset( $info[
'name'], $info[
'class'] );
65 if ( !isset( $info[
'type'] ) || $info[
'type'] !==
'submit' ) {
67 'HTMLFormFieldCloner delete field, if specified, must be of type "submit"'
71 if ( !in_array( $class, explode(
' ', $info[
'cssclass'] ) ) ) {
72 $info[
'cssclass'] .=
" $class";
75 $this->mParams[
'fields'][
'delete'] = $info;
88 foreach ( $this->mParams[
'fields']
as $fieldname => $info ) {
89 $name =
"{$this->mName}[$key][$fieldname]";
90 if ( isset( $info[
'name'] ) ) {
91 $info[
'name'] =
"{$this->mName}[$key][{$info['name']}]";
93 $info[
'name'] =
$name;
95 if ( isset( $info[
'id'] ) ) {
96 $info[
'id'] = Sanitizer::escapeIdForAttribute(
"{$this->mID}--$key--{$info['id']}" );
98 $info[
'id'] = Sanitizer::escapeIdForAttribute(
"{$this->mID}--$key--$fieldname" );
102 if ( $this->mHideIf ) {
103 if ( isset( $info[
'hide-if'] ) ) {
111 $field = HTMLForm::loadInputFromParameters(
$name, $info, $this->mParent );
112 $fields[$fieldname] = $field;
127 foreach ( $values
as $fieldname =>
$value ) {
128 $name =
"{$this->mName}[$key][$fieldname]";
141 if ( !
$request->getCheck(
'wpEditToken' ) &&
$request->getArray( $this->mName ) ===
null ) {
145 $values =
$request->getArray( $this->mName );
146 if ( $values ===
null ) {
151 foreach ( $values
as $key =>
$value ) {
152 if ( $key ===
'create' || isset(
$value[
'delete'] ) ) {
164 foreach ( $fields
as $fieldname => $field ) {
165 if ( $field->skipLoadData( $subrequest ) ) {
167 } elseif ( !empty( $field->mParams[
'disabled'] ) ) {
168 $row[$fieldname] = $field->getDefault();
170 $row[$fieldname] = $field->loadDataFromRequest( $subrequest );
176 if ( isset( $values[
'create'] ) ) {
180 foreach ( $fields
as $fieldname => $field ) {
181 if ( !empty( $field->mParams[
'nodata'] ) ) {
184 $row[$fieldname] = $field->getDefault();
194 $ret = parent::getDefault();
198 if (
$ret ===
null ) {
201 foreach ( $fields
as $fieldname => $field ) {
202 if ( !empty( $field->mParams[
'nodata'] ) ) {
205 $row[$fieldname] = $field->getDefault();
215 if ( isset( $values[
'nonjs'] ) ) {
219 foreach ( $values
as $key =>
$value ) {
221 foreach ( $fields
as $fieldname => $field ) {
222 if ( !array_key_exists( $fieldname,
$value ) ) {
225 if ( $field->cancelSubmit(
$value[$fieldname], $alldata ) ) {
231 return parent::cancelSubmit( $values, $alldata );
235 if ( isset( $this->mParams[
'required'] )
236 && $this->mParams[
'required'] !==
false
239 return $this->
msg(
'htmlform-cloner-required' );
242 if ( isset( $values[
'nonjs'] ) ) {
249 foreach ( $values
as $key =>
$value ) {
251 foreach ( $fields
as $fieldname => $field ) {
252 if ( !array_key_exists( $fieldname,
$value ) ) {
255 if ( $field->isHidden( $alldata ) ) {
258 $ok = $field->validate(
$value[$fieldname], $alldata );
259 if ( $ok !==
true ) {
265 return parent::validate( $values, $alldata );
276 $displayFormat = $this->mParams[
'format'] ?? $this->mParent->getDisplayFormat();
279 $getFieldHtmlMethod = $displayFormat ==
'table' ?
'getTableRow' : (
'get' . $displayFormat );
286 foreach ( $fields
as $fieldname => $field ) {
287 $v = array_key_exists( $fieldname, $values )
288 ? $values[$fieldname]
289 : $field->getDefault();
296 $html .= $field->$getFieldHtmlMethod( $v );
298 $labelValue = trim( $field->getLabel() );
299 if ( $labelValue !==
"\u{00A0}" && $labelValue !==
' ' && $labelValue !==
'' ) {
305 if ( !isset( $fields[
'delete'] ) ) {
308 if ( $displayFormat ===
'table' ) {
309 $html .= $field->$getFieldHtmlMethod( $field->getDefault() );
311 $html .= $field->getInputHTML( $field->getDefault() );
315 if ( $displayFormat !==
'raw' ) {
317 'mw-htmlform-cloner-row',
321 $classes[] =
'mw-htmlform-nolabel';
325 'class' => implode(
' ', $classes ),
328 if ( $displayFormat ===
'table' ) {
329 $html = Html::rawElement(
'table',
331 Html::rawElement(
'tbody', [],
"\n$html\n" ) ) .
"\n";
339 if ( !empty( $this->mParams[
'row-legend'] ) ) {
340 $legend = $this->
msg( $this->mParams[
'row-legend'] )->text();
352 $name =
"{$this->mName}[$key][delete]";
353 $label = $this->mParams[
'delete-button-message'] ??
'htmlform-cloner-delete';
354 $field = HTMLForm::loadInputFromParameters( $name, [
356 'formnovalidate' =>
true,
358 'id' => Sanitizer::escapeIdForAttribute(
"{$this->mID}--$key--delete" ),
359 'cssclass' =>
'mw-htmlform-cloner-delete-button',
366 $name =
"{$this->mName}[create]";
367 $label = $this->mParams[
'create-button-message'] ??
'htmlform-cloner-create';
368 return HTMLForm::loadInputFromParameters( $name, [
370 'formnovalidate' =>
true,
372 'id' => Sanitizer::escapeIdForAttribute(
"{$this->mID}--create" ),
373 'cssclass' =>
'mw-htmlform-cloner-create-button',
374 'default' => $this->getMessage( $label )->
text(),
382 if ( $key ===
'nonjs' ) {
385 $html .= Html::rawElement(
'li', [
'class' =>
'mw-htmlform-cloner-li' ],
386 $this->getInputHTMLForKey( $key,
$value )
390 $template = $this->getInputHTMLForKey( $this->uniqueId, [] );
391 $html = Html::rawElement(
'ul', [
392 'id' =>
"mw-htmlform-cloner-list-{$this->mID}",
393 'class' =>
'mw-htmlform-cloner-ul',
395 'data-unique-id' => $this->uniqueId,
398 $field = $this->getCreateButtonHtml();
399 $html .= $field->getInputHTML( $field->getDefault() );
415 $fields = $this->createFieldsForKey( $key );
416 foreach ( $fields
as $fieldname => $field ) {
417 $v = array_key_exists( $fieldname, $values )
418 ? $values[$fieldname]
419 : $field->getDefault();
426 $html .= $field->getOOUI( $v );
430 if ( !isset( $fields[
'delete'] ) ) {
431 $field = $this->getDeleteButtonHtml( $key );
432 $fieldHtml = $field->getInputOOUI( $field->getDefault() );
433 $fieldHtml->setInfusable(
true );
439 'mw-htmlform-cloner-row',
443 'class' => implode(
' ', $classes ),
450 if ( !empty( $this->mParams[
'row-legend'] ) ) {
451 $legend = $this->msg( $this->mParams[
'row-legend'] )->text();
462 if ( $key ===
'nonjs' ) {
465 $html .= Html::rawElement(
'li', [
'class' =>
'mw-htmlform-cloner-li' ],
466 $this->getInputOOUIForKey( $key,
$value )
470 $template = $this->getInputOOUIForKey( $this->uniqueId, [] );
471 $html = Html::rawElement(
'ul', [
472 'id' =>
"mw-htmlform-cloner-list-{$this->mID}",
473 'class' =>
'mw-htmlform-cloner-ul',
475 'data-unique-id' => $this->uniqueId,
478 $field = $this->getCreateButtonHtml();
479 $fieldHtml = $field->getInputOOUI( $field->getDefault() );
480 $fieldHtml->setInfusable(
true );
This list may contain false positives That usually means there is additional text with links below the first Each row contains links to the first and second as well as the first line of the second redirect text
Similar to FauxRequest, but only fakes URL parameters and method (POST or GET) and use the base reque...
deferred txt A few of the database updates required by various functions here can be deferred until after the result page is displayed to the user For updating the view updating the linked to tables after a etc PHP does not yet have any way to tell the server to actually return and disconnect while still running these but it might have such a feature in the future We handle these by creating a deferred update object and putting those objects on a global list
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
$data
Utility to generate mapping file used in mw.Title (phpCharToUpper.json)
do that in ParserLimitReportFormat instead use this to modify the parameters of the image all existing parser cache entries will be invalid To avoid you ll need to handle that somehow(e.g. with the RejectParserCacheValue hook) because MediaWiki won 't do it for you. & $defaults also a ContextSource after deleting those rows but within the same transaction you ll probably need to make sure the header is varied on $request
this hook is for auditing only or null if authentication failed before getting that far or null if we can t even determine that When $user is not it can be in the form of< username >< more info > e g for bot passwords intended to be added to log contexts Fields it might only if the login was with a bot password it is not rendered in wiki pages or galleries in category pages allow injecting custom HTML after the section Any uses of the hook need to handle escaping $template
null means default in associative array with keys and values unescaped Should be merged with default with a value of false meaning to suppress the attribute in associative array with keys and values unescaped noclasses & $ret
null means default in associative array with keys and values unescaped Should be merged with default with a value of false meaning to suppress the attribute in associative array with keys and values unescaped noclasses just before the function returns a value If you return an< a > element with HTML attributes $attribs and contents $html will be returned If you return $ret will be returned and may include noclasses & $html
Allows to change the fields on the form that will be generated $name
null means default in associative array with keys and values unescaped Should be merged with default with a value of false meaning to suppress the attribute in associative array with keys and values unescaped noclasses just before the function returns a value If you return an< a > element with HTML attributes $attribs and contents $html will be returned If you return $ret will be returned and may include noclasses after processing & $attribs
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
The wiki should then use memcached to cache various data To use multiple just add more items to the array To increase the weight of a make its entry a array("192.168.0.1:11211", 2))