34 parent::__construct(
'Shortpages' );
49 'page_namespace' => array_diff(
50 $this->namespaceInfo->getContentNamespaces(),
53 'page_is_redirect' => 0
56 $options = [
'USE INDEX' => [
'page' =>
'page_redirect_namespace_len' ] ];
59 $this->
getHookRunner()->onShortPagesQuery( $tables, $conds, $joinConds, $options );
64 'namespace' =>
'page_namespace',
65 'title' =>
'page_title',
69 'join_conds' => $joinConds,
76 $fname = static::class .
'::reallyDoQuery';
79 $conds = isset( $query[
'conds'] ) ? (array)$query[
'conds'] : [];
80 $namespaces = $conds[
'page_namespace'];
81 unset( $conds[
'page_namespace'] );
83 if ( count( $namespaces ) === 1 || !$dbr->unionSupportsOrderAndLimit() ) {
89 $sqb = $dbr->newSelectQueryBuilder()
90 ->select( isset( $query[
'fields'] ) ? (array)$query[
'fields'] : [] )
91 ->tables( isset( $query[
'tables'] ) ? (array)$query[
'tables'] : [] )
93 ->options( isset( $query[
'options'] ) ? (array)$query[
'options'] : [] )
94 ->joinConds( isset( $query[
'join_conds'] ) ? (array)$query[
'join_conds'] : [] );
102 $sqb->limit( intval(
$limit ) );
108 foreach ( $order as &$field ) {
113 $uqb = $dbr->newUnionQueryBuilder()->all();
114 foreach ( $namespaces as $namespace ) {
116 $nsSqb->orderBy( $order );
117 $nsSqb->andWhere( [
'page_namespace' => $namespace ] );
122 $uqb->limit( intval(
$limit ) );
125 $uqb->offset( intval(
$offset ) );
131 $uqb->orderBy( $orderBy );
132 return $uqb->caller( $fname )->fetchResultSet();
137 return [
'page_len' ];
159 $title = Title::makeTitleSafe( $result->namespace, $result->title );
161 return Html::element(
'span', [
'class' =>
'mw-invalidtitle' ],
162 Linker::getInvalidTitleDescription( $this->
getContext(), $result->namespace, $result->title ) );
166 $hlink = $linkRenderer->makeKnownLink(
168 $this->
msg(
'hist' )->text(),
170 [
'action' =>
'history' ]
172 $hlinkInParentheses = $this->
msg(
'parentheses' )->rawParams( $hlink )->escaped();
175 $plink = $linkRenderer->makeLink( $title );
176 $exists = $title->exists();
178 $plink = $linkRenderer->makeKnownLink( $title );
183 'dir' => $contentLanguage->getDir(),
184 'lang' => $contentLanguage->getHtmlCode(),
186 $plink = Html::rawElement(
'bdi', $bdiAttrs, $plink );
187 $size = $this->
msg(
'nbytes' )->numParams( $result->value )->escaped();
188 $result =
"{$hlinkInParentheses} {$plink} [{$size}]";
190 return $exists ? $result : Html::rawElement(
'del', [], $result );
195 return 'maintenance';
203class_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()
Factory for LinkBatch objects to batch query page metadata.
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(private readonly NamespaceInfo $namespaceInfo, IConnectionProvider $dbProvider, LinkBatchFactory $linkBatchFactory)
reallyDoQuery( $limit, $offset=false)
Run the query and return the result.to override IResultWrapper 1.18
getOrderFields()
Subclasses return an array of fields to order by here.Don't append DESC to the field names,...
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.to override bool
isSyndicated()
Sometimes we don't want to build rss / atom feeds.to override bool