2declare( strict_types = 1 );
4namespace MediaWiki\Extension\Translate\PageTranslation;
6use MediaWiki\Context\IContextSource;
7use MediaWiki\Hook\LonelyPagesQueryHook;
8use MediaWiki\Hook\SpecialPrefixIndexGetFormFiltersHook;
9use MediaWiki\Hook\SpecialPrefixIndexQueryHook;
10use MediaWiki\Hook\SpecialWhatLinksHereQueryHook;
11use MediaWiki\HTMLForm\Field\HTMLCheckField;
12use MediaWiki\SpecialPage\Hook\SpecialPageBeforeFormDisplayHook;
13use Wikimedia\Rdbms\SelectQueryBuilder;
16 SpecialPrefixIndexGetFormFiltersHook,
17 SpecialPrefixIndexQueryHook,
19 SpecialPageBeforeFormDisplayHook,
20 SpecialWhatLinksHereQueryHook
24 $filters[
'translate-hidetranslations' ] = [
25 'class' => HTMLCheckField::class,
26 'name' =>
'translate-hidetranslations',
27 'label-message' =>
'translate-hidetranslations',
33 if ( $fieldData[
'translate-hidetranslations' ] ===
true ) {
34 $queryBuilder->leftJoin(
38 'translate_pp.pp_page=page_id',
39 'translate_pp.pp_propname' =>
'translate-is-translation'
41 )->andWhere( [
'translate_pp.pp_value' =>
null ] );
47 $tables[
'translate_pp' ] =
'page_props';
48 $joinConds[
'translate_pp'] = [
50 'translate_pp.pp_page=page_id',
51 'translate_pp.pp_propname' =>
'translate-is-translation'
54 $conds[
'translate_pp.pp_value'] =
null;
60 if ( $name ===
'Whatlinkshere' ) {
62 'translate-hidetranslations' => [
64 'name' =>
'translate-hidetranslations',
65 'label-message' =>
'translate-hidetranslations',
66 'section' =>
'whatlinkshere-filter',
75 $isSupportedTable = in_array( $table, [
'pagelinks',
'templatelinks',
'imagelinks' ] );
77 if ( $data[
'translate-hidetranslations' ] && $isSupportedTable ) {
78 $queryBuilder->leftJoin(
82 'translate_pp.pp_page=page_id',
83 'translate_pp.pp_propname' =>
'translate-is-translation',
86 ->andWhere( [
'translate_pp.pp_value' =>
null ] );
onSpecialPrefixIndexQuery(array $fieldData, SelectQueryBuilder $queryBuilder)
@inheritDoc
onLonelyPagesQuery(&$tables, &$conds, &$joinConds)
@inheritDoc
onSpecialPageBeforeFormDisplay( $name, $form)
@inheritDoc
onSpecialWhatLinksHereQuery( $table, $data, $queryBuilder)
@inheritDoc
onSpecialPrefixIndexGetFormFilters(IContextSource $contextSource, array &$filters)
@inheritDoc