$outputPage = $this->getOutput();
$title = Title::newFromText( $target );
if ( !$title || $title->isExternal() ) {
- $outputPage->addHtml( '<div class="errorbox">' . $this->msg( 'allpagesbadtitle' )
+ $outputPage->addHTML( '<div class="errorbox">' . $this->msg( 'allpagesbadtitle' )
->parse() . '</div>' );
return false;
$ns = $title->getNamespace();
$dbkey = $title->getDBkey();
- $tables = array( 'recentchanges' );
+ $tables = [ 'recentchanges' ];
$select = RecentChange::selectFields();
- $join_conds = array();
- $query_options = array();
+ $join_conds = [];
+ $query_options = [];
// left join with watchlist table to highlight watched rows
$uid = $this->getUser()->getId();
if ( $uid && $this->getUser()->isAllowed( 'viewmywatchlist' ) ) {
$tables[] = 'watchlist';
$select[] = 'wl_user';
- $join_conds['watchlist'] = array( 'LEFT JOIN', array(
+ $join_conds['watchlist'] = [ 'LEFT JOIN', [
'wl_user' => $uid,
'wl_title=rc_title',
'wl_namespace=rc_namespace'
- ) );
+ ] ];
}
if ( $this->getUser()->isAllowed( 'rollback' ) ) {
$tables[] = 'page';
- $join_conds['page'] = array( 'LEFT JOIN', 'rc_cur_id=page_id' );
+ $join_conds['page'] = [ 'LEFT JOIN', 'rc_cur_id=page_id' ];
$select[] = 'page_latest';
}
ChangeTags::modifyDisplayQuery(
if ( $ns == NS_CATEGORY && !$showlinkedto ) {
// special handling for categories
// XXX: should try to make this less kludgy
- $link_tables = array( 'categorylinks' );
+ $link_tables = [ 'categorylinks' ];
$showlinkedto = true;
} else {
// for now, always join on these tables; really should be configurable as in whatlinkshere
- $link_tables = array( 'pagelinks', 'templatelinks' );
+ $link_tables = [ 'pagelinks', 'templatelinks' ];
// imagelinks only contains links to pages in NS_FILE
if ( $ns == NS_FILE || !$showlinkedto ) {
$link_tables[] = 'imagelinks';
}
// field name prefixes for all the various tables we might want to join with
- $prefix = array(
+ $prefix = [
'pagelinks' => 'pl',
'templatelinks' => 'tl',
'categorylinks' => 'cl',
'imagelinks' => 'il'
- );
+ ];
- $subsql = array(); // SELECT statements to combine with UNION
+ $subsql = []; // SELECT statements to combine with UNION
foreach ( $link_tables as $link_table ) {
$pfx = $prefix[$link_table];
if ( $ns != $link_ns ) {
continue;
} // should never happen, but check anyway
- $subconds = array( "{$pfx}_to" => $dbkey );
+ $subconds = [ "{$pfx}_to" => $dbkey ];
} else {
- $subconds = array( "{$pfx}_namespace" => $ns, "{$pfx}_title" => $dbkey );
+ $subconds = [ "{$pfx}_namespace" => $ns, "{$pfx}_title" => $dbkey ];
}
$subjoin = "rc_cur_id = {$pfx}_from";
} else {
// find changes to pages linked from this page
- $subconds = array( "{$pfx}_from" => $id );
+ $subconds = [ "{$pfx}_from" => $id ];
if ( $link_table == 'imagelinks' || $link_table == 'categorylinks' ) {
$subconds["rc_namespace"] = $link_ns;
$subjoin = "rc_title = {$pfx}_to";
} else {
- $subjoin = array( "rc_namespace = {$pfx}_namespace", "rc_title = {$pfx}_title" );
+ $subjoin = [ "rc_namespace = {$pfx}_namespace", "rc_title = {$pfx}_title" ];
}
}
if ( $dbr->unionSupportsOrderAndLimit() ) {
- $order = array( 'ORDER BY' => 'rc_timestamp DESC' );
+ $order = [ 'ORDER BY' => 'rc_timestamp DESC' ];
} else {
- $order = array();
+ $order = [];
}
$query = $dbr->selectSQLText(
- array_merge( $tables, array( $link_table ) ),
+ array_merge( $tables, [ $link_table ] ),
$select,
$conds + $subconds,
__METHOD__,
$order + $query_options,
- $join_conds + array( $link_table => array( 'INNER JOIN', $subjoin ) )
+ $join_conds + [ $link_table => [ 'INNER JOIN', $subjoin ] ]
);
if ( $dbr->unionSupportsOrderAndLimit() ) {
function getExtraOptions( $opts ) {
$extraOpts = parent::getExtraOptions( $opts );
- $opts->consumeValues( array( 'showlinkedto', 'target' ) );
+ $opts->consumeValues( [ 'showlinkedto', 'target' ] );
- $extraOpts['target'] = array( $this->msg( 'recentchangeslinked-page' )->escaped(),
+ $extraOpts['target'] = [ $this->msg( 'recentchangeslinked-page' )->escaped(),
Xml::input( 'target', 40, str_replace( '_', ' ', $opts['target'] ) ) .
- Xml::check( 'showlinkedto', $opts['showlinkedto'], array( 'id' => 'showlinkedto' ) ) . ' ' .
- Xml::label( $this->msg( 'recentchangeslinked-to' )->text(), 'showlinkedto' ) );
+ Xml::check( 'showlinkedto', $opts['showlinkedto'], [ 'id' => 'showlinkedto' ] ) . ' ' .
+ Xml::label( $this->msg( 'recentchangeslinked-to' )->text(), 'showlinkedto' ) ];
$this->addHelpLink( 'Help:Related changes' );
return $extraOpts;
* @return string[] Matching subpages
*/
public function prefixSearchSubpages( $search, $limit, $offset ) {
- $title = Title::newFromText( $search );
- if ( !$title || !$title->canExist() ) {
- // No prefix suggestion in special and media namespace
- return array();
- }
- // Autocomplete subpage the same as a normal search
- $prefixSearcher = new StringPrefixSearch;
- $result = $prefixSearcher->search( $search, $limit, array(), $offset );
- return $result;
+ return $this->prefixSearchString( $search, $limit, $offset );
}
}