if ( $this->including() ) {
$userName = $par;
$search = '';
+ $showAll = false;
} else {
$userName = $this->getRequest()->getText( 'user', $par );
$search = $this->getRequest()->getText( 'ilsearch', '' );
* Build the where clause of the query.
*
* Replaces the older mQueryConds member variable.
- * @param $table String Either "image" or "oldimage"
+ * @param string $table Either "image" or "oldimage"
* @return array The query conditions.
*/
protected function buildQueryConds( $table ) {
$conds = array();
if ( !is_null( $this->mUserName ) ) {
- $conds[ $prefix . '_user_text' ] = $this->mUserName;
+ $conds[$prefix . '_user_text'] = $this->mUserName;
}
if ( $this->mSearch !== '' ) {
}
/**
- * @return Array
+ * @return array
*/
function getFieldNames() {
if ( !$this->mFieldNames ) {
// for two different tables, without reimplementing
// the pager class.
$qi = $this->getQueryInfoReal( $this->mTableName );
+
return $qi;
}
*
* This is a bit hacky.
*
- * @param $table String Either 'image' or 'oldimage'
+ * @param string $table Either 'image' or 'oldimage'
* @return array Query info
*/
protected function getQueryInfoReal( $table ) {
* @note $asc is named $descending in IndexPager base class. However
* it is true when the order is ascending, and false when the order
* is descending, so I renamed it to $asc here.
+ * @param int $offset
+ * @param int $limit
+ * @param bool $asc
*/
function reallyDoQuery( $offset, $limit, $asc ) {
$prevTableName = $this->mTableName;
*
* Note: This will throw away some results
*
- * @param $res1 ResultWrapper
- * @param $res2 ResultWrapper
- * @param $limit int
- * @param $ascending boolean See note about $asc in $this->reallyDoQuery
+ * @param ResultWrapper $res1
+ * @param ResultWrapper $res2
+ * @param int $limit
+ * @param bool $ascending See note about $asc in $this->reallyDoQuery
* @return FakeResultWrapper $res1 and $res2 combined
*/
protected function combineResult( $res1, $res2, $limit, $ascending ) {
$topRes2 = $res2->next();
$resultArray = array();
for ( $i = 0; $i < $limit && $topRes1 && $topRes2; $i++ ) {
- if ( strcmp( $topRes1->{ $this->mIndexField }, $topRes2->{ $this->mIndexField } ) > 0 ) {
+ if ( strcmp( $topRes1->{$this->mIndexField}, $topRes2->{$this->mIndexField} ) > 0 ) {
if ( !$ascending ) {
$resultArray[] = $topRes1;
$topRes1 = $res1->next();
$resultArray[] = $topRes2;
$topRes2 = $res2->next();
}
+
return new FakeResultWrapper( $resultArray );
}
UserCache::singleton()->doQuery( $userIds, array( 'userpage' ), __METHOD__ );
}
+ /**
+ * @param string $field
+ * @param string $value
+ * @return Message|string|int The return type depends on the value of $field:
+ * - thumb: string
+ * - img_timestamp: string
+ * - img_name: string
+ * - img_user_text: string
+ * - img_size: string
+ * - img_description: string
+ * - count: int
+ * - top: Message
+ * @throws MWException
+ */
function formatValue( $field, $value ) {
switch ( $field ) {
case 'thumb':
// If statement for paranoia
if ( $file ) {
$thumb = $file->transform( array( 'width' => 180, 'height' => 360 ) );
+
return $thumb->toHtml( array( 'desc-link' => true ) );
} else {
return htmlspecialchars( $value );
case 'top':
// Messages: listfiles-latestversion-yes, listfiles-latestversion-no
return $this->msg( 'listfiles-latestversion-' . $value );
+ default:
+ throw new MWException( "Unknown field '$field'" );
}
}
'checked' => $this->mShowAll,
'tabindex' => 4,
) );
+
return Html::openElement( 'form',
array( 'method' => 'get', 'action' => $wgScript, 'id' => 'mw-listfiles-form' )
) .