| 1 |
<?php |
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
|
| 17 |
|
| 18 |
|
| 19 |
|
| 20 |
|
| 21 |
namespace MediaWiki\Specials; |
| 22 |
|
| 23 |
use MediaWiki\Cache\LinkBatchFactory; |
| 24 |
use MediaWiki\Languages\LanguageConverterFactory; |
| 25 |
use MediaWiki\SpecialPage\PageQueryPage; |
| 26 |
use MediaWiki\Title\NamespaceInfo; |
| 27 |
use Wikimedia\Rdbms\IConnectionProvider; |
| 28 |
|
| 29 |
|
| 30 |
|
| 31 |
|
| 32 |
|
| 33 |
|
| 34 |
|
| 35 |
|
| 36 |
class SpecialUncategorizedPages extends PageQueryPage { |
| 37 |
|
| 38 |
protected $requestedNamespace = false; |
| 39 |
|
| 40 |
private NamespaceInfo $namespaceInfo; |
| 41 |
|
| 42 |
|
| 43 |
|
| 44 |
|
| 45 |
|
| 46 |
|
| 47 |
|
| 48 |
public function __construct( |
| 49 |
NamespaceInfo $namespaceInfo, |
| 50 |
IConnectionProvider $dbProvider, |
| 51 |
LinkBatchFactory $linkBatchFactory, |
| 52 |
LanguageConverterFactory $languageConverterFactory |
| 53 |
) { |
| 54 |
parent::__construct( 'Uncategorizedpages' ); |
| 55 |
$this->namespaceInfo = $namespaceInfo; |
| 56 |
$this->setDatabaseProvider( $dbProvider ); |
| 57 |
$this->setLinkBatchFactory( $linkBatchFactory ); |
| 58 |
$this->setLanguageConverter( $languageConverterFactory->getLanguageConverter( $this->getContentLanguage() ) ); |
| 59 |
} |
| 60 |
|
| 61 |
protected function sortDescending() { |
| 62 |
return false; |
| 63 |
} |
| 64 |
|
| 65 |
public function isExpensive() { |
| 66 |
return true; |
| 67 |
} |
| 68 |
|
| 69 |
public function isSyndicated() { |
| 70 |
return false; |
| 71 |
} |
| 72 |
|
| 73 |
public function execute( $par ) { |
| 74 |
$this->addHelpLink( 'Help:Categories' ); |
| 75 |
parent::execute( $par ); |
| 76 |
} |
| 77 |
|
| 78 |
public function getQueryInfo() { |
| 79 |
return [ |
| 80 |
'tables' => [ 'page', 'categorylinks' ], |
| 81 |
'fields' => [ |
| 82 |
'namespace' => 'page_namespace', |
| 83 |
'title' => 'page_title', |
| 84 |
], |
| 85 |
|
| 86 |
|
| 87 |
'conds' => [ |
| 88 |
'cl_from' => null, |
| 89 |
'page_namespace' => $this->requestedNamespace !== false |
| 90 |
? $this->requestedNamespace |
| 91 |
: $this->namespaceInfo->getContentNamespaces(), |
| 92 |
'page_is_redirect' => 0 |
| 93 |
], |
| 94 |
'join_conds' => [ |
| 95 |
'categorylinks' => [ 'LEFT JOIN', 'cl_from = page_id' ] |
| 96 |
] |
| 97 |
]; |
| 98 |
} |
| 99 |
|
| 100 |
protected function getOrderFields() { |
| 101 |
|
| 102 |
|
| 103 |
if ( $this->requestedNamespace === false && |
| 104 |
count( $this->namespaceInfo->getContentNamespaces() ) > 1 |
| 105 |
) { |
| 106 |
return [ 'page_namespace', 'page_title' ]; |
| 107 |
} |
| 108 |
|
| 109 |
return [ 'page_title' ]; |
| 110 |
} |
| 111 |
|
| 112 |
protected function getGroupName() { |
| 113 |
return 'maintenance'; |
| 114 |
} |
| 115 |
} |
| 116 |
|
| 117 |
|
| 118 |
|
| 119 |
|
| 120 |
|
| 121 |
class_alias( SpecialUncategorizedPages::class, 'SpecialUncategorizedPages' ); |