9use MediaWiki\Cache\LinkBatchFactory;
34 LinkBatchFactory $linkBatchFactory
36 parent::__construct(
'Shortpages' );
37 $this->namespaceInfo = $namespaceInfo;
52 'page_namespace' => array_diff(
53 $this->namespaceInfo->getContentNamespaces(),
56 'page_is_redirect' => 0
59 $options = [
'USE INDEX' => [
'page' =>
'page_redirect_namespace_len' ] ];
62 $this->
getHookRunner()->onShortPagesQuery( $tables, $conds, $joinConds, $options );
67 'namespace' =>
'page_namespace',
68 'title' =>
'page_title',
72 'join_conds' => $joinConds,
79 $fname = static::class .
'::reallyDoQuery';
82 $conds = isset( $query[
'conds'] ) ? (array)$query[
'conds'] : [];
83 $namespaces = $conds[
'page_namespace'];
84 unset( $conds[
'page_namespace'] );
86 if ( count( $namespaces ) === 1 || !$dbr->unionSupportsOrderAndLimit() ) {
92 $sqb = $dbr->newSelectQueryBuilder()
93 ->select( isset( $query[
'fields'] ) ? (array)$query[
'fields'] : [] )
94 ->tables( isset( $query[
'tables'] ) ? (array)$query[
'tables'] : [] )
96 ->options( isset( $query[
'options'] ) ? (array)$query[
'options'] : [] )
97 ->joinConds( isset( $query[
'join_conds'] ) ? (array)$query[
'join_conds'] : [] );
105 $sqb->limit( intval(
$limit ) );
111 foreach ( $order as &$field ) {
116 $uqb = $dbr->newUnionQueryBuilder()->all();
117 foreach ( $namespaces as $namespace ) {
119 $nsSqb->orderBy( $order );
120 $nsSqb->andWhere( [
'page_namespace' => $namespace ] );
125 $uqb->limit( intval(
$limit ) );
128 $uqb->offset( intval(
$offset ) );
134 $uqb->orderBy( $orderBy );
135 return $uqb->caller( $fname )->fetchResultSet();
140 return [
'page_len' ];
162 $title = Title::makeTitleSafe( $result->namespace, $result->title );
164 return Html::element(
'span', [
'class' =>
'mw-invalidtitle' ],
165 Linker::getInvalidTitleDescription( $this->
getContext(), $result->namespace, $result->title ) );
169 $hlink = $linkRenderer->makeKnownLink(
171 $this->
msg(
'hist' )->text(),
173 [
'action' =>
'history' ]
175 $hlinkInParentheses = $this->
msg(
'parentheses' )->rawParams( $hlink )->escaped();
178 $plink = $linkRenderer->makeLink( $title );
179 $exists = $title->exists();
181 $plink = $linkRenderer->makeKnownLink( $title );
186 'dir' => $contentLanguage->getDir(),
187 'lang' => $contentLanguage->getHtmlCode(),
189 $plink = Html::rawElement(
'bdi', $bdiAttrs, $plink );
190 $size = $this->
msg(
'nbytes' )->numParams( $result->value )->escaped();
191 $result =
"{$hlinkInParentheses} {$plink} [{$size}]";
193 return $exists ? $result : Html::rawElement(
'del', [], $result );
198 return 'maintenance';
206class_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.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