MediaWiki  1.29.2
LogEventsList.php
Go to the documentation of this file.
1 <?php
28 
30  const NO_ACTION_LINK = 1;
32  const USE_CHECKBOXES = 4;
33 
34  public $flags;
35 
39  protected $mDefaultQuery;
40 
44  protected $showTagEditUI;
45 
49  protected $allowedActions = null;
50 
62  public function __construct( $context, $unused = null, $flags = 0 ) {
63  if ( $context instanceof IContextSource ) {
64  $this->setContext( $context );
65  } else {
66  // Old parameters, $context should be a Skin object
67  $this->setContext( $context->getContext() );
68  }
69 
70  $this->flags = $flags;
71  $this->showTagEditUI = ChangeTags::showTagEditingUI( $this->getUser() );
72  }
73 
87  public function showOptions( $types = [], $user = '', $page = '', $pattern = '', $year = 0,
88  $month = 0, $filter = null, $tagFilter = '', $action = null
89  ) {
91 
93 
94  // For B/C, we take strings, but make sure they are converted...
95  $types = ( $types === '' ) ? [] : (array)$types;
96 
97  $tagSelector = ChangeTags::buildTagFilterSelector( $tagFilter, false, $this->getContext() );
98 
99  $html = Html::hidden( 'title', $title->getPrefixedDBkey() );
100 
101  // Basic selectors
102  $html .= $this->getTypeMenu( $types ) . "\n";
103  $html .= $this->getUserInput( $user ) . "\n";
104  $html .= $this->getTitleInput( $page ) . "\n";
105  $html .= $this->getExtraInputs( $types ) . "\n";
106 
107  // Title pattern, if allowed
108  if ( !$wgMiserMode ) {
109  $html .= $this->getTitlePattern( $pattern ) . "\n";
110  }
111 
112  // date menu
113  $html .= Xml::tags( 'p', null, Xml::dateMenu( (int)$year, (int)$month ) );
114 
115  // Tag filter
116  if ( $tagSelector ) {
117  $html .= Xml::tags( 'p', null, implode( '&#160;', $tagSelector ) );
118  }
119 
120  // Filter links
121  if ( $filter ) {
122  $html .= Xml::tags( 'p', null, $this->getFilterLinks( $filter ) );
123  }
124 
125  // Action filter
126  if ( $action !== null ) {
127  $html .= Xml::tags( 'p', null, $this->getActionSelector( $types, $action ) );
128  }
129 
130  // Submit button
131  $html .= Xml::submitButton( $this->msg( 'logeventslist-submit' )->text() );
132 
133  // Fieldset
134  $html = Xml::fieldset( $this->msg( 'log' )->text(), $html );
135 
136  // Form wrapping
137  $html = Xml::tags( 'form', [ 'action' => $wgScript, 'method' => 'get' ], $html );
138 
139  $this->getOutput()->addHTML( $html );
140  }
141 
146  private function getFilterLinks( $filter ) {
147  // show/hide links
148  $messages = [ $this->msg( 'show' )->text(), $this->msg( 'hide' )->text() ];
149  // Option value -> message mapping
150  $links = [];
151  $hiddens = ''; // keep track for "go" button
152  $linkRenderer = MediaWikiServices::getInstance()->getLinkRenderer();
153  foreach ( $filter as $type => $val ) {
154  // Should the below assignment be outside the foreach?
155  // Then it would have to be copied. Not certain what is more expensive.
156  $query = $this->getDefaultQuery();
157  $queryKey = "hide_{$type}_log";
158 
159  $hideVal = 1 - intval( $val );
160  $query[$queryKey] = $hideVal;
161 
162  $link = $linkRenderer->makeKnownLink(
163  $this->getTitle(),
164  $messages[$hideVal],
165  [],
166  $query
167  );
168 
169  // Message: log-show-hide-patrol
170  $links[$type] = $this->msg( "log-show-hide-{$type}" )->rawParams( $link )->escaped();
171  $hiddens .= Html::hidden( "hide_{$type}_log", $val ) . "\n";
172  }
173 
174  // Build links
175  return '<small>' . $this->getLanguage()->pipeList( $links ) . '</small>' . $hiddens;
176  }
177 
178  private function getDefaultQuery() {
179  if ( !isset( $this->mDefaultQuery ) ) {
180  $this->mDefaultQuery = $this->getRequest()->getQueryValues();
181  unset( $this->mDefaultQuery['title'] );
182  unset( $this->mDefaultQuery['dir'] );
183  unset( $this->mDefaultQuery['offset'] );
184  unset( $this->mDefaultQuery['limit'] );
185  unset( $this->mDefaultQuery['order'] );
186  unset( $this->mDefaultQuery['month'] );
187  unset( $this->mDefaultQuery['year'] );
188  }
189 
190  return $this->mDefaultQuery;
191  }
192 
197  private function getTypeMenu( $queryTypes ) {
198  $queryType = count( $queryTypes ) == 1 ? $queryTypes[0] : '';
199  $selector = $this->getTypeSelector();
200  $selector->setDefault( $queryType );
201 
202  return $selector->getHTML();
203  }
204 
210  public function getTypeSelector() {
211  $typesByName = []; // Temporary array
212  // First pass to load the log names
213  foreach ( LogPage::validTypes() as $type ) {
214  $page = new LogPage( $type );
215  $restriction = $page->getRestriction();
216  if ( $this->getUser()->isAllowed( $restriction ) ) {
217  $typesByName[$type] = $page->getName()->text();
218  }
219  }
220 
221  // Second pass to sort by name
222  asort( $typesByName );
223 
224  // Always put "All public logs" on top
225  $public = $typesByName[''];
226  unset( $typesByName[''] );
227  $typesByName = [ '' => $public ] + $typesByName;
228 
229  $select = new XmlSelect( 'type' );
230  foreach ( $typesByName as $type => $name ) {
231  $select->addOption( $name, $type );
232  }
233 
234  return $select;
235  }
236 
241  private function getUserInput( $user ) {
242  $label = Xml::inputLabel(
243  $this->msg( 'specialloguserlabel' )->text(),
244  'user',
245  'mw-log-user',
246  15,
247  $user,
248  [ 'class' => 'mw-autocomplete-user' ]
249  );
250 
251  return '<span class="mw-input-with-label">' . $label . '</span>';
252  }
253 
258  private function getTitleInput( $title ) {
259  $label = Xml::inputLabel(
260  $this->msg( 'speciallogtitlelabel' )->text(),
261  'page',
262  'mw-log-page',
263  20,
264  $title
265  );
266 
267  return '<span class="mw-input-with-label">' . $label . '</span>';
268  }
269 
274  private function getTitlePattern( $pattern ) {
275  return '<span class="mw-input-with-label">' .
276  Xml::checkLabel( $this->msg( 'log-title-wildcard' )->text(), 'pattern', 'pattern', $pattern ) .
277  '</span>';
278  }
279 
284  private function getExtraInputs( $types ) {
285  if ( count( $types ) == 1 ) {
286  if ( $types[0] == 'suppress' ) {
287  $offender = $this->getRequest()->getVal( 'offender' );
288  $user = User::newFromName( $offender, false );
289  if ( !$user || ( $user->getId() == 0 && !IP::isIPAddress( $offender ) ) ) {
290  $offender = ''; // Blank field if invalid
291  }
292  return Xml::inputLabel( $this->msg( 'revdelete-offender' )->text(), 'offender',
293  'mw-log-offender', 20, $offender );
294  } else {
295  // Allow extensions to add their own extra inputs
296  $input = '';
297  Hooks::run( 'LogEventsListGetExtraInputs', [ $types[0], $this, &$input ] );
298  return $input;
299  }
300  }
301 
302  return '';
303  }
304 
312  private function getActionSelector( $types, $action ) {
313  if ( $this->allowedActions === null || !count( $this->allowedActions ) ) {
314  return '';
315  }
316  $html = '';
317  $html .= Xml::label( wfMessage( 'log-action-filter-' . $types[0] )->text(),
318  'action-filter-' .$types[0] ) . "\n";
319  $select = new XmlSelect( 'subtype' );
320  $select->addOption( wfMessage( 'log-action-filter-all' )->text(), '' );
321  foreach ( $this->allowedActions as $value ) {
322  $msgKey = 'log-action-filter-' . $types[0] . '-' . $value;
323  $select->addOption( wfMessage( $msgKey )->text(), $value );
324  }
325  $select->setDefault( $action );
326  $html .= $select->getHTML();
327  return $html;
328  }
329 
336  public function setAllowedActions( $actions ) {
337  $this->allowedActions = $actions;
338  }
339 
343  public function beginLogEventsList() {
344  return "<ul>\n";
345  }
346 
350  public function endLogEventsList() {
351  return "</ul>\n";
352  }
353 
358  public function logLine( $row ) {
359  $entry = DatabaseLogEntry::newFromRow( $row );
360  $formatter = LogFormatter::newFromEntry( $entry );
361  $formatter->setContext( $this->getContext() );
362  $formatter->setShowUserToolLinks( !( $this->flags & self::NO_EXTRA_USER_LINKS ) );
363 
364  $time = htmlspecialchars( $this->getLanguage()->userTimeAndDate(
365  $entry->getTimestamp(), $this->getUser() ) );
366 
367  $action = $formatter->getActionText();
368 
369  if ( $this->flags & self::NO_ACTION_LINK ) {
370  $revert = '';
371  } else {
372  $revert = $formatter->getActionLinks();
373  if ( $revert != '' ) {
374  $revert = '<span class="mw-logevent-actionlink">' . $revert . '</span>';
375  }
376  }
377 
378  $comment = $formatter->getComment();
379 
380  // Some user can hide log items and have review links
381  $del = $this->getShowHideLinks( $row );
382 
383  // Any tags...
384  list( $tagDisplay, $newClasses ) = ChangeTags::formatSummaryRow(
385  $row->ts_tags,
386  'logevent',
387  $this->getContext()
388  );
389  $classes = array_merge(
390  [ 'mw-logline-' . $entry->getType() ],
391  $newClasses
392  );
393 
394  return Html::rawElement( 'li', [ 'class' => $classes ],
395  "$del $time $action $comment $revert $tagDisplay" ) . "\n";
396  }
397 
402  private function getShowHideLinks( $row ) {
403  // We don't want to see the links and
404  if ( $this->flags == self::NO_ACTION_LINK ) {
405  return '';
406  }
407 
408  $user = $this->getUser();
409 
410  // If change tag editing is available to this user, return the checkbox
411  if ( $this->flags & self::USE_CHECKBOXES && $this->showTagEditUI ) {
412  return Xml::check(
413  'showhiderevisions',
414  false,
415  [ 'name' => 'ids[' . $row->log_id . ']' ]
416  );
417  }
418 
419  // no one can hide items from the suppress log.
420  if ( $row->log_type == 'suppress' ) {
421  return '';
422  }
423 
424  $del = '';
425  // Don't show useless checkbox to people who cannot hide log entries
426  if ( $user->isAllowed( 'deletedhistory' ) ) {
427  $canHide = $user->isAllowed( 'deletelogentry' );
428  $canViewSuppressedOnly = $user->isAllowed( 'viewsuppressed' ) &&
429  !$user->isAllowed( 'suppressrevision' );
430  $entryIsSuppressed = self::isDeleted( $row, LogPage::DELETED_RESTRICTED );
431  $canViewThisSuppressedEntry = $canViewSuppressedOnly && $entryIsSuppressed;
432  if ( $row->log_deleted || $canHide ) {
433  // Show checkboxes instead of links.
434  if ( $canHide && $this->flags & self::USE_CHECKBOXES && !$canViewThisSuppressedEntry ) {
435  // If event was hidden from sysops
436  if ( !self::userCan( $row, LogPage::DELETED_RESTRICTED, $user ) ) {
437  $del = Xml::check( 'deleterevisions', false, [ 'disabled' => 'disabled' ] );
438  } else {
439  $del = Xml::check(
440  'showhiderevisions',
441  false,
442  [ 'name' => 'ids[' . $row->log_id . ']' ]
443  );
444  }
445  } else {
446  // If event was hidden from sysops
447  if ( !self::userCan( $row, LogPage::DELETED_RESTRICTED, $user ) ) {
448  $del = Linker::revDeleteLinkDisabled( $canHide );
449  } else {
450  $query = [
451  'target' => SpecialPage::getTitleFor( 'Log', $row->log_type )->getPrefixedDBkey(),
452  'type' => 'logging',
453  'ids' => $row->log_id,
454  ];
455  $del = Linker::revDeleteLink(
456  $query,
457  $entryIsSuppressed,
458  $canHide && !$canViewThisSuppressedEntry
459  );
460  }
461  }
462  }
463  }
464 
465  return $del;
466  }
467 
475  public static function typeAction( $row, $type, $action, $right = '' ) {
476  $match = is_array( $type ) ?
477  in_array( $row->log_type, $type ) : $row->log_type == $type;
478  if ( $match ) {
479  $match = is_array( $action ) ?
480  in_array( $row->log_action, $action ) : $row->log_action == $action;
481  if ( $match && $right ) {
482  global $wgUser;
483  $match = $wgUser->isAllowed( $right );
484  }
485  }
486 
487  return $match;
488  }
489 
499  public static function userCan( $row, $field, User $user = null ) {
500  return self::userCanBitfield( $row->log_deleted, $field, $user );
501  }
502 
512  public static function userCanBitfield( $bitfield, $field, User $user = null ) {
513  if ( $bitfield & $field ) {
514  if ( $user === null ) {
515  global $wgUser;
516  $user = $wgUser;
517  }
518  if ( $bitfield & LogPage::DELETED_RESTRICTED ) {
519  $permissions = [ 'suppressrevision', 'viewsuppressed' ];
520  } else {
521  $permissions = [ 'deletedhistory' ];
522  }
523  $permissionlist = implode( ', ', $permissions );
524  wfDebug( "Checking for $permissionlist due to $field match on $bitfield\n" );
525  return call_user_func_array( [ $user, 'isAllowedAny' ], $permissions );
526  }
527  return true;
528  }
529 
535  public static function isDeleted( $row, $field ) {
536  return ( $row->log_deleted & $field ) == $field;
537  }
538 
564  public static function showLogExtract(
565  &$out, $types = [], $page = '', $user = '', $param = []
566  ) {
567  $defaultParameters = [
568  'lim' => 25,
569  'conds' => [],
570  'showIfEmpty' => true,
571  'msgKey' => [ '' ],
572  'wrap' => "$1",
573  'flags' => 0,
574  'useRequestParams' => false,
575  'useMaster' => false,
576  'extraUrlParams' => false,
577  ];
578  # The + operator appends elements of remaining keys from the right
579  # handed array to the left handed, whereas duplicated keys are NOT overwritten.
580  $param += $defaultParameters;
581  # Convert $param array to individual variables
582  $lim = $param['lim'];
583  $conds = $param['conds'];
584  $showIfEmpty = $param['showIfEmpty'];
585  $msgKey = $param['msgKey'];
586  $wrap = $param['wrap'];
587  $flags = $param['flags'];
588  $extraUrlParams = $param['extraUrlParams'];
589 
590  $useRequestParams = $param['useRequestParams'];
591  if ( !is_array( $msgKey ) ) {
592  $msgKey = [ $msgKey ];
593  }
594 
595  if ( $out instanceof OutputPage ) {
596  $context = $out->getContext();
597  } else {
599  }
600 
601  # Insert list of top 50 (or top $lim) items
602  $loglist = new LogEventsList( $context, null, $flags );
603  $pager = new LogPager( $loglist, $types, $user, $page, '', $conds );
604  if ( !$useRequestParams ) {
605  # Reset vars that may have been taken from the request
606  $pager->mLimit = 50;
607  $pager->mDefaultLimit = 50;
608  $pager->mOffset = "";
609  $pager->mIsBackwards = false;
610  }
611 
612  if ( $param['useMaster'] ) {
613  $pager->mDb = wfGetDB( DB_MASTER );
614  }
615  if ( isset( $param['offset'] ) ) { # Tell pager to ignore WebRequest offset
616  $pager->setOffset( $param['offset'] );
617  }
618 
619  if ( $lim > 0 ) {
620  $pager->mLimit = $lim;
621  }
622  // Fetch the log rows and build the HTML if needed
623  $logBody = $pager->getBody();
624  $numRows = $pager->getNumRows();
625 
626  $s = '';
627 
628  if ( $logBody ) {
629  if ( $msgKey[0] ) {
630  $dir = $context->getLanguage()->getDir();
631  $lang = $context->getLanguage()->getHtmlCode();
632 
633  $s = Xml::openElement( 'div', [
634  'class' => "mw-warning-with-logexcerpt mw-content-$dir",
635  'dir' => $dir,
636  'lang' => $lang,
637  ] );
638 
639  if ( count( $msgKey ) == 1 ) {
640  $s .= $context->msg( $msgKey[0] )->parseAsBlock();
641  } else { // Process additional arguments
642  $args = $msgKey;
643  array_shift( $args );
644  $s .= $context->msg( $msgKey[0], $args )->parseAsBlock();
645  }
646  }
647  $s .= $loglist->beginLogEventsList() .
648  $logBody .
649  $loglist->endLogEventsList();
650  } elseif ( $showIfEmpty ) {
651  $s = Html::rawElement( 'div', [ 'class' => 'mw-warning-logempty' ],
652  $context->msg( 'logempty' )->parse() );
653  }
654 
655  if ( $numRows > $pager->mLimit ) { # Show "Full log" link
656  $urlParam = [];
657  if ( $page instanceof Title ) {
658  $urlParam['page'] = $page->getPrefixedDBkey();
659  } elseif ( $page != '' ) {
660  $urlParam['page'] = $page;
661  }
662 
663  if ( $user != '' ) {
664  $urlParam['user'] = $user;
665  }
666 
667  if ( !is_array( $types ) ) { # Make it an array, if it isn't
668  $types = [ $types ];
669  }
670 
671  # If there is exactly one log type, we can link to Special:Log?type=foo
672  if ( count( $types ) == 1 ) {
673  $urlParam['type'] = $types[0];
674  }
675 
676  if ( $extraUrlParams !== false ) {
677  $urlParam = array_merge( $urlParam, $extraUrlParams );
678  }
679 
680  $s .= MediaWikiServices::getInstance()->getLinkRenderer()->makeKnownLink(
681  SpecialPage::getTitleFor( 'Log' ),
682  $context->msg( 'log-fulllog' )->text(),
683  [],
684  $urlParam
685  );
686  }
687 
688  if ( $logBody && $msgKey[0] ) {
689  $s .= '</div>';
690  }
691 
692  if ( $wrap != '' ) { // Wrap message in html
693  $s = str_replace( '$1', $s, $wrap );
694  }
695 
696  /* hook can return false, if we don't want the message to be emitted (Wikia BugId:7093) */
697  if ( Hooks::run( 'LogEventsListShowLogExtract', [ &$s, $types, $page, $user, $param ] ) ) {
698  // $out can be either an OutputPage object or a String-by-reference
699  if ( $out instanceof OutputPage ) {
700  $out->addHTML( $s );
701  } else {
702  $out = $s;
703  }
704  }
705 
706  return $numRows;
707  }
708 
717  public static function getExcludeClause( $db, $audience = 'public', User $user = null ) {
718  global $wgLogRestrictions;
719 
720  if ( $audience != 'public' && $user === null ) {
721  global $wgUser;
722  $user = $wgUser;
723  }
724 
725  // Reset the array, clears extra "where" clauses when $par is used
726  $hiddenLogs = [];
727 
728  // Don't show private logs to unprivileged users
729  foreach ( $wgLogRestrictions as $logType => $right ) {
730  if ( $audience == 'public' || !$user->isAllowed( $right ) ) {
731  $hiddenLogs[] = $logType;
732  }
733  }
734  if ( count( $hiddenLogs ) == 1 ) {
735  return 'log_type != ' . $db->addQuotes( $hiddenLogs[0] );
736  } elseif ( $hiddenLogs ) {
737  return 'log_type NOT IN (' . $db->makeList( $hiddenLogs ) . ')';
738  }
739 
740  return false;
741  }
742 }
ContextSource\$context
IContextSource $context
Definition: ContextSource.php:34
$wgUser
$wgUser
Definition: Setup.php:781
ContextSource\getContext
getContext()
Get the base IContextSource object.
Definition: ContextSource.php:41
LogPage\validTypes
static validTypes()
Get the list of valid log types.
Definition: LogPage.php:197
ContextSource\msg
msg()
Get a Message object with context set Parameters are the same as wfMessage()
Definition: ContextSource.php:187
Xml\tags
static tags( $element, $attribs=null, $contents)
Same as Xml::element(), but does not escape contents.
Definition: Xml.php:131
$lang
if(!isset( $args[0])) $lang
Definition: testCompression.php:33
Xml\label
static label( $label, $id, $attribs=[])
Convenience function to build an HTML form label.
Definition: Xml.php:358
captcha-old.count
count
Definition: captcha-old.py:225
text
design txt This is a brief overview of the new design More thorough and up to date information is available on the documentation wiki at etc Handles the details of getting and saving to the user table of the and dealing with sessions and cookies OutputPage Encapsulates the entire HTML page that will be sent in response to any server request It is used by calling its functions to add text
Definition: design.txt:12
$wgScript
$wgScript
The URL path to index.php.
Definition: DefaultSettings.php:202
use
as see the revision history and available at free of to any person obtaining a copy of this software and associated documentation to deal in the Software without including without limitation the rights to use
Definition: MIT-LICENSE.txt:10
$user
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
Definition: hooks.txt:246
it
=Architecture==Two class hierarchies are used to provide the functionality associated with the different content models:*Content interface(and AbstractContent base class) define functionality that acts on the concrete content of a page, and *ContentHandler base class provides functionality specific to a content model, but not acting on concrete content. The most important function of ContentHandler is to act as a factory for the appropriate implementation of Content. These Content objects are to be used by MediaWiki everywhere, instead of passing page content around as text. All manipulation and analysis of page content must be done via the appropriate methods of the Content object. For each content model, a subclass of ContentHandler has to be registered with $wgContentHandlers. The ContentHandler object for a given content model can be obtained using ContentHandler::getForModelID($id). Also Title, WikiPage and Revision now have getContentHandler() methods for convenience. ContentHandler objects are singletons that provide functionality specific to the content type, but not directly acting on the content of some page. ContentHandler::makeEmptyContent() and ContentHandler::unserializeContent() can be used to create a Content object of the appropriate type. However, it is recommended to instead use WikiPage::getContent() resp. Revision::getContent() to get a page 's content as a Content object. These two methods should be the ONLY way in which page content is accessed. Another important function of ContentHandler objects is to define custom action handlers for a content model, see ContentHandler::getActionOverrides(). This is similar to what WikiPage::getActionOverrides() was already doing.==Serialization==With the ContentHandler facility, page content no longer has to be text based. Objects implementing the Content interface are used to represent and handle the content internally. For storage and data exchange, each content model supports at least one serialization format via ContentHandler::serializeContent($content). The list of supported formats for a given content model can be accessed using ContentHandler::getSupportedFormats(). Content serialization formats are identified using MIME type like strings. The following formats are built in:*text/x-wiki - wikitext *text/javascript - for js pages *text/css - for css pages *text/plain - for future use, e.g. with plain text messages. *text/html - for future use, e.g. with plain html messages. *application/vnd.php.serialized - for future use with the api and for extensions *application/json - for future use with the api, and for use by extensions *application/xml - for future use with the api, and for use by extensions In PHP, use the corresponding CONTENT_FORMAT_XXX constant. Note that when using the API to access page content, especially action=edit, action=parse and action=query &prop=revisions, the model and format of the content should always be handled explicitly. Without that information, interpretation of the provided content is not reliable. The same applies to XML dumps generated via maintenance/dumpBackup.php or Special:Export. Also note that the API will provide encapsulated, serialized content - so if the API was called with format=json, and contentformat is also json(or rather, application/json), the page content is represented as a string containing an escaped json structure. Extensions that use JSON to serialize some types of page content may provide specialized API modules that allow access to that content in a more natural form.==Compatibility==The ContentHandler facility is introduced in a way that should allow all existing code to keep functioning at least for pages that contain wikitext or other text based content. However, a number of functions and hooks have been deprecated in favor of new versions that are aware of the page 's content model, and will now generate warnings when used. Most importantly, the following functions have been deprecated:*Revisions::getText() is deprecated in favor Revisions::getContent() *WikiPage::getText() is deprecated in favor WikiPage::getContent() Also, the old Article::getContent()(which returns text) is superceded by Article::getContentObject(). However, both methods should be avoided since they do not provide clean access to the page 's actual content. For instance, they may return a system message for non-existing pages. Use WikiPage::getContent() instead. Code that relies on a textual representation of the page content should eventually be rewritten. However, ContentHandler::getContentText() provides a stop-gap that can be used to get text for a page. Its behavior is controlled by $wgContentHandlerTextFallback it
Definition: contenthandler.txt:104
LogEventsList\$showTagEditUI
bool $showTagEditUI
Definition: LogEventsList.php:44
LogPager
Definition: LogPager.php:29
IContextSource\msg
msg()
Get a Message object with context set.
User\newFromName
static newFromName( $name, $validate='valid')
Static factory method for creation from username.
Definition: User.php:556
link
usually copyright or history_copyright This message must be in HTML not wikitext if the section is included from a template to be included in the link
Definition: hooks.txt:2929
$s
$s
Definition: mergeMessageFileList.php:188
$linkRenderer
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 after in associative array form before processing starts Return false to skip default processing and return $ret $linkRenderer
Definition: hooks.txt:1956
SpecialPage\getTitleFor
static getTitleFor( $name, $subpage=false, $fragment='')
Get a localised Title object for a specified special page name If you don't need a full Title object,...
Definition: SpecialPage.php:82
ChangeTags\showTagEditingUI
static showTagEditingUI(User $user)
Indicate whether change tag editing UI is relevant.
Definition: ChangeTags.php:1360
$name
Allows to change the fields on the form that will be generated $name
Definition: hooks.txt:304
LogEventsList\getTitleInput
getTitleInput( $title)
Definition: LogEventsList.php:258
ContextSource\getRequest
getRequest()
Get the WebRequest object.
Definition: ContextSource.php:78
ChangeTags\buildTagFilterSelector
static buildTagFilterSelector( $selected='', $ooui=false, IContextSource $context=null)
Build a text box to select a change tag.
Definition: ChangeTags.php:678
LogEventsList\$mDefaultQuery
array $mDefaultQuery
Definition: LogEventsList.php:39
$type
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 my talk my contributions etc etc otherwise the built in rate limiting checks are if enabled allows for interception of redirect as a string mapping parameter names to values & $type
Definition: hooks.txt:2536
ContextSource\getUser
getUser()
Get the User object.
Definition: ContextSource.php:133
ContextSource\getTitle
getTitle()
Get the Title object.
Definition: ContextSource.php:88
$messages
$messages
Definition: LogTests.i18n.php:8
Xml\openElement
static openElement( $element, $attribs=null)
This opens an XML element.
Definition: Xml.php:109
LogEventsList\USE_CHECKBOXES
const USE_CHECKBOXES
Definition: LogEventsList.php:32
php
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
Definition: injection.txt:35
Wikimedia\Rdbms\IDatabase
Basic database interface for live and lazy-loaded relation database handles.
Definition: IDatabase.php:40
XmlSelect
Class for generating HTML <select> or <datalist> elements.
Definition: XmlSelect.php:26
ContextSource\getLanguage
getLanguage()
Get the Language object.
Definition: ContextSource.php:143
Xml\fieldset
static fieldset( $legend=false, $content=false, $attribs=[])
Shortcut for creating fieldsets.
Definition: Xml.php:577
flags
design txt This is a brief overview of the new design More thorough and up to date information is available on the documentation wiki at etc Handles the details of getting and saving to the user table of the and dealing with sessions and cookies OutputPage Encapsulates the entire HTML page that will be sent in response to any server request It is used by calling its functions to add in any and then calling but I prefer the flexibility This should also do the output encoding The system allocates a global one in $wgOut Title Represents the title of an and does all the work of translating among various forms such as plain database etc For and for historical it also represents a few features of articles that don t involve their such as access rights See also title txt Article Encapsulates access to the page table of the database The object represents a an and maintains state such as flags
Definition: design.txt:34
$query
null for the wiki Added should default to null in handler for backwards compatibility add a value to it if you want to add a cookie that have to vary cache options can modify $query
Definition: hooks.txt:1572
$html
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
Definition: hooks.txt:1956
$title
namespace and then decline to actually register it file or subcat img or subcat $title
Definition: hooks.txt:934
DatabaseLogEntry\newFromRow
static newFromRow( $row)
Constructs new LogEntry from database result row.
Definition: LogEntry.php:203
LogEventsList\setAllowedActions
setAllowedActions( $actions)
Sets the action types allowed for log filtering To one action type may correspond several log_actions...
Definition: LogEventsList.php:336
LogEventsList\getTypeMenu
getTypeMenu( $queryTypes)
Definition: LogEventsList.php:197
LogEventsList\getUserInput
getUserInput( $user)
Definition: LogEventsList.php:241
LogEventsList\getTypeSelector
getTypeSelector()
Returns log page selector.
Definition: LogEventsList.php:210
wfGetDB
wfGetDB( $db, $groups=[], $wiki=false)
Get a Database object.
Definition: GlobalFunctions.php:3060
$input
if(is_array( $mode)) switch( $mode) $input
Definition: postprocess-phan.php:141
$page
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
Definition: hooks.txt:2536
ContextSource\getOutput
getOutput()
Get the OutputPage object.
Definition: ContextSource.php:123
ContextSource
The simplest way of implementing IContextSource is to hold a RequestContext as a member variable and ...
Definition: ContextSource.php:30
Xml\check
static check( $name, $checked=false, $attribs=[])
Convenience function to build an HTML checkbox.
Definition: Xml.php:323
LogEventsList\typeAction
static typeAction( $row, $type, $action, $right='')
Definition: LogEventsList.php:475
LogPage
Class to simplify the use of log pages.
Definition: LogPage.php:31
LogEventsList\showOptions
showOptions( $types=[], $user='', $page='', $pattern='', $year=0, $month=0, $filter=null, $tagFilter='', $action=null)
Show options for the log list.
Definition: LogEventsList.php:87
div
div
Definition: parserTests.txt:6533
LogEventsList\logLine
logLine( $row)
Definition: LogEventsList.php:358
message
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 message
Definition: hooks.txt:2114
Linker\revDeleteLinkDisabled
static revDeleteLinkDisabled( $delete=true)
Creates a dead (show/hide) link for deleting revisions/log entries.
Definition: Linker.php:2080
LogEventsList\getFilterLinks
getFilterLinks( $filter)
Definition: LogEventsList.php:146
$time
see documentation in includes Linker php for Linker::makeImageLink & $time
Definition: hooks.txt:1769
global
when a variable name is used in a it is silently declared as a new masking the global
Definition: design.txt:93
LogEventsList\showLogExtract
static showLogExtract(&$out, $types=[], $page='', $user='', $param=[])
Show log extract.
Definition: LogEventsList.php:564
DB_MASTER
const DB_MASTER
Definition: defines.php:26
LogEventsList\getActionSelector
getActionSelector( $types, $action)
Drop down menu for selection of actions that can be used to filter the log.
Definition: LogEventsList.php:312
wfDebug
wfDebug( $text, $dest='all', array $context=[])
Sends a line to the debug log if enabled or, optionally, to a comment in output.
Definition: GlobalFunctions.php:999
ContextSource\setContext
setContext(IContextSource $context)
Set the IContextSource object.
Definition: ContextSource.php:58
LogEventsList
Definition: LogEventsList.php:29
OutputPage
This class should be covered by a general architecture document which does not exist as of January 20...
Definition: OutputPage.php:44
list
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
Definition: deferred.txt:11
$dir
$dir
Definition: Autoload.php:8
Html\hidden
static hidden( $name, $value, array $attribs=[])
Convenience function to produce an input element with type=hidden.
Definition: Html.php:746
$selector
$selector
Definition: styleTest.css.php:43
$value
$value
Definition: styleTest.css.php:45
LogEventsList\getExcludeClause
static getExcludeClause( $db, $audience='public', User $user=null)
SQL clause to skip forbidden log types for this user.
Definition: LogEventsList.php:717
LogEventsList\__construct
__construct( $context, $unused=null, $flags=0)
Constructor.
Definition: LogEventsList.php:62
LogEventsList\getShowHideLinks
getShowHideLinks( $row)
Definition: LogEventsList.php:402
RequestContext\getMain
static getMain()
Static methods.
Definition: RequestContext.php:468
$revert
div flags Integer display flags(NO_ACTION_LINK, NO_EXTRA_USER_LINKS) 'LogException' returning false will NOT prevent logging a wrapping ErrorException instead of letting the login form give the generic error message that the account does not exist For when the account has been renamed or deleted or an array to pass a message key and parameters create2 Corresponds to logging log_action database field and which is displayed in the UI & $revert
Definition: hooks.txt:2122
IContextSource
Interface for objects which can provide a MediaWiki context on request.
Definition: IContextSource.php:55
WebRequest
The WebRequest class encapsulates getting at data passed in the URL or via a POSTed form stripping il...
Definition: WebRequest.php:38
$args
if( $line===false) $args
Definition: cdb.php:63
Title
Represents a title within MediaWiki.
Definition: Title.php:39
$wgMiserMode
$wgMiserMode
Disable database-intensive features.
Definition: DefaultSettings.php:2144
type
This document describes the state of Postgres support in and is fairly well maintained The main code is very well while extensions are very hit and miss it is probably the most supported database after MySQL Much of the work in making MediaWiki database agnostic came about through the work of creating Postgres as and are nearing end of but without copying over all the usage comments General notes on the but these can almost always be programmed around *Although Postgres has a true BOOLEAN type
Definition: postgres.txt:22
LogEventsList\userCanBitfield
static userCanBitfield( $bitfield, $field, User $user=null)
Determine if the current user is allowed to view a particular field of this log row,...
Definition: LogEventsList.php:512
LogEventsList\$flags
$flags
Definition: LogEventsList.php:34
as
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
Definition: distributors.txt:9
Xml\dateMenu
static dateMenu( $year, $month)
Definition: Xml.php:167
LogEventsList\userCan
static userCan( $row, $field, User $user=null)
Determine if the current user is allowed to view a particular field of this log row,...
Definition: LogEventsList.php:499
LogEventsList\isDeleted
static isDeleted( $row, $field)
Definition: LogEventsList.php:535
Html\rawElement
static rawElement( $element, $attribs=[], $contents='')
Returns an HTML element in a string.
Definition: Html.php:209
Linker\revDeleteLink
static revDeleteLink( $query=[], $restricted=false, $delete=true)
Creates a (show/hide) link for deleting revisions/log entries.
Definition: Linker.php:2058
$link
usually copyright or history_copyright This message must be in HTML not wikitext & $link
Definition: hooks.txt:2929
LogPage\DELETED_RESTRICTED
const DELETED_RESTRICTED
Definition: LogPage.php:35
wfMessage
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 "&lt
LogEventsList\NO_ACTION_LINK
const NO_ACTION_LINK
Definition: LogEventsList.php:30
LogEventsList\getDefaultQuery
getDefaultQuery()
Definition: LogEventsList.php:178
LogEventsList\endLogEventsList
endLogEventsList()
Definition: LogEventsList.php:350
LogEventsList\getExtraInputs
getExtraInputs( $types)
Definition: LogEventsList.php:284
LogEventsList\NO_EXTRA_USER_LINKS
const NO_EXTRA_USER_LINKS
Definition: LogEventsList.php:31
LogEventsList\$allowedActions
array $allowedActions
Definition: LogEventsList.php:49
MediaWikiServices
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 MediaWikiServices
Definition: injection.txt:23
LogEventsList\beginLogEventsList
beginLogEventsList()
Definition: LogEventsList.php:343
User
The User object encapsulates all of the user-specific settings (user_id, name, rights,...
Definition: User.php:50
Hooks\run
static run( $event, array $args=[], $deprecatedVersion=null)
Call hook functions defined in Hooks::register and $wgHooks.
Definition: Hooks.php:131
Xml\inputLabel
static inputLabel( $label, $name, $id, $size=false, $value=false, $attribs=[])
Convenience function to build an HTML text input field with a label.
Definition: Xml.php:380
LogEventsList\getTitlePattern
getTitlePattern( $pattern)
Definition: LogEventsList.php:274
ChangeTags\formatSummaryRow
static formatSummaryRow( $tags, $page, IContextSource $context=null)
Creates HTML for the given tags.
Definition: ChangeTags.php:52
IP\isIPAddress
static isIPAddress( $ip)
Determine if a string is as valid IP address or network (CIDR prefix).
Definition: IP.php:79
IContextSource\getLanguage
getLanguage()
Get the Language object.
array
the array() calling protocol came about after MediaWiki 1.4rc1.
Xml\submitButton
static submitButton( $value, $attribs=[])
Convenience function to build an HTML submit button When $wgUseMediaWikiUIEverywhere is true it will ...
Definition: Xml.php:459
Xml\checkLabel
static checkLabel( $label, $name, $id, $checked=false, $attribs=[])
Convenience function to build an HTML checkbox with a label.
Definition: Xml.php:419
LogFormatter\newFromEntry
static newFromEntry(LogEntry $entry)
Constructs a new formatter suitable for given entry.
Definition: LogFormatter.php:48
$out
this hook is for auditing only or null if authentication failed before getting that far or null if we can t even determine that probably a stub 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 see BaseTemplate::getToolbox and BaseTemplate::makeListItem for details on the format of individual items inside of this array or by returning and letting standard HTTP rendering take place modifiable or by returning false and taking over the output $out
Definition: hooks.txt:783