File tree 3 files changed +27
-12
lines changed 3 files changed +27
-12
lines changed Original file line number Diff line number Diff line change @@ -227,6 +227,20 @@ public function getQuickCreateURI() {
227
227
228
228
/* -( Application Management )--------------------------------------------- */
229
229
230
+ public static function getByClass ($ class_name ) {
231
+
232
+ $ selected = null ;
233
+ $ applications = PhabricatorApplication::getAllApplications ();
234
+
235
+ foreach ($ applications as $ application ) {
236
+ if (get_class ($ application ) == $ class_name ) {
237
+ $ selected = $ application ;
238
+ break ;
239
+ }
240
+ }
241
+ return $ selected ;
242
+ }
243
+
230
244
public static function getAllApplications () {
231
245
232
246
$ classes = id (new PhutilSymbolLoader ())
Original file line number Diff line number Diff line change @@ -13,15 +13,7 @@ public function processRequest() {
13
13
$ request = $ this ->getRequest ();
14
14
$ user = $ request ->getUser ();
15
15
16
- $ selected = null ;
17
- $ applications = PhabricatorApplication::getAllApplications ();
18
-
19
- foreach ($ applications as $ application ) {
20
- if (get_class ($ application ) == $ this ->application ) {
21
- $ selected = $ application ;
22
- break ;
23
- }
24
- }
16
+ $ selected = PhabricatorApplication::getByClass ($ this ->application );
25
17
26
18
if (!$ selected ) {
27
19
return new Aphront404Response ();
Original file line number Diff line number Diff line change @@ -14,7 +14,12 @@ public function willProcessRequest(array $data) {
14
14
public function processRequest () {
15
15
$ request = $ this ->getRequest ();
16
16
$ user = $ request ->getUser ();
17
- $ app_name = substr ($ this ->application , strlen ('PhabricatorApplication ' ));
17
+
18
+ $ selected = PhabricatorApplication::getByClass ($ this ->application );
19
+
20
+ if (!$ selected ) {
21
+ return new Aphront404Response ();
22
+ }
18
23
19
24
if ($ request ->isDialogFormPost ()) {
20
25
$ this ->manageApplication ();
@@ -26,14 +31,18 @@ public function processRequest() {
26
31
$ dialog = id (new AphrontDialogView ())
27
32
->setUser ($ user )
28
33
->setTitle ('Confirmation ' )
29
- ->appendChild ('Install ' . $ app_name . ' application ? ' )
34
+ ->appendChild (
35
+ 'Install ' . $ selected ->getName (). ' application ? '
36
+ )
30
37
->addSubmitButton ('Install ' )
31
38
->addCancelButton ('/applications/view/ ' .$ this ->application );
32
39
} else {
33
40
$ dialog = id (new AphrontDialogView ())
34
41
->setUser ($ user )
35
42
->setTitle ('Confirmation ' )
36
- ->appendChild ('Really Uninstall ' . $ app_name . ' application ? ' )
43
+ ->appendChild (
44
+ 'Really Uninstall ' . $ selected ->getName (). ' application ? '
45
+ )
37
46
->addSubmitButton ('Uninstall ' )
38
47
->addCancelButton ('/applications/view/ ' .$ this ->application );
39
48
}
You can’t perform that action at this time.
0 commit comments