MediaWiki  1.23.14
LogEventsList.php
Go to the documentation of this file.
1 <?php
27  const NO_ACTION_LINK = 1;
30 
31  public $flags;
32 
36  protected $mDefaultQuery;
37 
49  public function __construct( $context, $unused = null, $flags = 0 ) {
50  if ( $context instanceof IContextSource ) {
51  $this->setContext( $context );
52  } else {
53  // Old parameters, $context should be a Skin object
54  $this->setContext( $context->getContext() );
55  }
56 
57  $this->flags = $flags;
58  }
59 
66  public function getDisplayTitle() {
67  wfDeprecated( __METHOD__, '1.20' );
68  return $this->getTitle();
69  }
70 
76  public function showHeader( $type ) {
77  wfDeprecated( __METHOD__, '1.19' );
78  // If only one log type is used, then show a special message...
79  $headerType = count( $type ) == 1 ? $type[0] : '';
80  $out = $this->getOutput();
81  if ( LogPage::isLogType( $headerType ) ) {
82  $page = new LogPage( $headerType );
83  $out->setPageTitle( $page->getName()->text() );
84  $out->addHTML( $page->getDescription()->parseAsBlock() );
85  } else {
86  $out->addHTML( $this->msg( 'alllogstext' )->parse() );
87  }
88  }
89 
102  public function showOptions( $types = array(), $user = '', $page = '', $pattern = '', $year = 0,
103  $month = 0, $filter = null, $tagFilter = ''
104  ) {
105  global $wgScript, $wgMiserMode;
106 
107  $title = SpecialPage::getTitleFor( 'Log' );
108 
109  // For B/C, we take strings, but make sure they are converted...
110  $types = ( $types === '' ) ? array() : (array)$types;
111 
112  $tagSelector = ChangeTags::buildTagFilterSelector( $tagFilter );
113 
114  $html = Html::hidden( 'title', $title->getPrefixedDBkey() );
115 
116  // Basic selectors
117  $html .= $this->getTypeMenu( $types ) . "\n";
118  $html .= $this->getUserInput( $user ) . "\n";
119  $html .= $this->getTitleInput( $page ) . "\n";
120  $html .= $this->getExtraInputs( $types ) . "\n";
121 
122  // Title pattern, if allowed
123  if ( !$wgMiserMode ) {
124  $html .= $this->getTitlePattern( $pattern ) . "\n";
125  }
126 
127  // date menu
128  $html .= Xml::tags( 'p', null, Xml::dateMenu( (int)$year, (int)$month ) );
129 
130  // Tag filter
131  if ( $tagSelector ) {
132  $html .= Xml::tags( 'p', null, implode( '&#160;', $tagSelector ) );
133  }
134 
135  // Filter links
136  if ( $filter ) {
137  $html .= Xml::tags( 'p', null, $this->getFilterLinks( $filter ) );
138  }
139 
140  // Submit button
141  $html .= Xml::submitButton( $this->msg( 'allpagessubmit' )->text() );
142 
143  // Fieldset
144  $html = Xml::fieldset( $this->msg( 'log' )->text(), $html );
145 
146  // Form wrapping
147  $html = Xml::tags( 'form', array( 'action' => $wgScript, 'method' => 'get' ), $html );
148 
149  $this->getOutput()->addHTML( $html );
150  }
151 
156  private function getFilterLinks( $filter ) {
157  // show/hide links
158  $messages = array( $this->msg( 'show' )->escaped(), $this->msg( 'hide' )->escaped() );
159  // Option value -> message mapping
160  $links = array();
161  $hiddens = ''; // keep track for "go" button
162  foreach ( $filter as $type => $val ) {
163  // Should the below assignment be outside the foreach?
164  // Then it would have to be copied. Not certain what is more expensive.
165  $query = $this->getDefaultQuery();
166  $queryKey = "hide_{$type}_log";
167 
168  $hideVal = 1 - intval( $val );
169  $query[$queryKey] = $hideVal;
170 
172  $this->getTitle(),
173  $messages[$hideVal],
174  array(),
175  $query
176  );
177 
178  // Message: log-show-hide-patrol
179  $links[$type] = $this->msg( "log-show-hide-{$type}" )->rawParams( $link )->escaped();
180  $hiddens .= Html::hidden( "hide_{$type}_log", $val ) . "\n";
181  }
182 
183  // Build links
184  return '<small>' . $this->getLanguage()->pipeList( $links ) . '</small>' . $hiddens;
185  }
186 
187  private function getDefaultQuery() {
188  if ( !isset( $this->mDefaultQuery ) ) {
189  $this->mDefaultQuery = $this->getRequest()->getQueryValues();
190  unset( $this->mDefaultQuery['title'] );
191  unset( $this->mDefaultQuery['dir'] );
192  unset( $this->mDefaultQuery['offset'] );
193  unset( $this->mDefaultQuery['limit'] );
194  unset( $this->mDefaultQuery['order'] );
195  unset( $this->mDefaultQuery['month'] );
196  unset( $this->mDefaultQuery['year'] );
197  }
198 
199  return $this->mDefaultQuery;
200  }
201 
206  private function getTypeMenu( $queryTypes ) {
207  $queryType = count( $queryTypes ) == 1 ? $queryTypes[0] : '';
208  $selector = $this->getTypeSelector();
209  $selector->setDefault( $queryType );
210 
211  return $selector->getHtml();
212  }
213 
219  public function getTypeSelector() {
220  $typesByName = array(); // Temporary array
221  // First pass to load the log names
222  foreach ( LogPage::validTypes() as $type ) {
223  $page = new LogPage( $type );
224  $restriction = $page->getRestriction();
225  if ( $this->getUser()->isAllowed( $restriction ) ) {
226  $typesByName[$type] = $page->getName()->text();
227  }
228  }
229 
230  // Second pass to sort by name
231  asort( $typesByName );
232 
233  // Always put "All public logs" on top
234  $public = $typesByName[''];
235  unset( $typesByName[''] );
236  $typesByName = array( '' => $public ) + $typesByName;
237 
238  $select = new XmlSelect( 'type' );
239  foreach ( $typesByName as $type => $name ) {
240  $select->addOption( $name, $type );
241  }
242 
243  return $select;
244  }
245 
250  private function getUserInput( $user ) {
251  $label = Xml::inputLabel(
252  $this->msg( 'specialloguserlabel' )->text(),
253  'user',
254  'mw-log-user',
255  15,
256  $user
257  );
258 
259  return '<span style="white-space: nowrap">' . $label . '</span>';
260  }
261 
266  private function getTitleInput( $title ) {
267  $label = Xml::inputLabel(
268  $this->msg( 'speciallogtitlelabel' )->text(),
269  'page',
270  'mw-log-page',
271  20,
272  $title
273  );
274 
275  return '<span style="white-space: nowrap">' . $label . '</span>';
276  }
277 
282  private function getTitlePattern( $pattern ) {
283  return '<span style="white-space: nowrap">' .
284  Xml::checkLabel( $this->msg( 'log-title-wildcard' )->text(), 'pattern', 'pattern', $pattern ) .
285  '</span>';
286  }
287 
292  private function getExtraInputs( $types ) {
293  $offender = $this->getRequest()->getVal( 'offender' );
294  $user = User::newFromName( $offender, false );
295  if ( !$user || ( $user->getId() == 0 && !IP::isIPAddress( $offender ) ) ) {
296  $offender = ''; // Blank field if invalid
297  }
298  if ( count( $types ) == 1 && $types[0] == 'suppress' ) {
299  return Xml::inputLabel( $this->msg( 'revdelete-offender' )->text(), 'offender',
300  'mw-log-offender', 20, $offender );
301  }
302 
303  return '';
304  }
305 
309  public function beginLogEventsList() {
310  return "<ul>\n";
311  }
312 
316  public function endLogEventsList() {
317  return "</ul>\n";
318  }
319 
324  public function logLine( $row ) {
325  $entry = DatabaseLogEntry::newFromRow( $row );
326  $formatter = LogFormatter::newFromEntry( $entry );
327  $formatter->setContext( $this->getContext() );
328  $formatter->setShowUserToolLinks( !( $this->flags & self::NO_EXTRA_USER_LINKS ) );
329 
330  $time = htmlspecialchars( $this->getLanguage()->userTimeAndDate(
331  $entry->getTimestamp(), $this->getUser() ) );
332 
333  $action = $formatter->getActionText();
334 
335  if ( $this->flags & self::NO_ACTION_LINK ) {
336  $revert = '';
337  } else {
338  $revert = $formatter->getActionLinks();
339  if ( $revert != '' ) {
340  $revert = '<span class="mw-logevent-actionlink">' . $revert . '</span>';
341  }
342  }
343 
344  $comment = $formatter->getComment();
345 
346  // Some user can hide log items and have review links
347  $del = $this->getShowHideLinks( $row );
348 
349  // Any tags...
350  list( $tagDisplay, $newClasses ) = ChangeTags::formatSummaryRow( $row->ts_tags, 'logevent' );
351  $classes = array_merge(
352  array( 'mw-logline-' . $entry->getType() ),
353  $newClasses
354  );
355 
356  return Html::rawElement( 'li', array( 'class' => $classes ),
357  "$del $time $action $comment $revert $tagDisplay" ) . "\n";
358  }
359 
364  private function getShowHideLinks( $row ) {
365  // We don't want to see the links and
366  // no one can hide items from the suppress log.
367  if ( ( $this->flags == self::NO_ACTION_LINK )
368  || $row->log_type == 'suppress'
369  ) {
370  return '';
371  }
372  $del = '';
373  $user = $this->getUser();
374  // Don't show useless checkbox to people who cannot hide log entries
375  if ( $user->isAllowed( 'deletedhistory' ) ) {
376  $canHide = $user->isAllowed( 'deletelogentry' );
377  if ( $row->log_deleted || $canHide ) {
378  // Show checkboxes instead of links.
379  if ( $canHide && $this->flags & self::USE_REVDEL_CHECKBOXES ) {
380  // If event was hidden from sysops
381  if ( !self::userCan( $row, LogPage::DELETED_RESTRICTED, $user ) ) {
382  $del = Xml::check( 'deleterevisions', false, array( 'disabled' => 'disabled' ) );
383  } else {
384  $del = Xml::check(
385  'showhiderevisions',
386  false,
387  array( 'name' => 'ids[' . $row->log_id . ']' )
388  );
389  }
390  } else {
391  // If event was hidden from sysops
392  if ( !self::userCan( $row, LogPage::DELETED_RESTRICTED, $user ) ) {
393  $del = Linker::revDeleteLinkDisabled( $canHide );
394  } else {
395  $query = array(
396  'target' => SpecialPage::getTitleFor( 'Log', $row->log_type )->getPrefixedDBkey(),
397  'type' => 'logging',
398  'ids' => $row->log_id,
399  );
400  $del = Linker::revDeleteLink(
401  $query,
402  self::isDeleted( $row, LogPage::DELETED_RESTRICTED ),
403  $canHide
404  );
405  }
406  }
407  }
408  }
409 
410  return $del;
411  }
412 
420  public static function typeAction( $row, $type, $action, $right = '' ) {
421  $match = is_array( $type ) ?
422  in_array( $row->log_type, $type ) : $row->log_type == $type;
423  if ( $match ) {
424  $match = is_array( $action ) ?
425  in_array( $row->log_action, $action ) : $row->log_action == $action;
426  if ( $match && $right ) {
427  global $wgUser;
428  $match = $wgUser->isAllowed( $right );
429  }
430  }
431 
432  return $match;
433  }
434 
444  public static function userCan( $row, $field, User $user = null ) {
445  return self::userCanBitfield( $row->log_deleted, $field, $user );
446  }
447 
457  public static function userCanBitfield( $bitfield, $field, User $user = null ) {
458  if ( $bitfield & $field ) {
459  if ( $bitfield & LogPage::DELETED_RESTRICTED ) {
460  $permission = 'suppressrevision';
461  } else {
462  $permission = 'deletedhistory';
463  }
464  wfDebug( "Checking for $permission due to $field match on $bitfield\n" );
465  if ( $user === null ) {
466  global $wgUser;
467  $user = $wgUser;
468  }
469 
470  return $user->isAllowed( $permission );
471  }
472 
473  return true;
474  }
475 
481  public static function isDeleted( $row, $field ) {
482  return ( $row->log_deleted & $field ) == $field;
483  }
484 
508  public static function showLogExtract(
509  &$out, $types = array(), $page = '', $user = '', $param = array()
510  ) {
511  $defaultParameters = array(
512  'lim' => 25,
513  'conds' => array(),
514  'showIfEmpty' => true,
515  'msgKey' => array( '' ),
516  'wrap' => "$1",
517  'flags' => 0,
518  'useRequestParams' => false,
519  'useMaster' => false,
520  );
521  # The + operator appends elements of remaining keys from the right
522  # handed array to the left handed, whereas duplicated keys are NOT overwritten.
523  $param += $defaultParameters;
524  # Convert $param array to individual variables
525  $lim = $param['lim'];
526  $conds = $param['conds'];
527  $showIfEmpty = $param['showIfEmpty'];
528  $msgKey = $param['msgKey'];
529  $wrap = $param['wrap'];
530  $flags = $param['flags'];
531  $useRequestParams = $param['useRequestParams'];
532  if ( !is_array( $msgKey ) ) {
533  $msgKey = array( $msgKey );
534  }
535 
536  if ( $out instanceof OutputPage ) {
537  $context = $out->getContext();
538  } else {
540  }
541 
542  # Insert list of top 50 (or top $lim) items
543  $loglist = new LogEventsList( $context, null, $flags );
544  $pager = new LogPager( $loglist, $types, $user, $page, '', $conds );
545  if ( !$useRequestParams ) {
546  # Reset vars that may have been taken from the request
547  $pager->mLimit = 50;
548  $pager->mDefaultLimit = 50;
549  $pager->mOffset = "";
550  $pager->mIsBackwards = false;
551  }
552 
553  if ( $param['useMaster'] ) {
554  $pager->mDb = wfGetDB( DB_MASTER );
555  }
556  if ( isset( $param['offset'] ) ) { # Tell pager to ignore WebRequest offset
557  $pager->setOffset( $param['offset'] );
558  }
559 
560  if ( $lim > 0 ) {
561  $pager->mLimit = $lim;
562  }
563 
564  $logBody = $pager->getBody();
565  $s = '';
566 
567  if ( $logBody ) {
568  if ( $msgKey[0] ) {
569  $dir = $context->getLanguage()->getDir();
570  $lang = $context->getLanguage()->getCode();
571 
572  $s = Xml::openElement( 'div', array(
573  'class' => "mw-warning-with-logexcerpt mw-content-$dir",
574  'dir' => $dir,
575  'lang' => $lang,
576  ) );
577 
578  if ( count( $msgKey ) == 1 ) {
579  $s .= $context->msg( $msgKey[0] )->parseAsBlock();
580  } else { // Process additional arguments
581  $args = $msgKey;
582  array_shift( $args );
583  $s .= $context->msg( $msgKey[0], $args )->parseAsBlock();
584  }
585  }
586  $s .= $loglist->beginLogEventsList() .
587  $logBody .
588  $loglist->endLogEventsList();
589  } elseif ( $showIfEmpty ) {
590  $s = Html::rawElement( 'div', array( 'class' => 'mw-warning-logempty' ),
591  $context->msg( 'logempty' )->parse() );
592  }
593 
594  if ( $pager->getNumRows() > $pager->mLimit ) { # Show "Full log" link
595  $urlParam = array();
596  if ( $page instanceof Title ) {
597  $urlParam['page'] = $page->getPrefixedDBkey();
598  } elseif ( $page != '' ) {
599  $urlParam['page'] = $page;
600  }
601 
602  if ( $user != '' ) {
603  $urlParam['user'] = $user;
604  }
605 
606  if ( !is_array( $types ) ) { # Make it an array, if it isn't
607  $types = array( $types );
608  }
609 
610  # If there is exactly one log type, we can link to Special:Log?type=foo
611  if ( count( $types ) == 1 ) {
612  $urlParam['type'] = $types[0];
613  }
614 
615  $s .= Linker::link(
616  SpecialPage::getTitleFor( 'Log' ),
617  $context->msg( 'log-fulllog' )->escaped(),
618  array(),
619  $urlParam
620  );
621  }
622 
623  if ( $logBody && $msgKey[0] ) {
624  $s .= '</div>';
625  }
626 
627  if ( $wrap != '' ) { // Wrap message in html
628  $s = str_replace( '$1', $s, $wrap );
629  }
630 
631  /* hook can return false, if we don't want the message to be emitted (Wikia BugId:7093) */
632  if ( wfRunHooks( 'LogEventsListShowLogExtract', array( &$s, $types, $page, $user, $param ) ) ) {
633  // $out can be either an OutputPage object or a String-by-reference
634  if ( $out instanceof OutputPage ) {
635  $out->addHTML( $s );
636  } else {
637  $out = $s;
638  }
639  }
640 
641  return $pager->getNumRows();
642  }
643 
652  public static function getExcludeClause( $db, $audience = 'public', User $user = null ) {
653  global $wgLogRestrictions;
654 
655  if ( $audience != 'public' && $user === null ) {
656  global $wgUser;
657  $user = $wgUser;
658  }
659 
660  // Reset the array, clears extra "where" clauses when $par is used
661  $hiddenLogs = array();
662 
663  // Don't show private logs to unprivileged users
664  foreach ( $wgLogRestrictions as $logType => $right ) {
665  if ( $audience == 'public' || !$user->isAllowed( $right ) ) {
666  $hiddenLogs[] = $logType;
667  }
668  }
669  if ( count( $hiddenLogs ) == 1 ) {
670  return 'log_type != ' . $db->addQuotes( $hiddenLogs[0] );
671  } elseif ( $hiddenLogs ) {
672  return 'log_type NOT IN (' . $db->makeList( $hiddenLogs ) . ')';
673  }
674 
675  return false;
676  }
677 }
Xml\checkLabel
static checkLabel( $label, $name, $id, $checked=false, $attribs=array())
Convenience function to build an HTML checkbox with a label.
Definition: Xml.php:433
ContextSource\$context
IContextSource $context
Definition: ContextSource.php:33
$wgUser
$wgUser
Definition: Setup.php:572
ContextSource\getContext
getContext()
Get the RequestContext object.
Definition: ContextSource.php:40
DB_MASTER
const DB_MASTER
Definition: Defines.php:56
LogPage\validTypes
static validTypes()
Get the list of valid log types.
Definition: LogPage.php:187
$revert
this hook is for auditing only etc create2 Corresponds to logging log_action database field and which is displayed in the UI & $revert
Definition: hooks.txt:1644
Linker\revDeleteLink
static revDeleteLink( $query=array(), $restricted=false, $delete=true)
Creates a (show/hide) link for deleting revisions/log entries.
Definition: Linker.php:2205
php
skin txt MediaWiki includes four core it has been set as the default in MediaWiki since the replacing Monobook it had been been the default skin since before being replaced by Vector largely rewritten in while keeping its appearance Several legacy skins were removed in the as the burden of supporting them became too heavy to bear Those in etc for skin dependent CSS etc for skin dependent JavaScript These can also be customised on a per user by etc This feature has led to a wide variety of user styles becoming that gallery is a good place to ending in php
Definition: skin.txt:62
$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:1530
ContextSource\msg
msg()
Get a Message object with context set Parameters are the same as wfMessage()
Definition: ContextSource.php:175
Xml\tags
static tags( $element, $attribs=null, $contents)
Same as Xml::element(), but does not escape contents.
Definition: Xml.php:131
wfGetDB
& wfGetDB( $db, $groups=array(), $wiki=false)
Get a Database object.
Definition: GlobalFunctions.php:3714
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
$time
see documentation in includes Linker php for Linker::makeImageLink & $time
Definition: hooks.txt:1358
$right
return false if a UserGetRights hook might remove the named right $right
Definition: hooks.txt:2809
LogPager
Definition: LogPager.php:29
ChangeTags\buildTagFilterSelector
static buildTagFilterSelector( $selected='', $fullForm=false, Title $title=null)
Build a text box to select a change tag.
Definition: ChangeTags.php:250
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:389
$s
$s
Definition: mergeMessageFileList.php:156
SpecialPage\getTitleFor
static getTitleFor( $name, $subpage=false, $fragment='')
Get a localised Title object for a specified special page name.
Definition: SpecialPage.php:74
Html\hidden
static hidden( $name, $value, $attribs=array())
Convenience function to produce an input element with type=hidden.
Definition: Html.php:665
LogEventsList\getTitleInput
getTitleInput( $title)
Definition: LogEventsList.php:265
ContextSource\getRequest
getRequest()
Get the WebRequest object.
Definition: ContextSource.php:77
ContextSource\getUser
getUser()
Get the User object.
Definition: ContextSource.php:132
$link
set to $title object and return false for a match for latest after cache objects are set use the ContentHandler facility to handle CSS and JavaScript for highlighting & $link
Definition: hooks.txt:2160
ContextSource\getTitle
getTitle()
Get the Title object.
Definition: ContextSource.php:87
$messages
$messages
Definition: LogTests.i18n.php:8
Xml\openElement
static openElement( $element, $attribs=null)
This opens an XML element.
Definition: Xml.php:109
Linker\linkKnown
static linkKnown( $target, $html=null, $customAttribs=array(), $query=array(), $options=array( 'known', 'noclasses'))
Identical to link(), except $options defaults to 'known'.
Definition: Linker.php:264
XmlSelect
Definition: Xml.php:844
ContextSource\getLanguage
getLanguage()
Get the Language object.
Definition: ContextSource.php:154
$out
$out
Definition: UtfNormalGenerate.php:167
DatabaseLogEntry\newFromRow
static newFromRow( $row)
Constructs new LogEntry from database result row.
Definition: LogEntry.php:163
LogEventsList\getTypeMenu
getTypeMenu( $queryTypes)
Definition: LogEventsList.php:205
wfDeprecated
wfDeprecated( $function, $version=false, $component=false, $callerOffset=2)
Throws a warning that $function is deprecated.
Definition: GlobalFunctions.php:1174
LogEventsList\getUserInput
getUserInput( $user)
Definition: LogEventsList.php:249
LogEventsList\getTypeSelector
getTypeSelector()
Returns log page selector.
Definition: LogEventsList.php:218
ContextSource\getOutput
getOutput()
Get the OutputPage object.
Definition: ContextSource.php:122
LogPage\isLogType
static isLogType( $type)
Is $type a valid log type.
Definition: LogPage.php:199
ContextSource
The simplest way of implementing IContextSource is to hold a RequestContext as a member variable and ...
Definition: ContextSource.php:30
LogEventsList\typeAction
static typeAction( $row, $type, $action, $right='')
Definition: LogEventsList.php:419
LogPage
Class to simplify the use of log pages.
Definition: LogPage.php:32
wfRunHooks
wfRunHooks( $event, array $args=array(), $deprecatedVersion=null)
Call hook functions defined in $wgHooks.
Definition: GlobalFunctions.php:4066
LogEventsList\logLine
logLine( $row)
Definition: LogEventsList.php:323
Linker\revDeleteLinkDisabled
static revDeleteLinkDisabled( $delete=true)
Creates a dead (show/hide) link for deleting revisions/log entries.
Definition: Linker.php:2222
array
the array() calling protocol came about after MediaWiki 1.4rc1.
List of Api Query prop modules.
Xml\inputLabel
static inputLabel( $label, $name, $id, $size=false, $value=false, $attribs=array())
Convenience function to build an HTML text input field with a label.
Definition: Xml.php:398
LogEventsList\getFilterLinks
getFilterLinks( $filter)
Definition: LogEventsList.php:155
LogEventsList\getDisplayTitle
getDisplayTitle()
Deprecated alias for getTitle(); do not use.
Definition: LogEventsList.php:65
global
when a variable name is used in a it is silently declared as a new masking the global
Definition: design.txt:93
$comment
$comment
Definition: importImages.php:107
ContextSource\setContext
setContext(IContextSource $context)
Set the IContextSource object.
Definition: ContextSource.php:57
LogEventsList
Definition: LogEventsList.php:26
OutputPage
This class should be covered by a general architecture document which does not exist as of January 20...
Definition: OutputPage.php:38
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
wfDebug
wfDebug( $text, $dest='all')
Sends a line to the debug log if enabled or, optionally, to a comment in output.
Definition: GlobalFunctions.php:980
$title
presenting them properly to the user as errors is done by the caller $title
Definition: hooks.txt:1324
$name
Allows to change the fields on the form that will be generated $name
Definition: hooks.txt:336
$selector
$selector
Definition: styleTest.css.php:43
Xml\check
static check( $name, $checked=false, $attribs=array())
Convenience function to build an HTML checkbox.
Definition: Xml.php:339
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
LogEventsList\getExcludeClause
static getExcludeClause( $db, $audience='public', User $user=null)
SQL clause to skip forbidden log types for this user.
Definition: LogEventsList.php:651
LogEventsList\__construct
__construct( $context, $unused=null, $flags=0)
Constructor.
Definition: LogEventsList.php:48
LogEventsList\USE_REVDEL_CHECKBOXES
const USE_REVDEL_CHECKBOXES
Definition: LogEventsList.php:29
LogEventsList\getShowHideLinks
getShowHideLinks( $row)
Definition: LogEventsList.php:363
LogEventsList\$mDefaultQuery
Array $mDefaultQuery
Definition: LogEventsList.php:35
RequestContext\getMain
static getMain()
Static methods.
Definition: RequestContext.php:420
$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:237
IContextSource
Interface for objects which can provide a context on request.
Definition: IContextSource.php:29
WebRequest
The WebRequest class encapsulates getting at data passed in the URL or via a POSTed form,...
Definition: WebRequest.php:38
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() and Revisions::getRawText() 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:107
$args
if( $line===false) $args
Definition: cdb.php:62
Title
Represents a title within MediaWiki.
Definition: Title.php:35
LogEventsList\showOptions
showOptions( $types=array(), $user='', $page='', $pattern='', $year=0, $month=0, $filter=null, $tagFilter='')
Show options for the log list.
Definition: LogEventsList.php:101
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:456
LogEventsList\$flags
$flags
Definition: LogEventsList.php:31
$dir
if(count( $args)==0) $dir
Definition: importImages.php:49
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:188
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:443
LogEventsList\isDeleted
static isDeleted( $row, $field)
Definition: LogEventsList.php:480
Xml\submitButton
static submitButton( $value, $attribs=array())
Convenience function to build an HTML submit button.
Definition: Xml.php:463
LogPage\DELETED_RESTRICTED
const DELETED_RESTRICTED
Definition: LogPage.php:36
LogEventsList\NO_ACTION_LINK
const NO_ACTION_LINK
Definition: LogEventsList.php:27
LogEventsList\getDefaultQuery
getDefaultQuery()
Definition: LogEventsList.php:186
LogEventsList\endLogEventsList
endLogEventsList()
Definition: LogEventsList.php:315
LogEventsList\showHeader
showHeader( $type)
Set page title and show header for this log type.
Definition: LogEventsList.php:75
LogEventsList\getExtraInputs
getExtraInputs( $types)
Definition: LogEventsList.php:291
LogEventsList\NO_EXTRA_USER_LINKS
const NO_EXTRA_USER_LINKS
Definition: LogEventsList.php:28
Html\rawElement
static rawElement( $element, $attribs=array(), $contents='')
Returns an HTML element in a string.
Definition: Html.php:124
LogEventsList\beginLogEventsList
beginLogEventsList()
Definition: LogEventsList.php:308
$query
return true to allow those checks to and false if checking is done use this to change the tables headers temp or archived zone change it to an object instance and return false override the list derivative used the name of the old file when set the default code will be skipped add a value to it if you want to add a cookie that have to vary cache options can modify $query
Definition: hooks.txt:1105
User
The User object encapsulates all of the user-specific settings (user_id, name, rights,...
Definition: User.php:59
message
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 externallinks including delete and has completed for all link tables 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:1624
LogEventsList\getTitlePattern
getTitlePattern( $pattern)
Definition: LogEventsList.php:281
Xml\fieldset
static fieldset( $legend=false, $content=false, $attribs=array())
Shortcut for creating fieldsets.
Definition: Xml.php:563
IP\isIPAddress
static isIPAddress( $ip)
Determine if a string is as valid IP address or network (CIDR prefix).
Definition: IP.php:74
IContextSource\getLanguage
getLanguage()
Get the Language object.
ChangeTags\formatSummaryRow
static formatSummaryRow( $tags, $page)
Creates HTML for the given tags.
Definition: ChangeTags.php:34
LogEventsList\showLogExtract
static showLogExtract(&$out, $types=array(), $page='', $user='', $param=array())
Show log extract.
Definition: LogEventsList.php:507
LogFormatter\newFromEntry
static newFromEntry(LogEntry $entry)
Constructs a new formatter suitable for given entry.
Definition: LogFormatter.php:45
$type
$type
Definition: testCompression.php:46