Go to the documentation of this file.
26 parent::__construct(
'Listfiles' );
38 $userName = $this->
getRequest()->getText(
'user', $par );
39 $search = $this->
getRequest()->getText(
'ilsearch',
'' );
40 $showAll = $this->
getRequest()->getBool(
'ilshowall',
false );
52 $html = $pager->getBody();
54 $form = $pager->getForm();
55 $body = $pager->getBody();
56 $nav = $pager->getNavigationBar();
57 $html =
"$form<br />\n$body<br />\n$nav";
81 $including =
false, $showAll =
false
85 $this->mIncluding = $including;
86 $this->mShowAll = $showAll;
90 if ( !is_null( $nt ) ) {
91 $this->mUserName = $nt->getText();
95 if ( $search !==
'' && !$wgMiserMode ) {
96 $this->mSearch = $search;
101 $this->mQueryConds[] =
'LOWER(img_name)' .
103 strtolower( $nt->getDBkey() ),
$dbr->anyString() );
109 $this->mDefaultDirection =
true;
111 $this->mDefaultDirection =
false;
114 $this->mDefaultDirection =
true;
128 $prefix = $table ===
'image' ?
'img' :
'oi';
131 if ( !is_null( $this->mUserName ) ) {
135 if ( $this->mSearch !==
'' ) {
139 $conds[] =
'LOWER(' . $prefix .
'_name)' .
141 strtolower( $nt->getDBkey() ),
$dbr->anyString() );
145 if ( $table ===
'oldimage' ) {
149 $conds[
'oi_deleted'] = 0;
160 if ( !$this->mFieldNames ) {
162 $this->mFieldNames =
array(
163 'img_timestamp' => $this->
msg(
'listfiles_date' )->
text(),
164 'img_name' => $this->
msg(
'listfiles_name' )->
text(),
165 'thumb' => $this->
msg(
'listfiles_thumb' )->
text(),
166 'img_size' => $this->
msg(
'listfiles_size' )->
text(),
167 'img_user_text' => $this->
msg(
'listfiles_user' )->
text(),
168 'img_description' => $this->
msg(
'listfiles_description' )->
text(),
170 if ( !$wgMiserMode && !$this->mShowAll ) {
171 $this->mFieldNames[
'count'] = $this->
msg(
'listfiles_count' )->text();
173 if ( $this->mShowAll ) {
174 $this->mFieldNames[
'top'] = $this->
msg(
'listfiles-latestversion' )->text();
183 if ( $this->mIncluding ) {
186 $sortable =
array(
'img_timestamp',
'img_name',
'img_size' );
194 if ( $wgMiserMode && !is_null( $this->mUserName ) ) {
196 if ( $field ===
'img_timestamp' ) {
201 } elseif ( $wgMiserMode && $this->mShowAll ) {
203 if ( $field ===
'img_name' ) {
210 return in_array( $field, $sortable );
233 $prefix = $table ===
'oldimage' ?
'oi' :
'img';
238 if ( $table ===
'oldimage' ) {
239 foreach ( $fields
as $id => &$field ) {
240 if ( substr( $field, 0, 4 ) !==
'img_' ) {
243 $field = $prefix . substr( $field, 3 ) .
' AS ' . $field;
245 $fields[array_search(
'top', $fields )] =
"'no' AS top";
247 if ( $this->mShowAll ) {
248 $fields[array_search(
'top', $fields )] =
"'yes' AS top";
251 $fields[] = $prefix .
'_user AS img_user';
252 $fields[array_search(
'thumb', $fields )] = $prefix .
'_name AS thumb';
256 # Depends on $wgMiserMode
257 # Will also not happen if mShowAll is true.
258 if ( isset( $this->mFieldNames[
'count'] ) ) {
261 # Need to rewrite this one
262 foreach ( $fields
as &$field ) {
263 if ( $field ==
'count' ) {
264 $field =
'COUNT(oi_archive_name) AS count';
270 if (
$dbr->implicitGroupby() ) {
273 $columnlist = preg_grep(
'/^img/', array_keys( $this->
getFieldNames() ) );
276 $join_conds =
array(
'oldimage' =>
array(
'LEFT JOIN',
'oi_name = img_name' ) );
284 'join_conds' => $join_conds
297 $this->mTableName =
'image';
300 $this->mTableName = $prevTableName;
302 if ( !$this->mShowAll ) {
306 $this->mTableName =
'oldimage';
310 if ( substr( $this->mIndexField, 0, 4 ) !==
'img_' ) {
311 throw new MWException(
"Expected to be sorting on an image table field" );
313 $this->mIndexField =
'oi_' . substr( $this->mIndexField, 4 );
318 $this->mTableName = $prevTableName;
319 $this->mIndexField = $oldIndex;
338 $topRes1 = $res1->next();
339 $topRes2 = $res2->next();
340 $resultArray =
array();
341 for ( $i = 0; $i <
$limit && $topRes1 && $topRes2; $i++ ) {
342 if ( strcmp( $topRes1->{$this->mIndexField}, $topRes2->{$this->mIndexField} ) > 0 ) {
344 $resultArray[] = $topRes1;
345 $topRes1 = $res1->next();
347 $resultArray[] = $topRes2;
348 $topRes2 = $res2->next();
352 $resultArray[] = $topRes2;
353 $topRes2 = $res2->next();
355 $resultArray[] = $topRes1;
356 $topRes1 = $res1->next();
360 for ( ; $i <
$limit && $topRes1; $i++ ) {
361 $resultArray[] = $topRes1;
362 $topRes1 = $res1->next();
364 for ( ; $i <
$limit && $topRes2; $i++ ) {
365 $resultArray[] = $topRes2;
366 $topRes2 = $res2->next();
374 if ( $this->mShowAll && $wgMiserMode && is_null( $this->mUserName ) ) {
378 return 'img_timestamp';
384 $this->mResult->seek( 0 );
385 foreach ( $this->mResult
as $row ) {
386 $userIds[] = $row->img_user;
388 # Do a link batch query for names and userpages
409 $opt =
array(
'time' => $this->mCurrentRow->img_timestamp );
413 $thumb =
$file->transform(
array(
'width' => 180,
'height' => 360 ) );
415 return $thumb->toHtml(
array(
'desc-link' =>
true ) );
417 return htmlspecialchars(
$value );
419 case 'img_timestamp':
421 return htmlspecialchars( $this->getLanguage()->userTimeAndDate(
$value, $this->getUser() ) );
423 static $imgfile =
null;
424 if ( $imgfile ===
null ) {
425 $imgfile = $this->msg(
'imgfile' )->text();
433 htmlspecialchars( $filePage->getText() )
439 $download = $this->msg(
'parentheses' )->rawParams( $download )->escaped();
441 return "$link $download";
443 return htmlspecialchars(
$value );
445 case 'img_user_text':
446 if ( $this->mCurrentRow->img_user ) {
450 htmlspecialchars(
$name )
458 return htmlspecialchars( $this->getLanguage()->formatSize(
$value ) );
459 case 'img_description':
462 return intval(
$value ) + 1;
465 return $this->msg(
'listfiles-latestversion-' .
$value );
472 global $wgScript, $wgMiserMode;
473 $inputForm =
array();
474 $inputForm[
'table_pager_limit_label'] = $this->getLimitSelect(
array(
'tabindex' => 1 ) );
475 if ( !$wgMiserMode ) {
482 'maxlength' =>
'255',
483 'id' =>
'mw-ilsearch',
488 $inputForm[
'username'] =
Html::input(
'user', $this->mUserName,
'text',
array(
490 'maxlength' =>
'255',
491 'id' =>
'mw-listfiles-user',
495 $inputForm[
'listfiles-show-all'] =
Html::input(
'ilshowall', 1,
'checkbox',
array(
496 'checked' => $this->mShowAll,
501 array(
'method' =>
'get',
'action' => $wgScript,
'id' =>
'mw-listfiles-form' )
504 Html::hidden(
'title', $this->getTitle()->getPrefixedText() ) .
506 $this->getHiddenFields(
array(
'limit',
'ilsearch',
'user',
'title',
'ilshowall' ) ) .
512 return 'listfiles ' . parent::getTableClass();
516 return 'listfiles_nav ' . parent::getNavClass();
520 return 'listfiles_sort ' . parent::getSortHeaderClass();
524 $queries = parent::getPagingQueries();
525 if ( !is_null( $this->mUserName ) ) {
526 # Append the username to the query string
528 $query[
'user'] = $this->mUserName;
536 $queries = parent::getDefaultQuery();
537 if ( !isset(
$queries[
'user'] ) && !is_null( $this->mUserName ) ) {
538 $queries[
'user'] = $this->mUserName;
Overloads the relevant methods of the real ResultsWrapper so it doesn't go anywhere near an actual da...
static & makeTitle( $ns, $title, $fragment='', $interwiki='')
Create a new Title from a namespace index and a DB key.
static newFromText( $text, $defaultNamespace=NS_MAIN)
Create a new Title from text, such as what one would find in a link.
execute( $par)
Default execute method Checks user permissions, calls the function given in mFunction.
static singleton()
Get a RepoGroup instance.
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
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
msg()
Get a Message object with context set Parameters are the same as wfMessage()
namespace and then decline to actually register it RecentChangesLinked and Watchlist RecentChangesLinked and Watchlist e g Watchlist & $tables
getOutput()
Get the OutputPage being used for this instance.
& wfGetDB( $db, $groups=array(), $wiki=false)
Get a Database object.
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
usually copyright or history_copyright This message must be in HTML not wikitext $subpages will be ignored and the rest of subPageSubtitle() will run. 'SkinTemplateBuildNavUrlsNav_urlsAfterPermalink' whether MediaWiki currently thinks this is a CSS JS page Hooks may change this value to override the return value of Title::isCssOrJsPage(). 'TitleIsAlwaysKnown' whether MediaWiki currently thinks this page is known isMovable() always returns false. $title whether MediaWiki currently thinks this page is movable Hooks may change this value to override the return value of Title::isMovable(). 'TitleIsWikitextPage' whether MediaWiki currently thinks this is a wikitext page Hooks may change this value to override the return value of Title::isWikitextPage() 'TitleMove' use UploadVerification and UploadVerifyFile instead $form
if(!defined( 'MEDIAWIKI')) $fname
This file is not a valid entry point, perform no further processing unless MEDIAWIKI is defined.
static getTitleFor( $name, $subpage=false, $fragment='')
Get a localised Title object for a specified special page name.
Shortcut to construct an includable special page.
static hidden( $name, $value, $attribs=array())
Convenience function to produce an input element with type=hidden.
static formatComment( $comment, $title=null, $local=false)
This function is called by all recent changes variants, by the page history, and by the user contribu...
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
static linkKnown( $target, $html=null, $customAttribs=array(), $query=array(), $options=array( 'known', 'noclasses'))
Identical to link(), except $options defaults to 'known'.
static link( $target, $html=null, $customAttribs=array(), $query=array(), $options=array())
This function returns an HTML link to the given target.
static closeElement( $element)
Returns "</$element>", except if $wgWellFormedXml is off, in which case it returns the empty string w...
static openElement( $element, $attribs=array())
Identical to rawElement(), but has no third parameter and omits the end tag (and the self-closing '/'...
static element( $element, $attribs=null, $contents='', $allowShortTag=true)
Format an XML element with given attributes and, optionally, text content.
the array() calling protocol came about after MediaWiki 1.4rc1.
List of Api Query prop modules.
setHeaders()
Sets headers - this should be called from the execute() method of all derived classes!
when a variable name is used in a it is silently declared as a new masking the global
static input( $name, $value='', $type='text', $attribs=array())
Convenience function to produce an "<input>" element.
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
getContext()
Gets the context this SpecialPage is executed in.
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
static makeTitleSafe( $ns, $title, $fragment='', $interwiki='')
Create a new Title from a namespace index and a DB key.
Allows to change the fields on the form that will be generated $name
static whoIs( $id)
Get the username corresponding to a given user ID.
static buildForm( $fields, $submitLabel=null, $submitAttribs=array())
Generate a form (without the opening form element).
getRequest()
Get the WebRequest being used for this instance.
static newFromURL( $url)
THIS IS NOT THE FUNCTION YOU WANT.
Interface for objects which can provide a context on request.
if(PHP_SAPI !='cli') $file
getGroupName()
Under which header this special page is listed in Special:SpecialPages See messages 'specialpages-gro...
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
getRequest()
Get the WebRequest object.
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
wfLocalFile( $title)
Get an object referring to a locally registered file.
outputHeader( $summaryMessageKey='')
Outputs a summary message on top of special pages Per default the message key is the canonical name o...
including( $x=null)
Whether the special page is being evaluated via transclusion.
static fieldset( $legend=false, $content=false, $attribs=array())
Shortcut for creating fieldsets.