Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
Total | |
0.00% |
0 / 18 |
|
0.00% |
0 / 5 |
CRAP | |
0.00% |
0 / 1 |
SpecialRepoAdmin | |
0.00% |
0 / 18 |
|
0.00% |
0 / 5 |
72 | |
0.00% |
0 / 1 |
__construct | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
doesWrites | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
getSubpagesForPrefixSearch | |
0.00% |
0 / 8 |
|
0.00% |
0 / 1 |
12 | |||
execute | |
0.00% |
0 / 7 |
|
0.00% |
0 / 1 |
6 | |||
getGroupName | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 |
1 | <?php |
2 | |
3 | namespace MediaWiki\Extension\CodeReview\UI; |
4 | |
5 | use MediaWiki\Extension\CodeReview\Backend\CodeRepository; |
6 | use SpecialPage; |
7 | |
8 | /** |
9 | * Repository administration |
10 | */ |
11 | class SpecialRepoAdmin extends SpecialPage { |
12 | public function __construct() { |
13 | parent::__construct( 'RepoAdmin', 'repoadmin' ); |
14 | } |
15 | |
16 | public function doesWrites() { |
17 | return true; |
18 | } |
19 | |
20 | /** |
21 | * Return an array of subpages that this special page will accept. |
22 | * |
23 | * @return string[] subpages |
24 | */ |
25 | public function getSubpagesForPrefixSearch() { |
26 | $repos = CodeRepository::getRepoList(); |
27 | if ( count( $repos ) ) { |
28 | $retVal = []; |
29 | foreach ( $repos as $repo ) { |
30 | $retVal[] = $repo->getName(); |
31 | } |
32 | sort( $retVal ); |
33 | return $retVal; |
34 | } |
35 | return []; |
36 | } |
37 | |
38 | /** |
39 | * @param string $subpage |
40 | */ |
41 | public function execute( $subpage ) { |
42 | $this->setHeaders(); |
43 | |
44 | $this->checkPermissions(); |
45 | |
46 | $repo = $this->getRequest()->getVal( 'repo', $subpage ); |
47 | if ( $repo == '' ) { |
48 | $view = new RepoAdminListView( $this->getPageTitle() ); |
49 | } else { |
50 | $view = new RepoAdminRepoView( $this->getPageTitle( $repo ), $repo, $this->getUser() ); |
51 | } |
52 | $view->execute(); |
53 | } |
54 | |
55 | protected function getGroupName() { |
56 | return 'developer'; |
57 | } |
58 | } |