self::doQueryCacheUpdate( $dbw, $window );
}
}
+
return ( time() -
( $cTime ? wfTimestamp( TS_UNIX, $cTime ) : $wgActiveUserDays * 86400 ) );
}
$newRows = array();
foreach ( $names as $name => $lastEditTime ) {
$newRows[] = array(
- 'qcc_type' => 'activeusers',
+ 'qcc_type' => 'activeusers',
'qcc_namespace' => NS_USER,
'qcc_title' => $name,
'qcc_value' => wfTimestamp( TS_UNIX, $lastEditTime ),
'grouppath' => 'mediawiki',
'query' => 'language:' . $this->getLanguage()->getCode() . '^25 ' .
'messageid:"MediaWiki:' . $value . '"^10 "' .
- $this->msg ( $value )->inLanguage ( 'en' )->plain() . '"'
+ $this->msg( $value )->inLanguage( 'en' )->plain() . '"'
) ),
$this->msg( 'allmessages-filter-translate' )->text()
);
// since generating it will cause a lot of scanning
if ( $count > $this->maxTopLevelPages ) {
$this->showChunk( $namespace, $from, $to, $hideredirects );
+
return;
}
$form .= ' ' . Xml::submitButton( $this->msg( 'booksources-go' )->text() ) . "</p>\n";
$form .= Html::closeElement( 'form' ) . "\n";
$form .= Html::closeElement( 'fieldset' ) . "\n";
+
return $form;
}
}
$query = $request->getVal( 'returntoquery' );
$this->getOutput()->redirect( $titleObj->getFullURL( $query ) );
+
return true;
}
*
* @ingroup SpecialPage
*/
-
class SpecialContributions extends IncludableSpecialPage {
protected $opts;
if ( !$this->including() ) {
$out->addHTML( $this->getForm() );
}
+
return;
}
*
* @ingroup SpecialPage
*/
-
class SpecialCreateAccount extends SpecialRedirectToSpecial {
function __construct() {
parent::__construct( 'CreateAccount', 'Userlogin', 'signup', array( 'returnto', 'returntoquery', 'uselang' ) );
class DeletedContributionsPage extends SpecialPage {
function __construct() {
parent::__construct( 'DeletedContributions', 'deletedhistory',
- /*listed*/true, /*function*/false, /*file*/false );
+ /*listed*/true, /*function*/false, /*file*/false );
}
/**
}
if ( count( $toWatch ) > 0 ) {
- $this->successMessage .= ' ' . $this->msg( 'watchlistedit-raw-added'
- )->numParams( count( $toWatch ) )->parse();
+ $this->successMessage .= ' ' . $this->msg( 'watchlistedit-raw-added' )
+ ->numParams( count( $toWatch ) )->parse();
$this->showTitles( $toWatch, $this->successMessage );
}
if ( count( $toUnwatch ) > 0 ) {
- $this->successMessage .= ' ' . $this->msg( 'watchlistedit-raw-removed'
- )->numParams( count( $toUnwatch ) )->parse();
+ $this->successMessage .= ' ' . $this->msg( 'watchlistedit-raw-removed' )
+ ->numParams( count( $toUnwatch ) )->parse();
$this->showTitles( $toUnwatch, $this->successMessage );
}
} else {
}
$this->showHtmlPreview( $title, $rawhtml, $out );
-
}
-
}
/**
// implement by redirecting through Special:Redirect/file
function getRedirect( $par ) {
$file = $par ?: $this->getRequest()->getText( 'file' );
+
return SpecialPage::getSafeTitleFor( 'Redirect', 'file/' . $file );
}
$conds = array();
if ( !is_null( $this->mUserName ) ) {
- $conds[ $prefix . '_user_text' ] = $this->mUserName;
+ $conds[$prefix . '_user_text'] = $this->mUserName;
}
if ( $this->mSearch !== '' ) {
// for two different tables, without reimplementing
// the pager class.
$qi = $this->getQueryInfoReal( $this->mTableName );
+
return $qi;
}
$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 );
}
// 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 );
'checked' => $this->mShowAll,
'tabindex' => 4,
) );
+
return Html::openElement( 'form',
array( 'method' => 'get', 'action' => $wgScript, 'id' => 'mw-listfiles-form' )
) .
* @ingroup SpecialPage
* @author Ævar Arnfjörð Bjarmason <avarab@gmail.com>
*/
+
class MostrevisionsPage extends FewestrevisionsPage {
function __construct( $name = 'Mostrevisions' ) {
parent::__construct( $name );
$dbr = wfGetDB( DB_MASTER );
if ( $this->moveSubpages && (
MWNamespace::hasSubpages( $nt->getNamespace() ) || (
- $this->moveTalk &&
- MWNamespace::hasSubpages( $nt->getTalkPage()->getNamespace() )
+ $this->moveTalk
+ && MWNamespace::hasSubpages( $nt->getTalkPage()->getNamespace() )
)
) ) {
$conds = array(
function getRedirect( $subpage ) {
$this->mAddedRedirectParams['ilshowall'] = 1;
+
return SpecialPage::getTitleFor( 'Listfiles', $this->getUser()->getName() );
}
}
* @file
* @ingroup SpecialPage
*/
+
class SpecialNewFiles extends IncludableSpecialPage {
public function __construct() {
parent::__construct( 'Newimages' );
throw new ErrorPageError( 'nopagetitle', 'nopagetext' );
}
$this->mAddedRedirectParams['oldid'] = $subpage;
+
return true;
}
}
$qi['conds'][] = 'cl_timestamp ' . $op . ' ' .
$dbr->addQuotes( $dbr->timestamp( $minClTime ) );
}
+
return $qi;
}
}
$ts = ( $this->maxTimestamp - $this->minTimestamp ) * $rand + $this->minTimestamp;
+
return intval( $ts );
}
if ( !$res ) {
throw new MWException( 'No entries in category' );
}
+
return array( wfTimestamp( TS_UNIX, $res->low ), wfTimestamp( TS_UNIX, $res->high ) );
}
$query = $this->getFeedQuery();
$query['feedformat'] = $feedFormat === 'atom' ? 'atom' : 'rss';
$this->getOutput()->redirect( wfAppendQuery( wfScript( 'api' ), $query ) );
+
return;
}
if ( $query['limit'] > $wgFeedLimit ) {
$query['limit'] = $wgFeedLimit;
}
+
return $query;
}
public function checkLastModified() {
$dbr = $this->getDB();
$lastmod = $dbr->selectField( 'recentchanges', 'MAX(rc_timestamp)', false, __METHOD__ );
+
return $lastmod;
}
$opts = parent::getDefaultOptions();
$opts->add( 'target', '' );
$opts->add( 'showlinkedto', false );
+
return $opts;
}
if ( !$title || $title->isExternal() ) {
$outputPage->addHtml( '<div class="errorbox">' . $this->msg( 'allpagesbadtitle' )
->parse() . '</div>' );
+
return false;
}
'wl_user' => $uid,
'wl_title=rc_title',
'wl_namespace=rc_namespace'
- ));
+ ) );
}
if ( $this->getUser()->isAllowed( 'rollback' ) ) {
$tables[] = 'page';
$this->rclTargetTitle = false;
}
}
+
return $this->rclTargetTitle;
}
}
return null;
}
$userpage = Title::makeTitle( NS_USER, $username );
+
return $userpage->getFullURL( '', false, PROTO_CURRENT );
}
function dispatchFile() {
$title = Title::makeTitleSafe( NS_FILE, $this->mValue );
- if ( ! $title instanceof Title ) {
+ if ( !$title instanceof Title ) {
return null;
}
$file = wfFindFile( $title );
$url = $mto->getURL();
}
}
+
return $url;
}
if ( $oldid === 0 ) {
return null;
}
+
return wfAppendQuery( wfScript( 'index' ), array(
'oldid' => $oldid
) );
if ( $curid === 0 ) {
return null;
}
+
return wfAppendQuery( wfScript( 'index' ), array(
'curid' => $curid
) );
function dispatch() {
// the various namespaces supported by Special:Redirect
switch ( $this->mType ) {
- case 'user':
- $url = $this->dispatchUser();
- break;
- case 'file':
- $url = $this->dispatchFile();
- break;
- case 'revision':
- $url = $this->dispatchRevision();
- break;
- case 'page':
- $url = $this->dispatchPage();
- break;
- default:
- $this->getOutput()->setStatusCode( 404 );
- $url = null;
- break;
+ case 'user':
+ $url = $this->dispatchUser();
+ break;
+ case 'file':
+ $url = $this->dispatchFile();
+ break;
+ case 'revision':
+ $url = $this->dispatchRevision();
+ break;
+ case 'page':
+ $url = $this->dispatchPage();
+ break;
+ default:
+ $this->getOutput()->setStatusCode( 404 );
+ $url = null;
+ break;
}
if ( $url ) {
$this->getOutput()->redirect( $url );
+
return true;
}
if ( !is_null( $this->mValue ) ) {
$this->getOutput()->setStatusCode( 404 );
// Message: redirect-not-exists
$msg = $this->getMessagePrefix() . '-not-exists';
+
return Status::newFatal( $msg );
}
+
return false;
}
if ( !empty( $this->mValue ) ) {
$a['value']['default'] = $this->mValue;
}
+
return $a;
}
if ( !empty( $data['type'] ) && !empty( $data['value'] ) ) {
$this->setParameter( $data['type'] . '/' . $data['value'] );
}
+
/* if this returns false, will show the form */
return $this->dispatch();
}
->rawParams( $this->msg( $tok['label-message'] )->parse() )
->params( $user->getTokenFromOption( $tok['preference'] ) )
->escaped();
- $tokensForForm[ $label ] = $tok['preference'];
+ $tokensForForm[$label] = $tok['preference'];
}
$desc = array(
$this->token = $request->getVal( 'token' );
if ( $this->archiveName && $this->targetObj ) {
$this->tryShowFile( $this->archiveName );
+
return;
}
# We need a target page!
if ( is_null( $this->targetObj ) ) {
$output->addWikiMsg( 'undelete-header' );
+
return;
}
# Give a link to the logs/hist for this page
$conds['log_action'] = $this->getList()->getLogAction();
$conds['ls_field'] = RevisionDeleter::getRelationType( $this->typeName );
$conds['ls_value'] = $this->ids;
+
return $conds;
}
// Check if user is allowed to see this file
if ( !$oimage->exists() ) {
$this->getOutput()->addWikiMsg( 'revdelete-no-file' );
+
return;
}
$user = $this->getUser();
Xml::submitButton( $this->msg( 'revdelete-show-file-submit' )->text() ) .
'</form>'
);
+
return;
}
$this->getOutput()->disable();
$this->typeName, $this->getContext(), $this->targetObj, $this->ids
);
}
+
return $this->list;
}
$line = Xml::tags( 'td', array( 'class' => 'mw-input' ), $innerHTML );
$html .= "<tr>$line</tr>\n";
}
- // Otherwise, use tri-state radios
} else {
+ // Otherwise, use tri-state radios
$html .= '<tr>';
$html .= '<th class="mw-revdel-checkbox">' . $this->msg( 'revdelete-radio-same' )->escaped() . '</th>';
$html .= '<th class="mw-revdel-checkbox">' . $this->msg( 'revdelete-radio-unset' )->escaped() . '</th>';
}
$html .= '</table>';
+
return $html;
}
$token = $this->getRequest()->getVal( 'wpEditToken' );
if ( $this->submitClicked && !$this->getUser()->matchEditToken( $token ) ) {
$this->getOutput()->addWikiMsg( 'sessionfailure' );
+
return false;
}
$bitParams = $this->extractBitParams();
$status = $this->save( $bitParams, $comment, $this->targetObj );
if ( $status->isGood() ) {
$this->success();
+
return true;
- # ...otherwise, bounce back to form...
} else {
+ # ...otherwise, bounce back to form...
$this->failure( $status );
}
+
return false;
}
if ( !isset( $bitfield[Revision::DELETED_RESTRICTED] ) ) {
$bitfield[Revision::DELETED_RESTRICTED] = 0;
}
+
return $bitfield;
}
if ( wfReadOnly() ) {
header( "HTTP/1.0 423 Locked" );
print 'Wiki is in read-only mode';
+
return;
} elseif ( !$this->getRequest()->wasPosted() ) {
header( "HTTP/1.0 400 Bad Request" );
print 'Request must be POSTed';
+
return;
}
if ( count( $missing ) ) {
header( "HTTP/1.0 400 Bad Request" );
print 'Missing parameters: ' . implode( ', ', array_keys( $missing ) );
+
return;
}
if ( !$verified || $params['sigexpiry'] < time() ) {
header( "HTTP/1.0 400 Bad Request" );
print 'Invalid or stale signature provided';
+
return;
}
$job = $group->pop( JobQueueGroup::TYPE_DEFAULT, JobQueueGroup::USE_CACHE );
if ( $job ) {
$output = $job->toString() . "\n";
- $t = - microtime( true );
+ $t = -microtime( true );
wfProfileIn( __METHOD__ . '-' . get_class( $job ) );
$success = $job->run();
wfProfileOut( __METHOD__ . '-' . get_class( $job ) );
# If the string cannot be used to create a title
if ( is_null( $t ) ) {
$this->showResults( $term );
+
return;
}
# If there's an exact or very near match, jump right there.
if ( !is_null( $t ) ) {
$this->getOutput()->redirect( $t->getFullURL() );
+
return;
}
# No match, generate an edit URL
# If the feature is enabled, go straight to the edit page
if ( $wgGoToEdit ) {
$this->getOutput()->redirect( $t->getFullURL( array( 'action' => 'edit' ) ) );
+
return;
}
}
Xml::closeElement( 'fieldset' )
);
}
+
return;
}
// Sometimes the search engine knows there are too many hits
if ( $titleMatches instanceof SearchResultTooMany ) {
$out->wrapWikiMsg( "==$1==\n", 'toomanymatches' );
+
return;
}
$out->addHTML( $this->formHeader( $term, 0, 0 ) );
$out->addHtml( $this->getProfileForm( $this->profile, $term ) );
$out->addHTML( '</form>' );
+
// Empty query -- straight view of search form
return;
}
// show direct page/create link if applicable
// Check DBkey !== '' in case of fragment link only.
- if ( is_null( $t ) || $t->getDBkey() === '' ||
- ( $titleMatches !== null && $titleMatches->searchContainedSyntax() ) ||
- ( $textMatches !== null && $textMatches->searchContainedSyntax() ) ) {
+ if ( is_null( $t ) || $t->getDBkey() === ''
+ || ( $titleMatches !== null && $titleMatches->searchContainedSyntax() )
+ || ( $textMatches !== null && $textMatches->searchContainedSyntax() )
+ ) {
// invalid title
// preserve the paragraph for margins etc...
$this->getOutput()->addHtml( '<p></p>' );
+
return;
}
$opt['ns' . $n] = 1;
}
}
+
return $opt + $this->extraParams;
}
$link_t = clone $t;
wfRunHooks( 'ShowSearchHitTitle',
- array( &$link_t, &$titleSnippet, $result, $terms, $this ) );
+ array( &$link_t, &$titleSnippet, $result, $terms, $this ) );
$link = Linker::linkKnown(
$link_t,
}
$out .= "<li>{$link} {$redirect}</li>\n";
+
return $out;
}
} else {
$form = '';
wfRunHooks( 'SpecialSearchProfileForm', array( $this, &$form, $profile, $term, $opts ) );
+
return $form;
}
}
foreach ( $opts as $key => $value ) {
$hidden .= Html::hidden( $key, $value );
}
+
// Return final output
return Xml::openElement(
- 'fieldset',
- array( 'id' => 'mw-searchoptions', 'style' => 'margin:0em;' )
- ) .
+ 'fieldset',
+ array( 'id' => 'mw-searchoptions', 'style' => 'margin:0em;' )
+ ) .
Xml::element( 'legend', null, $this->msg( 'powersearch-legend' )->text() ) .
Xml::tags( 'h4', null, $this->msg( 'powersearch-ns' )->parse() ) .
Html::element( 'div', array( 'id' => 'mw-search-togglebox' ) ) .
$this->msg( 'searchbutton' )->text(),
array( 'class' => array( 'mw-ui-button', 'mw-ui-progressive' ) )
) . "\n";
+
return $out . $this->didYouMeanHtml;
}
if ( count( $p ) > 1 ) {
return $wgContLang->getNsIndex( $p[0] ) == NS_FILE;
}
+
return false;
}
if ( count( $p ) > 1 ) {
return $p[0] == $allkeyword;
}
+
return false;
}
$this->searchEngine = $this->searchEngineType ?
SearchEngine::create( $this->searchEngineType ) : SearchEngine::create();
}
+
return $this->searchEngine;
}
function getQueryInfo() {
return array(
'tables' => array( 'page' ),
- 'fields' => array( 'namespace' => 'page_namespace',
- 'title' => 'page_title',
- 'value' => 'page_len' ),
- 'conds' => array( 'page_namespace' =>
- MWNamespace::getContentNamespaces(),
- 'page_is_redirect' => 0 ),
+ 'fields' => array(
+ 'namespace' => 'page_namespace',
+ 'title' => 'page_title',
+ 'value' => 'page_len'
+ ),
+ 'conds' => array(
+ 'page_namespace' => MWNamespace::getContentNamespaces(),
+ 'page_is_redirect' => 0
+ ),
'options' => array( 'USE INDEX' => 'page_redirect_namespace_len' )
);
}
$size = $this->msg( 'nbytes' )->numParams( $result->value )->escaped();
return $exists
- ? "${hlinkInParentheses} {$dm}{$plink} {$dm}[{$size}]"
- : "<del>${hlinkInParentheses} {$dm}{$plink} {$dm}[{$size}]</del>";
+ ? "${hlinkInParentheses} {$dm}{$plink} {$dm}[{$size}]"
+ : "<del>${hlinkInParentheses} {$dm}{$plink} {$dm}[{$size}]</del>";
}
protected function getGroupName() {
class SpecialStatistics extends SpecialPage {
private $views, $edits, $good, $images, $total, $users,
- $activeUsers = 0;
+ $activeUsers = 0;
public function __construct() {
parent::__construct( 'Statistics' );
" $descriptionText" );
}
}
+
return Html::rawElement( 'tr', $trExtraParams,
Html::rawElement( 'td', array(), $text ) .
Html::rawElement( 'td', array( 'class' => 'mw-statistics-numbers' ), $number )
private function getUserStats() {
global $wgActiveUserDays;
+
return Xml::openElement( 'tr' ) .
Xml::tags( 'th', array( 'colspan' => '2' ), $this->msg( 'statistics-header-users' )->parse() ) .
Xml::closeElement( 'tr' ) .
$this->getLanguage()->formatNum( $countUsers ),
array( 'class' => 'statistics-group-' . Sanitizer::escapeClass( $group ) . $classZero ) );
}
+
return $text;
}
$text = '';
$dbr = wfGetDB( DB_SLAVE );
$res = $dbr->select(
- 'page',
- array(
- 'page_namespace',
- 'page_title',
- 'page_counter',
- ),
- array(
- 'page_is_redirect' => 0,
- 'page_counter > 0',
- ),
- __METHOD__,
- array(
- 'ORDER BY' => 'page_counter DESC',
- 'LIMIT' => 10,
- )
- );
- if ( $res->numRows() > 0 ) {
- $text .= Xml::openElement( 'tr' );
- $text .= Xml::tags( 'th', array( 'colspan' => '2' ), $this->msg( 'statistics-mostpopular' )->parse() );
- $text .= Xml::closeElement( 'tr' );
- foreach ( $res as $row ) {
- $title = Title::makeTitleSafe( $row->page_namespace, $row->page_title );
- if ( $title instanceof Title ) {
- $text .= $this->formatRow( Linker::link( $title ),
- $this->getLanguage()->formatNum( $row->page_counter ) );
-
- }
+ 'page',
+ array(
+ 'page_namespace',
+ 'page_title',
+ 'page_counter',
+ ),
+ array(
+ 'page_is_redirect' => 0,
+ 'page_counter > 0',
+ ),
+ __METHOD__,
+ array(
+ 'ORDER BY' => 'page_counter DESC',
+ 'LIMIT' => 10,
+ )
+ );
+
+ if ( $res->numRows() > 0 ) {
+ $text .= Xml::openElement( 'tr' );
+ $text .= Xml::tags( 'th', array( 'colspan' => '2' ), $this->msg( 'statistics-mostpopular' )->parse() );
+ $text .= Xml::closeElement( 'tr' );
+
+ foreach ( $res as $row ) {
+ $title = Title::makeTitleSafe( $row->page_namespace, $row->page_title );
+
+ if ( $title instanceof Title ) {
+ $text .= $this->formatRow( Linker::link( $title ),
+ $this->getLanguage()->formatNum( $row->page_counter ) );
}
- $res->free();
}
+ $res->free();
+ }
+
return $text;
}
// Write the headers
$html = Xml::tags( 'tr', null, Xml::tags( 'th', null, $this->msg( 'tags-tag' )->parse() ) .
- Xml::tags( 'th', null, $this->msg( 'tags-display-header' )->parse() ) .
- Xml::tags( 'th', null, $this->msg( 'tags-description-header' )->parse() ) .
- Xml::tags( 'th', null, $this->msg( 'tags-active-header' )->parse() ) .
- Xml::tags( 'th', null, $this->msg( 'tags-hitcount-header' )->parse() )
- );
+ Xml::tags( 'th', null, $this->msg( 'tags-display-header' )->parse() ) .
+ Xml::tags( 'th', null, $this->msg( 'tags-description-header' )->parse() ) .
+ Xml::tags( 'th', null, $this->msg( 'tags-active-header' )->parse() ) .
+ Xml::tags( 'th', null, $this->msg( 'tags-hitcount-header' )->parse() )
+ );
// Used in #doTagRow()
$this->definedTags = array_fill_keys( ChangeTags::listDefinedTags(), true );
if ( $type == Block::TYPE_AUTO && $this->type == Block::TYPE_IP ) {
$fields['Target']['default'] = $this->target;
unset( $fields['Name'] );
-
} else {
$fields['Target']['default'] = $target;
$fields['Target']['type'] = 'hidden';
break;
}
}
-
} else {
$fields['Target']['default'] = $this->target;
unset( $fields['Name'] );
}
+
return $fields;
}
list( $target, $type ) = SpecialBlock::getTargetAndType( $target );
if ( $block->getType() == Block::TYPE_RANGE && $type == Block::TYPE_IP ) {
$range = $block->getTarget();
+
return array( array( 'ipb_blocked_as_range', $target, $range ) );
}
return array(
'tables' => array( 'page', 'categorylinks' ),
'fields' => array( 'namespace' => 'page_namespace',
- 'title' => 'page_title',
- 'value' => 'page_title' ),
+ 'title' => 'page_title',
+ 'value' => 'page_title' ),
'conds' => array( 'cl_from IS NULL',
- 'page_namespace' => NS_FILE,
- 'page_is_redirect' => 0 ),
+ 'page_namespace' => NS_FILE,
+ 'page_is_redirect' => 0 ),
'join_conds' => array( 'categorylinks' => array(
- 'LEFT JOIN', 'cl_from=page_id' ) )
+ 'LEFT JOIN', 'cl_from=page_id' ) )
);
}
function getQueryInfo() {
return array(
'tables' => array( 'page', 'categorylinks' ),
- 'fields' => array( 'namespace' => 'page_namespace',
- 'title' => 'page_title',
- 'value' => 'page_title' ),
+ 'fields' => array(
+ 'namespace' => 'page_namespace',
+ 'title' => 'page_title',
+ 'value' => 'page_title'
+ ),
// default for page_namespace is all content namespaces (if requestedNamespace is false)
// otherwise, page_namespace is requestedNamespace
- 'conds' => array( 'cl_from IS NULL',
- 'page_namespace' => ( $this->requestedNamespace !== false ? $this->requestedNamespace : MWNamespace::getContentNamespaces() ),
- 'page_is_redirect' => 0 ),
- 'join_conds' => array( 'categorylinks' => array(
- 'LEFT JOIN', 'cl_from = page_id' ) )
+ 'conds' => array(
+ 'cl_from IS NULL',
+ 'page_namespace' => ( $this->requestedNamespace !== false ? $this->requestedNamespace : MWNamespace::getContentNamespaces() ),
+ 'page_is_redirect' => 0
+ ),
+ 'join_conds' => array(
+ 'categorylinks' => array( 'LEFT JOIN', 'cl_from = page_id' )
+ )
);
}
if ( $this->requestedNamespace === false && count( MWNamespace::getContentNamespaces() ) > 1 ) {
return array( 'page_namespace', 'page_title' );
}
+
return array( 'page_title' );
}
*/
public static function listAllPages() {
$dbr = wfGetDB( DB_SLAVE );
+
return self::listPages( $dbr, '' );
}
}
$conds = array( 'ar_namespace' => $this->title->getNamespace(),
- 'ar_title' => $this->title->getDBkey() );
+ 'ar_title' => $this->title->getDBkey() );
$options = array( 'ORDER BY' => 'ar_timestamp DESC' );
->inContentLanguage()->text();
} else {
wfDebug( "Undelete: nothing undeleted...\n" );
+
return false;
}
$status = Status::newGood( 0 );
$status->warning( "undelete-no-results" );
+
return $status;
}
if ( $user->isAllowed( 'browsearchive' ) ) {
$this->showSearchForm();
}
+
return;
}
if ( $result->numRows() == 0 ) {
$out->addWikiMsg( 'undelete-no-results' );
+
return false;
}
if ( !$rev ) {
$out->addWikiMsg( 'undeleterevision-missing' );
+
return;
}
"<div class='mw-warning plainlinks'>\n$1\n</div>\n",
'rev-deleted-text-permission'
);
+
return;
}
$unsuppressBox = '';
}
- $table =
- Xml::fieldset( $this->msg( 'undelete-fieldset-title' )->text() ) .
- Xml::openElement( 'table', array( 'id' => 'mw-undelete-table' ) ) .
- "<tr>
- <td colspan='2' class='mw-undelete-extrahelp'>" .
- $this->msg( 'undeleteextrahelp' )->parseAsBlock() .
- "</td>
- </tr>
- <tr>
- <td class='mw-label'>" .
- Xml::label( $this->msg( 'undeletecomment' )->text(), 'wpComment' ) .
- "</td>
- <td class='mw-input'>" .
- Xml::input( 'wpComment', 50, $this->mComment, array( 'id' => 'wpComment', 'autofocus' => true ) ) .
- "</td>
- </tr>
- <tr>
- <td> </td>
- <td class='mw-submit'>" .
- Xml::submitButton( $this->msg( 'undeletebtn' )->text(), array( 'name' => 'restore', 'id' => 'mw-undelete-submit' ) ) . ' ' .
- Xml::submitButton( $this->msg( 'undeleteinvert' )->text(), array( 'name' => 'invert', 'id' => 'mw-undelete-invert' ) ) .
- "</td>
- </tr>" .
- $unsuppressBox .
- Xml::closeElement( 'table' ) .
- Xml::closeElement( 'fieldset' );
+ $table = Xml::fieldset( $this->msg( 'undelete-fieldset-title' )->text() ) .
+ Xml::openElement( 'table', array( 'id' => 'mw-undelete-table' ) ) .
+ "<tr>
+ <td colspan='2' class='mw-undelete-extrahelp'>" .
+ $this->msg( 'undeleteextrahelp' )->parseAsBlock() .
+ "</td>
+ </tr>
+ <tr>
+ <td class='mw-label'>" .
+ Xml::label( $this->msg( 'undeletecomment' )->text(), 'wpComment' ) .
+ "</td>
+ <td class='mw-input'>" .
+ Xml::input( 'wpComment', 50, $this->mComment, array( 'id' => 'wpComment', 'autofocus' => true ) ) .
+ "</td>
+ </tr>
+ <tr>
+ <td> </td>
+ <td class='mw-submit'>" .
+ Xml::submitButton( $this->msg( 'undeletebtn' )->text(), array( 'name' => 'restore', 'id' => 'mw-undelete-submit' ) ) . ' ' .
+ Xml::submitButton( $this->msg( 'undeleteinvert' )->text(), array( 'name' => 'invert', 'id' => 'mw-undelete-invert' ) ) .
+ "</td>
+ </tr>" .
+ $unsuppressBox .
+ Xml::closeElement( 'table' ) .
+ Xml::closeElement( 'fieldset' );
$out->addHTML( $table );
}
function getQueryInfo() {
return array(
'tables' => array( 'page', 'categorylinks' ),
- 'fields' => array( 'namespace' => 'page_namespace',
- 'title' => 'page_title',
- 'value' => 'page_title' ),
- 'conds' => array( 'cl_from IS NULL',
- 'page_namespace' => NS_CATEGORY,
- 'page_is_redirect' => 0 ),
- 'join_conds' => array( 'categorylinks' => array(
- 'LEFT JOIN', 'cl_to = page_title' ) )
+ 'fields' => array(
+ 'namespace' => 'page_namespace',
+ 'title' => 'page_title',
+ 'value' => 'page_title'
+ ),
+ 'conds' => array(
+ 'cl_from IS NULL',
+ 'page_namespace' => NS_CATEGORY,
+ 'page_is_redirect' => 0
+ ),
+ 'join_conds' => array( 'categorylinks' => array( 'LEFT JOIN', 'cl_to = page_title' ) )
);
}
*/
function formatResult( $skin, $result ) {
$title = Title::makeTitle( NS_CATEGORY, $result->title );
+
return Linker::link( $title, htmlspecialchars( $title->getText() ) );
}
global $wgCountCategorizedImagesAsUsed;
$retval = array(
'tables' => array( 'image', 'imagelinks' ),
- 'fields' => array( 'namespace' => NS_FILE,
- 'title' => 'img_name',
- 'value' => 'img_timestamp',
- 'img_user', 'img_user_text',
- 'img_description' ),
+ 'fields' => array(
+ 'namespace' => NS_FILE,
+ 'title' => 'img_name',
+ 'value' => 'img_timestamp',
+ 'img_user', 'img_user_text',
+ 'img_description'
+ ),
'conds' => array( 'il_to IS NULL' ),
- 'join_conds' => array( 'imagelinks' => array(
- 'LEFT JOIN', 'il_to = img_name' ) )
+ 'join_conds' => array( 'imagelinks' => array( 'LEFT JOIN', 'il_to = img_name' ) )
);
if ( $wgCountCategorizedImagesAsUsed ) {
// Order is significant
$retval['tables'] = array( 'image', 'page', 'categorylinks',
- 'imagelinks' );
+ 'imagelinks' );
$retval['conds']['page_namespace'] = NS_FILE;
$retval['conds'][] = 'cl_from IS NULL';
$retval['conds'][] = 'img_name = page_title';
$retval['join_conds']['categorylinks'] = array(
- 'LEFT JOIN', 'cl_from = page_id' );
+ 'LEFT JOIN', 'cl_from = page_id' );
$retval['join_conds']['imagelinks'] = array(
- 'LEFT JOIN', 'il_to = page_title' );
+ 'LEFT JOIN', 'il_to = page_title' );
}
+
return $retval;
}
function getQueryInfo() {
return array(
'tables' => array( 'page', 'templatelinks' ),
- 'fields' => array( 'namespace' => 'page_namespace',
- 'title' => 'page_title',
- 'value' => 'page_title' ),
- 'conds' => array( 'page_namespace' => NS_TEMPLATE,
- 'tl_from IS NULL',
- 'page_is_redirect' => 0 ),
+ 'fields' => array(
+ 'namespace' => 'page_namespace',
+ 'title' => 'page_title',
+ 'value' => 'page_title'
+ ),
+ 'conds' => array(
+ 'page_namespace' => NS_TEMPLATE,
+ 'tl_from IS NULL',
+ 'page_is_redirect' => 0
+ ),
'join_conds' => array( 'templatelinks' => array(
'LEFT JOIN', array( 'tl_title = page_title',
'tl_namespace = page_namespace' ) ) )
SpecialPage::getTitleFor( 'Whatlinkshere', $title->getPrefixedText() ),
$this->msg( 'unusedtemplateswlh' )->escaped()
);
+
return $this->getLanguage()->specialList( $pageLink, $wlhLink );
}
function getQueryInfo() {
return array(
'tables' => array( 'page', 'watchlist' ),
- 'fields' => array( 'namespace' => 'page_namespace',
- 'title' => 'page_title',
- 'value' => 'page_namespace' ),
- 'conds' => array( 'wl_title IS NULL',
- 'page_is_redirect' => 0,
- "page_namespace != '" . NS_MEDIAWIKI .
- "'" ),
+ 'fields' => array(
+ 'namespace' => 'page_namespace',
+ 'title' => 'page_title',
+ 'value' => 'page_namespace'
+ ),
+ 'conds' => array(
+ 'wl_title IS NULL',
+ 'page_is_redirect' => 0,
+ "page_namespace != '" . NS_MEDIAWIKI . "'"
+ ),
'join_conds' => array( 'watchlist' => array(
'LEFT JOIN', array( 'wl_title = page_title',
'wl_namespace = page_namespace' ) ) )
# Backwards compatibility hook
if ( !wfRunHooks( 'UploadForm:initial', array( &$this ) ) ) {
wfDebug( "Hook 'UploadForm:initial' broke output of the upload form" );
+
return;
}
$this->showUploadForm( $this->getUploadForm() );
} else {
$this->getOutput()->addHTML( $form );
}
-
}
/**
$status = $this->mUpload->fetchFile();
if ( !$status->isOK() ) {
$this->showUploadError( $this->getOutput()->parse( $status->getWikiText() ) );
+
return;
}
$details = $this->mUpload->verifyUpload();
if ( $details['status'] != UploadBase::OK ) {
$this->processVerificationError( $details );
+
return;
}
if ( $permErrors !== true ) {
$code = array_shift( $permErrors[0] );
$this->showRecoverableUploadError( $this->msg( $code, $permErrors[0] )->parse() );
+
return;
}
$status = $this->mUpload->performUpload( $this->mComment, $pageText, $this->mWatchthis, $this->getUser() );
if ( !$status->isGood() ) {
$this->showUploadError( $this->getOutput()->parse( $status->getWikiText() ) );
+
return;
}
$pageText = $comment;
}
}
+
return $pageText;
}
$success = $this->mUpload->unsaveUploadedFile();
if ( !$success ) {
$this->getOutput()->showFileDeleteError( $this->mUpload->getTempPath() );
+
return false;
} else {
return true;
foreach ( $dupes as $file ) {
$gallery->add( $file->getTitle() );
}
+
return '<li>' .
wfMessage( 'file-exists-duplicate' )->numParams( count( $dupes ) )->parse() .
$gallery->toHtml() . "</li>\n";
public function __construct( array $options = array(), IContextSource $context = null ) {
$this->mWatch = !empty( $options['watch'] );
$this->mForReUpload = !empty( $options['forreupload'] );
- $this->mSessionKey = isset( $options['sessionkey'] )
- ? $options['sessionkey'] : '';
+ $this->mSessionKey = isset( $options['sessionkey'] ) ? $options['sessionkey'] : '';
$this->mHideIgnoreWarning = !empty( $options['hideignorewarning'] );
$this->mDestWarningAck = !empty( $options['destwarningack'] );
$this->mDestFile = isset( $options['destfile'] ) ? $options['destfile'] : '';
$this->mSourceIds[] = $field['id'];
}
}
-
}
/**
'upload-type' => 'File',
'radio' => &$radio,
'help' => $this->msg( 'upload-maxfilesize',
- $this->getContext()->getLanguage()->formatSize( $this->mMaxUploadSize['file'] ) )
- ->parse() .
+ $this->getContext()->getLanguage()->formatSize( $this->mMaxUploadSize['file'] )
+ )->parse() .
$this->msg( 'word-separator' )->escaped() .
$this->msg( 'upload_source_file' )->escaped(),
'checked' => $selectedSourceType == 'file',
'upload-type' => 'url',
'radio' => &$radio,
'help' => $this->msg( 'upload-maxfilesize',
- $this->getContext()->getLanguage()->formatSize( $this->mMaxUploadSize['url'] ) )
- ->parse() .
+ $this->getContext()->getLanguage()->formatSize( $this->mMaxUploadSize['url'] )
+ )->parse() .
$this->msg( 'word-separator' )->escaped() .
$this->msg( 'upload_source_url' )->escaped(),
'checked' => $selectedSourceType == 'url',
'default' => $this->getExtensionsMessage(),
'raw' => true,
);
+
return $descriptor;
}
# Print a list of allowed file extensions, if so configured. We ignore
# MIME type here, it's incomprehensible to most people and too long.
global $wgCheckFileExtensions, $wgStrictFileExtensions,
- $wgFileExtensions, $wgFileBlacklist;
+ $wgFileExtensions, $wgFileBlacklist;
if ( $wgCheckFileExtensions ) {
if ( $wgStrictFileExtensions ) {
# Everything is permitted.
$extensionsList = '';
}
+
return $extensionsList;
}
function trySubmit() {
return false;
}
-
}
/**
$id = $this->mParams['id'];
$label = Html::rawElement( 'label', array( 'for' => $id ), $this->mLabel );
}
+
return Html::rawElement( 'td', array( 'class' => 'mw-label' ) + $cellAttributes, $label );
}
if ( $subPage === null || $subPage === '' ) {
return $this->showUploads();
}
+
return $this->showUpload( $subPage );
}
$handler = $file->getHandler();
if ( $handler ) {
$params = $handler->parseParamString( $paramString );
+
return array( 'file' => $file, 'type' => $type, 'params' => $params );
} else {
throw new UploadStashBadPathException( 'No handler found for ' .
- "mime {$file->getMimeType()} of file {$file->getPath()}" );
+ "mime {$file->getMimeType()} of file {$file->getPath()}" );
}
}
}
return $this->outputLocalFile( $thumbFile );
-
}
/**
* Note: We rely on NFS to have propagated the file contents to the scaler. However, we do not rely on the thumbnail being created in NFS and then
* propagated back to our filesystem. Instead we take the results of the HTTP request instead.
* Note: no caching is being done here, although we are instructing the client to cache it forever.
- * @param $file: File object
- * @param $params: scaling parameters ( e.g. array( width => '50' ) );
- * @param $flags: scaling flags ( see File:: constants )
+ * @param File $file
+ * @param array $params Scaling parameters ( e.g. array( width => '50' ) );
+ * @param $flags Scaling flags ( see File:: constants )
* @throws MWException
* @return boolean success
*/
);
$req = MWHttpRequest::factory( $scalerThumbUrl, $httpOptions );
$status = $req->execute();
- if ( ! $status->isOK() ) {
+ if ( !$status->isOK() ) {
$errors = $status->getErrorsArray();
$errorStr = "Fetching thumbnail failed: " . print_r( $errors, 1 );
$errorStr .= "\nurl = $scalerThumbUrl\n";
throw new MWException( $errorStr );
}
$contentType = $req->getResponseHeader( "content-type" );
- if ( ! $contentType ) {
+ if ( !$contentType ) {
throw new MWException( "Missing content-type header" );
}
+
return $this->outputContents( $req->getContent(), $contentType );
}
if ( $file->getSize() > self::MAX_SERVE_BYTES ) {
throw new SpecialUploadStashTooLargeException();
}
+
return $file->getRepo()->streamFile( $file->getPath(),
array( 'Content-Transfer-Encoding: binary',
'Expires: Sun, 17-Jan-2038 19:14:07 GMT' )
}
self::outputFileHeaders( $contentType, $size );
print $content;
+
return true;
}
* Output headers for streaming
* XXX unsure about encoding as binary; if we received from HTTP perhaps we should use that encoding, concatted with semicolon to mimeType as it usually is.
* Side effect: preps PHP to write headers to STDOUT.
- * @param string $contentType : string suitable for content-type header
- * @param string $size: length in bytes
+ * @param string $contentType String suitable for content-type header
+ * @param string $size Length in bytes
*/
private static function outputFileHeaders( $contentType, $size ) {
header( "Content-Type: $contentType", true );
if ( isset( $formData['Clear'] ) ) {
$stash = RepoGroup::singleton()->getLocalRepo()->getUploadStash();
wfDebug( "stash has: " . print_r( $stash->listFiles(), true ) );
- if ( ! $stash->clear() ) {
+
+ if ( !$stash->clear() ) {
return Status::newFatal( 'uploadstash-errclear' );
}
}
+
return Status::newGood();
}
}
}
-class SpecialUploadStashTooLargeException extends MWException {};
+class SpecialUploadStashTooLargeException extends MWException {
+}
+
$this->mCookieCheck = $request->getVal( 'wpCookieCheck' );
$this->mPosted = $request->wasPosted();
$this->mCreateaccountMail = $request->getCheck( 'wpCreateaccountMail' )
- && $wgEnableEmail;
+ && $wgEnableEmail;
$this->mCreateaccount = $request->getCheck( 'wpCreateaccount' ) && !$this->mCreateaccountMail;
$this->mLoginattempt = $request->getCheck( 'wpLoginattempt' );
$this->mAction = $request->getVal( 'action' );
# 2. Do not return to PasswordReset after a successful password change
# but goto Wiki start page (Main_Page) instead ( bug 33997 )
$returnToTitle = Title::newFromText( $this->mReturnTo );
- if ( is_object( $returnToTitle ) && (
- $returnToTitle->isSpecial( 'Userlogout' )
- || $returnToTitle->isSpecial( 'PasswordReset' ) ) ) {
+ if ( is_object( $returnToTitle )
+ && ( $returnToTitle->isSpecial( 'Userlogout' )
+ || $returnToTitle->isSpecial( 'PasswordReset' ) )
+ ) {
$this->mReturnTo = '';
$this->mReturnToQuery = '';
}
$this->getOutput()->redirect( $url );
// Since we only do this redir to change proto, always vary
$this->getOutput()->addVaryHeader( 'X-Forwarded-Proto' );
+
return;
} else {
// A wiki without HTTPS login support should set $wgServer to
if ( !is_null( $this->mCookieCheck ) ) {
$this->onCookieRedirectCheck( $this->mCookieCheck );
+
return;
} elseif ( $this->mPosted ) {
if ( $this->mCreateaccount ) {
$this->addNewAccount();
+
return;
} elseif ( $this->mCreateaccountMail ) {
$this->addNewAccountMailPassword();
+
return;
} elseif ( ( 'submitlogin' == $this->mAction ) || $this->mLoginattempt ) {
$this->processLogin();
+
return;
}
}
function addNewAccountMailPassword() {
if ( $this->mEmail == '' ) {
$this->mainLoginForm( $this->msg( 'noemailcreate' )->escaped() );
+
return;
}
if ( !$status->isGood() ) {
$error = $status->getMessage();
$this->mainLoginForm( $error->toString() );
+
return;
}
if ( !$status->isGood() ) {
$error = $status->getMessage();
$this->mainLoginForm( $error->toString() );
+
return false;
}
wfRunHooks( 'AddNewAccount', array( $u, false ) );
$u->addNewUserLogEntry( 'create2', $this->mReason );
}
+
return true;
}
# Request forgery checks.
if ( !self::getCreateaccountToken() ) {
self::setCreateaccountToken();
+
return Status::newFatal( 'nocookiesfornew' );
}
} elseif ( $creationBlock instanceof Block ) {
// Throws an ErrorPageError.
$this->userBlockedMessage( $creationBlock );
+
// This should never be reached.
return false;
}
# Include checks that will include GlobalBlocking (Bug 38333)
$permErrors = $this->getPageTitle()->getUserPermissionsErrors( 'createaccount', $currentUser, true );
if ( count( $permErrors ) ) {
- throw new PermissionsError( 'createaccount', $permErrors );
+ throw new PermissionsError( 'createaccount', $permErrors );
}
$ip = $this->getRequest()->getIP();
if ( !is_array( $valid ) ) {
$valid = array( $valid, $wgMinimalPasswordLength );
}
+
return call_user_func_array( 'Status::newFatal', $valid );
}
}
// To return a different error code, return a Status object.
$abortError = new Message( 'createaccount-hook-aborted', array( $abortError ) );
$abortError->text();
+
return Status::newFatal( $abortError );
} else {
// For MediaWiki 1.23+ and updated hooks, return the Status object
}
self::clearCreateaccountToken();
+
return $this->initUser( $u, false );
}
// If the user doesn't have a login token yet, set one.
if ( !self::getLoginToken() ) {
self::setLoginToken();
+
return self::NEED_TOKEN;
}
// If the user didn't pass a login token, tell them we need one
// will effectively be using stale data.
if ( $this->getUser()->getName() === $this->mUsername ) {
wfDebug( __METHOD__ . ": already logged in as {$this->mUsername}\n" );
+
return self::SUCCESS;
}
$msg = null;
if ( !wfRunHooks( 'AbortLogin', array( $u, $this->mPassword, &$abort, &$msg ) ) ) {
$this->mAbortLoginErrorMsg = $msg;
+
return $abort;
}
$retval = self::SUCCESS;
}
wfRunHooks( 'LoginAuthenticateAudit', array( $u, $this->mPassword, $retval ) );
+
return $retval;
}
if ( $this->getUser()->isBlockedFromCreateAccount() ) {
wfDebug( __METHOD__ . ": user is blocked from account creation\n" );
+
return self::CREATE_BLOCKED;
}
+
if ( !$wgAuth->autoCreate() ) {
return self::NOT_EXISTS;
}
+
if ( !$wgAuth->userExists( $user->getName() ) ) {
wfDebug( __METHOD__ . ": user does not exist\n" );
+
return self::NOT_EXISTS;
}
+
if ( !$wgAuth->authenticate( $user->getName(), $this->mPassword ) ) {
wfDebug( __METHOD__ . ": \$wgAuth->authenticate() returned false, aborting\n" );
+
return self::WRONG_PLUGIN_PASS;
}
// Hook point to add extra creation throttles and blocks
wfDebug( "LoginForm::attemptAutoCreate: a hook blocked creation: $abortError\n" );
$this->mAbortLoginErrorMsg = $abortError;
+
return self::ABORTED;
}
if ( !$status->isOK() ) {
$errors = $status->getErrorsByType( 'error' );
$this->mAbortLoginErrorMsg = $errors[0]['message'];
+
return self::ABORTED;
}
function processLogin() {
global $wgMemc, $wgLang, $wgSecureLogin, $wgPasswordAttemptThrottle,
- $wgInvalidPasswordReset;
+ $wgInvalidPasswordReset;
switch ( $this->authenticateUserData() ) {
case self::SUCCESS:
case self::THROTTLED:
$error = $this->mAbortLoginErrorMsg ?: 'login-throttled';
$this->mainLoginForm( $this->msg( $error )
- ->params ( $this->getLanguage()->formatDuration( $wgPasswordAttemptThrottle['seconds'] ) )
- ->text()
+ ->params( $this->getLanguage()->formatDuration( $wgPasswordAttemptThrottle['seconds'] ) )
+ ->text()
);
break;
case self::USER_BLOCKED:
throw new PermissionsError( 'createaccount', $permErrors );
} elseif ( $user->isBlockedFromCreateAccount() ) {
$this->userBlockedMessage( $user->isBlockedFromCreateAccount() );
+
return;
} elseif ( wfReadOnly() ) {
throw new ReadOnlyError;
*/
function hasSessionCookie() {
global $wgDisableCookieCheck;
+
return $wgDisableCookieCheck ? true : $this->getRequest()->checkSessionCookie();
}
*/
public static function getLoginToken() {
global $wgRequest;
+
return $wgRequest->getSessionData( 'wsLoginToken' );
}
*/
public static function getCreateaccountToken() {
global $wgRequest;
+
return $wgRequest->getSessionData( 'wsCreateaccountToken' );
}
$links[] = $this->makeLanguageSelectorLink( $parts[0], trim( $parts[1] ) );
}
}
+
return count( $links ) > 0 ? $this->msg( 'loginlanguagelabel' )->rawParams(
$this->getLanguage()->pipeList( $links ) )->escaped() : '';
} else {
if ( $user->getId() == 0 ) {
return false;
}
+
return !empty( $available['add'] )
|| !empty( $available['remove'] )
|| ( ( $this->isself || !$checkIfSelf ) &&
$out = $this->getOutput();
$out->wrapWikiMsg( "<div class=\"successbox\">\n$1\n</div>", 'userrights-removed-self' );
$out->returnToMain();
+
return;
}
$status = $this->fetchUser( $this->mTarget );
if ( !$status->isOK() ) {
$this->getOutput()->addWikiText( $status->getWikiText() );
+
return;
}
);
$out->redirect( $this->getSuccessURL() );
+
return;
}
}
if ( $newGroups != $oldGroups ) {
$this->addLogEntry( $user, $oldGroups, $newGroups, $reason );
}
+
return array( $add, $remove );
}
$status = $this->fetchUser( $username );
if ( !$status->isOK() ) {
$this->getOutput()->addWikiText( $status->getWikiText() );
+
return;
} else {
$user = $status->value;
}
$userToolLinks = Linker::userToolLinks(
- $user->getId(),
- $user->getName(),
- false, /* default for redContribsWhenNoEdits */
- Linker::TOOL_LINKS_EMAIL /* Add "send e-mail" link */
+ $user->getId(),
+ $user->getName(),
+ false, /* default for redContribsWhenNoEdits */
+ Linker::TOOL_LINKS_EMAIL /* Add "send e-mail" link */
);
$this->getOutput()->addHTML(
private function canRemove( $group ) {
// $this->changeableGroups()['remove'] doesn't work, of course. Thanks, PHP.
$groups = $this->changeableGroups();
+
return in_array( $group, $groups['remove'] ) || ( $this->isself && in_array( $group, $groups['remove-self'] ) );
}
*/
private function canAdd( $group ) {
$groups = $this->changeableGroups();
+
return in_array( $group, $groups['add'] ) || ( $this->isself && in_array( $group, $groups['add-self'] ) );
}
}
wfProfileOut( __METHOD__ );
+
return $version;
}
}
wfProfileOut( __METHOD__ );
+
return $v;
}
preg_match( "/^(\d+\.\d+)/", $wgVersion, $versionParts );
$versionUrl = "https://www.mediawiki.org/wiki/MediaWiki_{$versionParts[1]}";
}
+
return "[$versionUrl $wgVersion]";
}
*/
public static function getExtensionTypeName( $type ) {
$types = self::getExtensionTypes();
+
return isset( $types[$type] ) ? $types[$type] : $types['other'];
}
)
);
- array_walk( $tags, function( &$value ) {
+ array_walk( $tags, function ( &$value ) {
$value = '<' . htmlentities( $value ) . '>';
} );
$out .= $this->listToText( $tags );
if ( $vcsDate ) {
$vcsTimeString = Html::element( 'span',
- array( 'class' => 'mw-version-ext-vcs-timestamp' ),
- $this->getLanguage()->timeanddate( $vcsDate )
- );
+ array( 'class' => 'mw-version-ext-vcs-timestamp' ),
+ $this->getLanguage()->timeanddate( $vcsDate )
+ );
$versionString .= " {$vcsTimeString}";
}
$versionString = Html::rawElement( 'span',
*/
private function IPInfo() {
$ip = str_replace( '--', ' - ', htmlspecialchars( $this->getRequest()->getIP() ) );
+
return "<!-- visited from $ip -->\n<span style='display:none'>visited from $ip</span>";
}
$text = $this->msg( 'version-poweredby-others' )->text();
}
$list[] = $text;
-
} elseif ( substr( $item, -5 ) == ' ...]' ) {
$hasOthers = true;
$list[] = $this->getOutput()->parseInline(
substr( $item, 0, -4 ) . $this->msg( 'version-poweredby-others' )->text() . "]"
);
-
} else {
$list[] = $this->getOutput()->parseInline( $item );
}
* Obtains the full path of an extensions authors or credits file if
* one exists.
*
- * @param string $extDir: Path to the extensions root directory
+ * @param string $extDir Path to the extensions root directory
*
* @since 1.23
*
* Obtains the full path of an extensions copying or license file if
* one exists.
*
- * @param string $extDir: Path to the extensions root directory
+ * @param string $extDir Path to the extensions root directory
*
* @since 1.23
*
if ( $sort ) {
sort( $list );
}
+
return $this->getLanguage()->listToText( array_map( array( __CLASS__, 'arrayToString' ), $list ) );
}
}
}
if ( is_object( $list ) ) {
$class = wfMessage( 'parentheses' )->params( get_class( $list ) )->escaped();
+
return $class;
} elseif ( !is_array( $list ) ) {
return $list;
} else {
$class = $list[0];
}
+
return wfMessage( 'parentheses' )->params( "$class, {$list[1]}" )->escaped();
}
}
*/
public static function getGitHeadSha1( $dir ) {
$repo = new GitInfo( $dir );
+
return $repo->getHeadSHA1();
}
}
$out .= Html::closeElement( 'table' );
+
return $out;
}
protected function getGroupName() {
return 'wiki';
}
-
}
function getQueryInfo() {
return array(
'tables' => array( 'categorylinks', 'page' ),
- 'fields' => array( 'namespace' => NS_CATEGORY,
- 'title' => 'cl_to',
- 'value' => 'COUNT(*)' ),
+ 'fields' => array(
+ 'namespace' => NS_CATEGORY,
+ 'title' => 'cl_to',
+ 'value' => 'COUNT(*)'
+ ),
'conds' => array( 'page_title IS NULL' ),
'options' => array( 'GROUP BY' => 'cl_to' ),
'join_conds' => array( 'page' => array( 'LEFT JOIN',
__METHOD__
);
foreach ( $categoryRes as $row ) {
- $this->currentCategoryCounts[ $row->cat_title ] = intval( $row->cat_pages );
+ $this->currentCategoryCounts[$row->cat_title] = intval( $row->cat_pages );
}
// Back to start for display
} else {
$plink = Linker::link( $nt, $text );
- $currentValue = isset( $this->currentCategoryCounts[ $result->title ] )
- ? $this->currentCategoryCounts[ $result->title ]
+ $currentValue = isset( $this->currentCategoryCounts[$result->title] )
+ ? $this->currentCategoryCounts[$result->title]
: 0;
// If the category has been created or emptied since the list was refreshed, strike it
function getQueryInfo() {
return array(
'tables' => array( 'imagelinks', 'image' ),
- 'fields' => array( 'namespace' => NS_FILE,
- 'title' => 'il_to',
- 'value' => 'COUNT(*)' ),
+ 'fields' => array(
+ 'namespace' => NS_FILE,
+ 'title' => 'il_to',
+ 'value' => 'COUNT(*)'
+ ),
'conds' => array( 'img_name IS NULL' ),
'options' => array( 'GROUP BY' => 'il_to' ),
'join_conds' => array( 'image' =>
),
'conds' => array(
'pg1.page_namespace IS NULL',
- "pl_namespace NOT IN ( '" . NS_USER .
- "', '" . NS_USER_TALK . "' )",
+ "pl_namespace NOT IN ( '" . NS_USER . "', '" . NS_USER_TALK . "' )",
"pg2.page_namespace != '" . NS_MEDIAWIKI . "'"
),
'options' => array(
);
// Replacement for the WantedPages::getSQL hook
wfRunHooks( 'WantedPages::getQueryInfo', array( &$this, &$query ) );
+
return $query;
}
function getQueryInfo() {
return array(
'tables' => array( 'templatelinks', 'page' ),
- 'fields' => array( 'namespace' => 'tl_namespace',
- 'title' => 'tl_title',
- 'value' => 'COUNT(*)' ),
- 'conds' => array( 'page_title IS NULL',
- 'tl_namespace' => NS_TEMPLATE ),
- 'options' => array(
- 'GROUP BY' => array( 'tl_namespace', 'tl_title' ) ),
+ 'fields' => array(
+ 'namespace' => 'tl_namespace',
+ 'title' => 'tl_title',
+ 'value' => 'COUNT(*)'
+ ),
+ 'conds' => array(
+ 'page_title IS NULL',
+ 'tl_namespace' => NS_TEMPLATE
+ ),
+ 'options' => array( 'GROUP BY' => array( 'tl_namespace', 'tl_title' ) ),
'join_conds' => array( 'page' => array( 'LEFT JOIN',
- array( 'page_namespace = tl_namespace',
- 'page_title = tl_title' ) ) )
+ array( 'page_namespace = tl_namespace',
+ 'page_title = tl_title' ) ) )
);
}
}
$output->redirect( $title->getLocalURL() );
+
return;
}
$user = $this->getUser();
$opts = $this->getOptions();
- if ( ( $wgEnotifWatchlist || $wgShowUpdatedMarker ) && $request->getVal( 'reset' ) &&
- $request->wasPosted() )
- {
+ if ( ( $wgEnotifWatchlist || $wgShowUpdatedMarker )
+ && $request->getVal( 'reset' )
+ && $request->wasPosted()
+ ) {
$user->clearAllNotifications();
$output->redirect( $this->getPageTitle()->getFullURL( $opts->getChangedValues() ) );
+
return;
}
// methods defined on WebRequest and removing this dependency would cause some code duplication.
$request = new DerivativeRequest( $this->getRequest(), $params );
$opts->fetchValuesFromRequest( $request );
+
return $opts;
}
if ( $opts['days'] > 0 ) {
$timestamp = wfTimestampNow();
$wlInfo = $this->msg( 'wlnote2' )->numParams( round( $opts['days'] * 24 ) )->params(
- $lang->userDate( $timestamp, $user ), $lang->userTime( $timestamp, $user ) )->parse() . "<br />\n";
+ $lang->userDate( $timestamp, $user ), $lang->userTime( $timestamp, $user )
+ )->parse() . "<br />\n";
}
$nondefaults = $opts->getChangedValues();
foreach ( $days as $d ) {
$days[$i++] = $this->daysLink( $d, $options );
}
+
return $this->msg( 'wlshowlast' )->rawParams(
$this->getLanguage()->pipeList( $hours ),
$this->getLanguage()->pipeList( $days ),
$this->target = Title::newFromURL( $opts->getValue( 'target' ) );
if ( !$this->target ) {
$out->addHTML( $this->whatlinkshereForm() );
+
return;
}
'rd_namespace' => $target->getNamespace(),
'rd_title' => $target->getDBkey(),
'rd_interwiki = ' . $dbr->addQuotes( '' ) . ' OR rd_interwiki IS NULL'
- )));
+ ) ) );
if ( $fetchlinks ) {
$options['ORDER BY'] = 'pl_from';
$out->addWikiMsg( $errMsg, $this->target->getPrefixedText() );
}
}
+
return;
}
$out->addHTML( $this->listEnd() );
if ( $level == 0 ) {
- if( !$this->including() ){
+ if ( !$this->including() ) {
$out->addHTML( $prevnext );
}
}
# Target input
$f .= Xml::inputLabel( $this->msg( 'whatlinkshere-page' )->text(), 'target',
- 'mw-whatlinkshere-target', 40, $target );
+ 'mw-whatlinkshere-target', 40, $target );
$f .= ' ';
$links[] = $this->msg( "whatlinkshere-{$type}" )->rawParams(
$this->makeSelfLink( $msg, array_merge( $changed, $overrides ) ) )->escaped();
}
+
return Xml::fieldset( $this->msg( 'whatlinkshere-filters' )->text(), $this->getLanguage()->pipeList( $links ) );
}
function getQueryInfo() {
$query = array(
'tables' => array( 'page', 'langlinks' ),
- 'fields' => array( 'namespace' => 'page_namespace',
- 'title' => 'page_title',
- 'value' => 'page_title' ),
- 'conds' => array( 'll_title IS NULL',
- 'page_namespace' => MWNamespace::getContentNamespaces(),
- 'page_is_redirect' => 0 ),
- 'join_conds' => array( 'langlinks' => array(
- 'LEFT JOIN', 'll_from = page_id' ) )
+ 'fields' => array(
+ 'namespace' => 'page_namespace',
+ 'title' => 'page_title',
+ 'value' => 'page_title'
+ ),
+ 'conds' => array(
+ 'll_title IS NULL',
+ 'page_namespace' => MWNamespace::getContentNamespaces(),
+ 'page_is_redirect' => 0
+ ),
+ 'join_conds' => array( 'langlinks' => array( 'LEFT JOIN', 'll_from = page_id' ) )
);
if ( $this->prefix ) {
$dbr = wfGetDB( DB_SLAVE );
$query['conds'][] = 'page_title ' . $dbr->buildLike( $this->prefix, $dbr->anyString() );
}
+
return $query;
}