| 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 |
class SpecialDeadendPages extends PageQueryPage { |
| 35 |
|
| 36 |
private NamespaceInfo $namespaceInfo; |
| 37 |
|
| 38 |
|
| 39 |
|
| 40 |
|
| 41 |
|
| 42 |
|
| 43 |
|
| 44 |
public function __construct( |
| 45 |
NamespaceInfo $namespaceInfo, |
| 46 |
IConnectionProvider $dbProvider, |
| 47 |
LinkBatchFactory $linkBatchFactory, |
| 48 |
LanguageConverterFactory $languageConverterFactory |
| 49 |
) { |
| 50 |
parent::__construct( 'Deadendpages' ); |
| 51 |
$this->namespaceInfo = $namespaceInfo; |
| 52 |
$this->setDatabaseProvider( $dbProvider ); |
| 53 |
$this->setLinkBatchFactory( $linkBatchFactory ); |
| 54 |
$this->setLanguageConverter( $languageConverterFactory->getLanguageConverter( $this->getContentLanguage() ) ); |
| 55 |
} |
| 56 |
|
| 57 |
protected function getPageHeader() { |
| 58 |
return $this->msg( 'deadendpagestext' )->parseAsBlock(); |
| 59 |
} |
| 60 |
|
| 61 |
|
| 62 |
|
| 63 |
|
| 64 |
|
| 65 |
|
| 66 |
public function isExpensive() { |
| 67 |
return true; |
| 68 |
} |
| 69 |
|
| 70 |
public function isSyndicated() { |
| 71 |
return false; |
| 72 |
} |
| 73 |
|
| 74 |
|
| 75 |
|
| 76 |
|
| 77 |
protected function sortDescending() { |
| 78 |
return false; |
| 79 |
} |
| 80 |
|
| 81 |
public function getQueryInfo() { |
| 82 |
return [ |
| 83 |
'tables' => [ 'page', 'pagelinks' ], |
| 84 |
'fields' => [ |
| 85 |
'namespace' => 'page_namespace', |
| 86 |
'title' => 'page_title', |
| 87 |
], |
| 88 |
'conds' => [ |
| 89 |
'pl_from' => null, |
| 90 |
'page_namespace' => $this->namespaceInfo->getContentNamespaces(), |
| 91 |
'page_is_redirect' => 0 |
| 92 |
], |
| 93 |
'join_conds' => [ |
| 94 |
'pagelinks' => [ |
| 95 |
'LEFT JOIN', |
| 96 |
[ 'page_id=pl_from' ] |
| 97 |
] |
| 98 |
] |
| 99 |
]; |
| 100 |
} |
| 101 |
|
| 102 |
protected function getOrderFields() { |
| 103 |
|
| 104 |
|
| 105 |
if ( count( $this->namespaceInfo->getContentNamespaces() ) > 1 ) { |
| 106 |
return [ 'page_namespace', 'page_title' ]; |
| 107 |
} else { |
| 108 |
return [ 'page_title' ]; |
| 109 |
} |
| 110 |
} |
| 111 |
|
| 112 |
protected function getGroupName() { |
| 113 |
return 'maintenance'; |
| 114 |
} |
| 115 |
} |
| 116 |
|
| 117 |
|
| 118 |
class_alias( SpecialDeadendPages::class, 'SpecialDeadendPages' ); |