55 parent::__construct(
'Shortpages' );
56 $this->namespaceInfo = $namespaceInfo;
69 'page_namespace' => array_diff(
70 $this->namespaceInfo->getContentNamespaces(),
73 'page_is_redirect' => 0
76 $options = [
'USE INDEX' => [
'page' =>
'page_redirect_namespace_len' ] ];
79 $this->
getHookRunner()->onShortPagesQuery( $tables, $conds, $joinConds, $options );
84 'namespace' =>
'page_namespace',
85 'title' =>
'page_title',
89 'join_conds' => $joinConds,
95 $fname = static::class .
'::reallyDoQuery';
98 $conds = isset( $query[
'conds'] ) ? (array)$query[
'conds'] : [];
99 $namespaces = $conds[
'page_namespace'];
100 unset( $conds[
'page_namespace'] );
102 if ( count( $namespaces ) === 1 || !$dbr->unionSupportsOrderAndLimit() ) {
108 $sqb = $dbr->newSelectQueryBuilder()
109 ->select( isset( $query[
'fields'] ) ? (array)$query[
'fields'] : [] )
110 ->tables( isset( $query[
'tables'] ) ? (array)$query[
'tables'] : [] )
112 ->options( isset( $query[
'options'] ) ? (array)$query[
'options'] : [] )
113 ->joinConds( isset( $query[
'join_conds'] ) ? (array)$query[
'join_conds'] : [] );
121 $sqb->limit( intval(
$limit ) );
127 foreach ( $order as &$field ) {
132 $uqb = $dbr->newUnionQueryBuilder()->all();
133 foreach ( $namespaces as $namespace ) {
135 $nsSqb->orderBy( $order );
136 $nsSqb->andWhere( [
'page_namespace' => $namespace ] );
141 $uqb->limit( intval(
$limit ) );
144 $uqb->offset( intval(
$offset ) );
150 $uqb->orderBy( $orderBy );
151 return $uqb->caller( $fname )->fetchResultSet();
155 return [
'page_len' ];
176 $title = Title::makeTitleSafe( $result->namespace, $result->title );
178 return Html::element(
'span', [
'class' =>
'mw-invalidtitle' ],
179 Linker::getInvalidTitleDescription( $this->
getContext(), $result->namespace, $result->title ) );
183 $hlink = $linkRenderer->makeKnownLink(
185 $this->
msg(
'hist' )->text(),
187 [
'action' =>
'history' ]
189 $hlinkInParentheses = $this->
msg(
'parentheses' )->rawParams( $hlink )->escaped();
192 $plink = $linkRenderer->makeLink( $title );
193 $exists = $title->exists();
195 $plink = $linkRenderer->makeKnownLink( $title );
200 'dir' => $contentLanguage->getDir(),
201 'lang' => $contentLanguage->getHtmlCode(),
203 $plink = Html::rawElement(
'bdi', $bdiAttrs, $plink );
204 $size = $this->
msg(
'nbytes' )->numParams( $result->value )->escaped();
205 $result =
"{$hlinkInParentheses} {$plink} [{$size}]";
207 return $exists ? $result : Html::rawElement(
'del', [], $result );
211 return 'maintenance';
219class_alias( SpecialShortPages::class,
'SpecialShortPages' );
A class containing constants representing the names of configuration variables.
const ShortPagesNamespaceExclusions
Name constant for the ShortPagesNamespaceExclusions setting, for use with Config::get()
This is a class for doing query pages; since they're almost all the same, we factor out some of the f...
setDatabaseProvider(IConnectionProvider $databaseProvider)
int $offset
The offset and limit in use, as passed to the query() function.
isCached()
Whether or not the output of the page in question is retrieved from the database cache.
executeLBFromResultWrapper(IResultWrapper $res, $ns=null)
Creates a new LinkBatch object, adds all pages from the passed result wrapper (MUST include title and...
getRecacheDB()
Get a DB connection to be used for slow recache queries.
setLinkBatchFactory(LinkBatchFactory $linkBatchFactory)
getConfig()
Shortcut to get main config object.
getContext()
Gets the context this SpecialPage is executed in.
msg( $key,... $params)
Wrapper around wfMessage that sets the current context.
getContentLanguage()
Shortcut to get content language.
List of the shortest pages in the database.
getQueryInfo()
Subclasses return an SQL query here, formatted as an array with the following keys: tables => Table(s...
__construct(NamespaceInfo $namespaceInfo, IConnectionProvider $dbProvider, LinkBatchFactory $linkBatchFactory)
reallyDoQuery( $limit, $offset=false)
Run the query and return the result.
getOrderFields()
Subclasses return an array of fields to order by here.
formatResult( $skin, $result)
getGroupName()
Under which header this special page is listed in Special:SpecialPages See messages 'specialpages-gro...
preprocessResults( $db, $res)
sortDescending()
Override to sort by increasing values.
isSyndicated()
Sometimes we don't want to build rss / atom feeds.
The base class for all skins.