54 $including =
false, $showAll =
false
57 $this->mIncluding = $including;
58 $this->mShowAll = $showAll;
60 if ( $userName !==
null && $userName !==
'' ) {
61 $nt = Title::makeTitleSafe(
NS_USER, $userName );
62 if ( is_null( $nt ) ) {
65 $this->mUserName = $nt->getText();
76 if ( $search !==
'' && !$this->
getConfig()->
get(
'MiserMode' ) ) {
77 $this->mSearch = $search;
78 $nt = Title::newFromText( $this->mSearch );
82 $this->mQueryConds[] =
'LOWER(img_name)' .
84 strtolower( $nt->getDBkey() ),
$dbr->anyString() );
89 if ( $this->
getRequest()->getText(
'sort',
'img_date' ) ==
'img_date' ) {
117 "<div class=\"mw-userpage-userdoesnotexist error\">\n$1\n</div>",
119 'listfiles-userdoesnotexist',
133 $prefix = $table ===
'image' ?
'img' :
'oi';
136 if ( !is_null( $this->mUserName ) ) {
139 $actorWhere = ActorMigration::newMigration()->getWhere(
146 $conds[] = $actorWhere[
'conds'];
149 if ( $this->mSearch !==
'' ) {
150 $nt = Title::newFromText( $this->mSearch );
153 $conds[] =
'LOWER(' . $prefix .
'_name)' .
155 strtolower( $nt->getDBkey() ),
$dbr->anyString() );
159 if ( $table ===
'oldimage' ) {
163 $conds[
'oi_deleted'] = 0;
177 if ( !$this->mFieldNames ) {
178 $this->mFieldNames = [
179 'img_timestamp' => $this->
msg(
'listfiles_date' )->text(),
180 'img_name' => $this->
msg(
'listfiles_name' )->text(),
181 'thumb' => $this->
msg(
'listfiles_thumb' )->text(),
182 'img_size' => $this->
msg(
'listfiles_size' )->text(),
184 if ( is_null( $this->mUserName ) ) {
186 $this->mFieldNames[
'img_user_text'] = $this->
msg(
'listfiles_user' )->text();
189 $this->mFieldNames[
'img_description'] = $this->
msg(
'listfiles_description' )->text();
191 if ( !$this->
getConfig()->
get(
'MiserMode' ) && !$this->mShowAll ) {
192 $this->mFieldNames[
'count'] = $this->
msg(
'listfiles_count' )->text();
194 if ( $this->mShowAll ) {
195 $this->mFieldNames[
'top'] = $this->
msg(
'listfiles-latestversion' )->text();
203 if ( $this->mIncluding ) {
206 $sortable = [
'img_timestamp',
'img_name',
'img_size' ];
215 if ( $this->
getConfig()->
get(
'MiserMode' ) && !is_null( $this->mUserName ) ) {
217 if ( $field ===
'img_timestamp' ) {
222 } elseif ( $this->
getConfig()->
get(
'MiserMode' )
226 if ( $field ===
'img_name' ) {
233 return in_array( $field, $sortable );
257 $prefix = $table ===
'oldimage' ?
'oi' :
'img';
261 $fields = array_combine( $fields, $fields );
262 unset( $fields[
'img_description'] );
263 unset( $fields[
'img_user_text'] );
265 if ( $table ===
'oldimage' ) {
266 foreach ( $fields
as $id => $field ) {
267 if ( substr( $id, 0, 4 ) ===
'img_' ) {
268 $fields[$id] = $prefix . substr( $field, 3 );
271 $fields[
'top'] =
$dbr->addQuotes(
'no' );
272 } elseif ( $this->mShowAll ) {
273 $fields[
'top'] =
$dbr->addQuotes(
'yes' );
275 $fields[
'thumb'] = $prefix .
'_name';
280 $commentQuery = CommentStore::getStore()->getJoin( $prefix .
'_description' );
281 $tables += $commentQuery[
'tables'];
282 $fields += $commentQuery[
'fields'];
283 $join_conds += $commentQuery[
'joins'];
284 $fields[
'description_field'] =
$dbr->addQuotes(
"{$prefix}_description" );
287 $actorQuery = ActorMigration::newMigration()->getJoin( $prefix .
'_user' );
288 $tables += $actorQuery[
'tables'];
289 $join_conds += $actorQuery[
'joins'];
290 $fields[
'img_user'] = $actorQuery[
'fields'][$prefix .
'_user'];
291 $fields[
'img_user_text'] = $actorQuery[
'fields'][$prefix .
'_user_text'];
292 $fields[
'img_actor'] = $actorQuery[
'fields'][$prefix .
'_actor'];
294 # Depends on $wgMiserMode
295 # Will also not happen if mShowAll is true.
296 if ( isset( $fields[
'count'] ) ) {
297 $fields[
'count'] =
$dbr->buildSelectSubquery(
299 'COUNT(oi_archive_name)',
300 'oi_name = img_name',
310 'join_conds' => $join_conds
328 $this->mTableName =
'image';
332 $this->mTableName = $prevTableName;
334 if ( !$this->mShowAll ) {
338 $this->mTableName =
'oldimage';
342 if ( substr( $this->mIndexField, 0, 4 ) !==
'img_' ) {
343 throw new MWException(
"Expected to be sorting on an image table field" );
345 $this->mIndexField =
'oi_' . substr( $this->mIndexField, 4 );
351 $this->mTableName = $prevTableName;
352 $this->mIndexField = $oldIndex;
354 return $this->
combineResult( $imageRes, $oldimageRes, $limit, $order );
371 $topRes1 = $res1->next();
372 $topRes2 = $res2->next();
374 for ( $i = 0; $i < $limit && $topRes1 && $topRes2; $i++ ) {
375 if ( strcmp( $topRes1->{$this->mIndexField}, $topRes2->{$this->mIndexField} ) > 0 ) {
377 $resultArray[] = $topRes1;
378 $topRes1 = $res1->next();
380 $resultArray[] = $topRes2;
381 $topRes2 = $res2->next();
383 } elseif ( !$ascending ) {
384 $resultArray[] = $topRes2;
385 $topRes2 = $res2->next();
387 $resultArray[] = $topRes1;
388 $topRes1 = $res1->next();
392 for ( ; $i < $limit && $topRes1; $i++ ) {
393 $resultArray[] = $topRes1;
394 $topRes1 = $res1->next();
397 for ( ; $i < $limit && $topRes2; $i++ ) {
398 $resultArray[] = $topRes2;
399 $topRes2 = $res2->next();
406 if ( $this->mShowAll && $this->getConfig()->
get(
'MiserMode' ) && is_null( $this->mUserName ) ) {
410 return 'img_timestamp';
416 $this->mResult->seek( 0 );
417 foreach ( $this->mResult
as $row ) {
418 $userIds[] = $row->img_user;
420 # Do a link batch query for names and userpages
439 $linkRenderer = MediaWikiServices::getInstance()->getLinkRenderer();
442 $opt = [
'time' =>
wfTimestamp( TS_MW, $this->mCurrentRow->img_timestamp ) ];
446 $thumb =
$file->transform( [
'width' => 180,
'height' => 360 ] );
448 return $thumb->toHtml( [
'desc-link' =>
true ] );
450 return $this->msg(
'thumbnail_error',
'' )->escaped();
453 return htmlspecialchars(
$value );
455 case 'img_timestamp':
457 return htmlspecialchars( $this->getLanguage()->userTimeAndDate(
$value, $this->getUser() ) );
459 static $imgfile =
null;
460 if ( $imgfile ===
null ) {
461 $imgfile = $this->msg(
'imgfile' )->text();
471 $download = Xml::element(
'a',
475 $download = $this->msg(
'parentheses' )->rawParams( $download )->escaped();
479 if ( $filePage->userCan(
'delete', $this->getUser() ) ) {
480 $deleteMsg = $this->msg(
'listfiles-delete' )->text();
483 $filePage, $deleteMsg, [], [
'action' =>
'delete' ]
485 $delete = $this->msg(
'parentheses' )->rawParams( $delete )->escaped();
487 return "$link $download $delete";
490 return "$link $download";
492 return htmlspecialchars(
$value );
494 case 'img_user_text':
495 if ( $this->mCurrentRow->img_user ) {
507 return htmlspecialchars( $this->getLanguage()->formatSize(
$value ) );
508 case 'img_description':
509 $field = $this->mCurrentRow->description_field;
510 $value = CommentStore::getStore()->getComment( $field, $this->mCurrentRow )->text;
513 return $this->getLanguage()->formatNum( intval(
$value ) + 1 );
516 return $this->msg(
'listfiles-latestversion-' .
$value );
527 'label-message' =>
'table_pager_limit_label',
528 'options' => $this->getLimitSelectList(),
529 'default' => $this->mLimit,
532 if ( !$this->getConfig()->
get(
'MiserMode' ) ) {
535 'name' =>
'ilsearch',
536 'id' =>
'mw-ilsearch',
537 'label-message' =>
'listfiles_search_for',
538 'default' => $this->mSearch,
540 'maxlength' =>
'255',
547 'id' =>
'mw-listfiles-user',
548 'label-message' =>
'username',
549 'default' => $this->mUserName,
551 'maxlength' =>
'255',
556 'name' =>
'ilshowall',
557 'id' =>
'mw-listfiles-show-all',
558 'label-message' =>
'listfiles-show-all',
559 'default' => $this->mShowAll,
562 $query = $this->getRequest()->getQueryValues();
565 unset(
$query[
'ilsearch'] );
566 unset(
$query[
'ilshowall'] );
572 ->setId(
'mw-listfiles-form' )
573 ->setTitle( $this->getTitle() )
574 ->setSubmitTextMsg(
'table_pager_limit_submit' )
575 ->setWrapperLegendMsg(
'listfiles' )
576 ->addHiddenFields(
$query )
582 return parent::getTableClass() .
' listfiles';
586 return parent::getNavClass() .
' listfiles_nav';
590 return parent::getSortHeaderClass() .
' listfiles_sort';
594 $queries = parent::getPagingQueries();
595 if ( !is_null( $this->mUserName ) ) {
596 # Append the username to the query string
599 $query[
'user'] = $this->mUserName;
608 $queries = parent::getDefaultQuery();
609 if ( !isset(
$queries[
'user'] ) && !is_null( $this->mUserName ) ) {
610 $queries[
'user'] = $this->mUserName;
617 return SpecialPage::getTitleFor(
'Listfiles' );
Apache License January AND DISTRIBUTION Definitions License shall mean the terms and conditions for use
wfGetDB( $db, $groups=[], $wiki=false)
Get a Database object.
wfLocalFile( $title)
Get an object referring to a locally registered file.
wfTimestamp( $outputtype=TS_UNIX, $ts=0)
Get a timestamp string in one of various formats.
wfEscapeWikiText( $text)
Escapes the given text so that it may be output using addWikiText() without any linking,...
if(defined( 'MW_SETUP_CALLBACK')) $fname
Customization point after all loading (constants, functions, classes, DefaultSettings,...
msg( $key)
Get a Message object with context set Parameters are the same as wfMessage()
setContext(IContextSource $context)
static formatComment( $comment, $title=null, $local=false, $wikiId=null)
This function is called by all recent changes variants, by the page history, and by the user contribu...
static singleton()
Get a RepoGroup instance.
The User object encapsulates all of the user-specific settings (user_id, name, rights,...
static newFromName( $name, $validate='valid')
Static factory method for creation from username.
static whoIs( $id)
Get the username corresponding to a given user ID.
static isIP( $name)
Does the string match an anonymous IP address?
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
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 use $formDescriptor instead & $formDescriptor
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 & $options
this hook is for auditing only RecentChangesLinked and Watchlist Do not use this to implement individual filters if they are compatible with the ChangesListFilter and ChangesListFilterGroup structure use sub classes of those in conjunction with the ChangesListSpecialPageStructuredFilters hook This hook can be used to implement filters that do not implement that or custom behavior that is not an individual filter e g Watchlist & $tables
usually copyright or history_copyright This message must be in HTML not wikitext & $link
Allows to change the fields on the form that will be generated $name
null for the local 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
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
return true to allow those checks to and false if checking is done & $user
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
Interface for objects which can provide a MediaWiki context on request.
if(PHP_SAPI !='cli-server') if(!isset( $_SERVER['SCRIPT_FILENAME'])) $file