@@ -9,6 +9,12 @@ class FetchApiCommand extends AbstractApiCommand
9
9
public function execute ($ content )
10
10
{
11
11
$ content = $ this ->setDefault ($ content );
12
+ $ filename = $ content ['library ' ];
13
+
14
+ $ last_slash = strrpos ($ content ['library ' ], "/ " );
15
+ if ($ last_slash !== false ) {
16
+ $ filename = substr ($ content ['library ' ], $ last_slash + 1 );
17
+ }
12
18
13
19
$ apiHandler = $ this ->container ->get ('codebender_library.apiHandler ' );
14
20
@@ -18,13 +24,6 @@ public function execute($content)
18
24
$ finder = new Finder ();
19
25
$ exampleFinder = new Finder ();
20
26
21
- $ filename = $ content ['library ' ];
22
-
23
- $ last_slash = strrpos ($ content ['library ' ], "/ " );
24
- if ($ last_slash !== false ) {
25
- $ filename = substr ($ content ['library ' ], $ last_slash + 1 );
26
- }
27
-
28
27
//TODO handle the case of different .h filenames and folder names
29
28
$ reservedNames = ["ArduinoRobot " => "Robot_Control " , "ArduinoRobotMotorBoard " => "Robot_Motor " ,
30
29
"BlynkSimpleSerial " => "BlynkSimpleEthernet " , "BlynkSimpleCC3000 " => "BlynkSimpleEthernet " ];
@@ -40,7 +39,7 @@ public function execute($content)
40
39
$ meta = [];
41
40
}
42
41
} else {
43
- if (!$ apiHandler ->isExternalLibrary ($ filename )) {
42
+ if (!$ apiHandler ->isExternalLibrary ($ filename, $ content [ ' disabled ' ] )) {
44
43
return ["success " => false , "message " => "No Library named " . $ filename . " found. " ];
45
44
}
46
45
@@ -74,6 +73,7 @@ public function execute($content)
74
73
75
74
private function setDefault ($ content )
76
75
{
76
+ $ content ['disabled ' ] = (array_key_exists ('disabled ' , $ content ) ? $ content ['disabled ' ] : false );
77
77
$ content ['version ' ] = (array_key_exists ('version ' , $ content ) ? $ content ['version ' ] : null );
78
78
$ content ['renderView ' ] = (array_key_exists ('renderView ' , $ content ) ? $ content ['renderView ' ] : false );
79
79
return $ content ;
0 commit comments