Debian Codegraph @

includes/registration/ExtensionDependencyError.php

raw symbols SCIP
1 <?php
2 /**
3 * This program is free software; you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License as published by
5 * the Free Software Foundation; either version 2 of the License, or
6 * (at your option) any later version.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License along
14 * with this program; if not, write to the Free Software Foundation, Inc.,
15 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
16 *
17 * @file
18 */
19
20 namespace MediaWiki\Registration;
21
22 use Exception;
23
24 /**
25 * @newable
26 * @since 1.31
27 * @ingroup ExtensionRegistry
28 * @author Kunal Mehta <[email protected]>
29 */
30 class ExtensionDependencyError extends Exception {
31
32 /**
33 * @var string[]
34 */
35 public $missingExtensions = [];
36
37 /**
38 * @var string[]
39 */
40 public $missingSkins = [];
41
42 /**
43 * @var string[]
44 */
45 public $incompatibleExtensions = [];
46
47 /**
48 * @var string[]
49 */
50 public $incompatibleSkins = [];
51
52 /**
53 * @var bool
54 */
55 public $incompatibleCore = false;
56
57 /**
58 * @var bool
59 */
60 public $incompatiblePhp = false;
61
62 /**
63 * @var string[]
64 */
65 public $missingPhpExtensions = [];
66
67 /**
68 * @var string[]
69 */
70 public $missingAbilities = [];
71
72 /**
73 * @param array[] $errors Each error has a 'msg' and 'type' key at minimum
74 */
75 public function __construct( array $errors ) {
76 $msg = '';
77 foreach ( $errors as $info ) {
78 $msg .= $info['msg'] . "\n";
79 switch ( $info['type'] ) {
80 case 'incompatible-core':
81 $this->incompatibleCore = true;
82 break;
83 case 'incompatible-php':
84 $this->incompatiblePhp = true;
85 break;
86 case 'missing-phpExtension':
87 $this->missingPhpExtensions[] = $info['missing'];
88 break;
89 case 'missing-ability':
90 $this->missingAbilities[] = $info['missing'];
91 break;
92 case 'missing-skins':
93 $this->missingSkins[] = $info['missing'];
94 break;
95 case 'missing-extensions':
96 $this->missingExtensions[] = $info['missing'];
97 break;
98 case 'incompatible-skins':
99 $this->incompatibleSkins[] = $info['incompatible'];
100 break;
101 case 'incompatible-extensions':
102 $this->incompatibleExtensions[] = $info['incompatible'];
103 break;
104 // default: continue
105 }
106 }
107
108 parent::__construct( $msg );
109 }
110
111 }
112
113 /** @deprecated class alias since 1.43 */
114 class_alias( ExtensionDependencyError::class, 'ExtensionDependencyError' );