Skip to content

Commit ca951cd

Browse files
Remove deprecated /api/v1/viewDynamicAnalysisFile.php endpoint (#3624)
1 parent 76ddf59 commit ca951cd

File tree

4 files changed

+1
-80
lines changed

4 files changed

+1
-80
lines changed

app/Http/Controllers/DynamicAnalysisController.php

Lines changed: 0 additions & 65 deletions
Original file line numberDiff line numberDiff line change
@@ -179,71 +179,6 @@ public function apiViewDynamicAnalysis(): JsonResponse
179179
return response()->json(cast_data_for_JSON($response));
180180
}
181181

182-
public function apiViewDynamicAnalysisFile(): JsonResponse
183-
{
184-
$pageTimer = new PageTimer();
185-
186-
// Make sure a valid id was specified.
187-
if (!isset($_GET['id']) || !is_numeric($_GET['id'])) {
188-
abort(400, 'Not a valid id!');
189-
}
190-
$id = $_GET['id'];
191-
$DA = new DynamicAnalysis();
192-
$DA->Id = $id;
193-
if (!$DA->Fill()) {
194-
abort(400, 'Not a valid id!');
195-
}
196-
197-
// Get the build associated with this analysis.
198-
$this->setBuildById($DA->BuildId);
199-
200-
$date = TestingDay::get($this->project, $this->build->StartTime);
201-
$response = begin_JSON_response();
202-
get_dashboard_JSON($this->project->Name, $date, $response);
203-
$response['title'] = "{$this->project->Name} - Dynamic Analysis";
204-
205-
// Build
206-
$build_response = [];
207-
$build_response['site'] = $this->build->GetSite()->name;
208-
$build_response['buildname'] = $this->build->Name;
209-
$build_response['buildid'] = $this->build->Id;
210-
$build_response['buildtime'] = $this->build->StartTime;
211-
$response['build'] = $build_response;
212-
213-
// Menu
214-
$menu_response = [];
215-
$menu_response['back'] = "/builds/{$this->build->Id}/dynamic_analysis";
216-
$previous_id = $DA->GetPreviousId($this->build);
217-
if ($previous_id > 0) {
218-
$menu_response['previous'] = "viewDynamicAnalysisFile.php?id=$previous_id";
219-
} else {
220-
$menu_response['previous'] = false;
221-
}
222-
$current_id = $DA->GetLastId($this->build);
223-
$menu_response['current'] = "viewDynamicAnalysisFile.php?id=$current_id";
224-
$next_id = $DA->GetNextId($this->build);
225-
if ($next_id > 0) {
226-
$menu_response['next'] = "viewDynamicAnalysisFile.php?id=$next_id";
227-
} else {
228-
$menu_response['next'] = false;
229-
}
230-
$response['menu'] = $menu_response;
231-
232-
// dynamic analysis
233-
$DA_response = [];
234-
$DA_response['status'] = ucfirst($DA->Status);
235-
$DA_response['filename'] = $DA->Name;
236-
// Only display the first 1MB of the log (in case it's huge)
237-
$DA_response['log'] = substr($DA->Log, 0, 1024 * 1024);
238-
$DA_response['href'] = "queryTests.php?project={$this->project->Name}&filtercount=1&showfilters=1&field1=testname&compare1=61&value1={$DA->Name}&date={$this->date}";
239-
$response['dynamicanalysis'] = $DA_response;
240-
241-
$response['deprecated'] = 'This endpoint will be removed in the next major version of CDash.';
242-
243-
$pageTimer->end($response);
244-
return response()->json(cast_data_for_JSON($response));
245-
}
246-
247182
/**
248183
* Get the previous build id dynamicanalysis
249184
*/

app/cdash/tests/test_viewdynamicanalysisfile.php

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -18,13 +18,6 @@ public function __construct()
1818
parent::__construct();
1919
}
2020

21-
public function testViewDynamicAnalysisFile(): void
22-
{
23-
$response = $this->get($this->url . '/api/v1/viewDynamicAnalysisFile.php?id=1');
24-
$response = json_decode($response);
25-
$this->assertTrue(property_exists($response, 'dynamicanalysis'));
26-
}
27-
2821
public function testNextPrevious(): void
2922
{
3023
// Get id of existing build.

phpstan-baseline.neon

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1140,7 +1140,7 @@ parameters:
11401140
-
11411141
rawMessage: Cannot access property $name on App\Models\Site|null.
11421142
identifier: property.nonObject
1143-
count: 2
1143+
count: 1
11441144
path: app/Http/Controllers/DynamicAnalysisController.php
11451145

11461146
-
@@ -25134,12 +25134,6 @@ parameters:
2513425134
count: 1
2513525135
path: app/cdash/tests/test_viewdynamicanalysisfile.php
2513625136

25137-
-
25138-
rawMessage: 'Parameter #1 $object_or_class of function property_exists expects object|string, mixed given.'
25139-
identifier: argument.type
25140-
count: 1
25141-
path: app/cdash/tests/test_viewdynamicanalysisfile.php
25142-
2514325137
-
2514425138
rawMessage: 'Parameter #1 $stmt of function pdo_execute expects PDOStatement, (PDOStatement|false) given.'
2514525139
identifier: argument.type

routes/api.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,6 @@
3636
Route::get('/v1/getSubProjectDependencies.php', 'SubProjectController@apiDependenciesGraph');
3737

3838
Route::get('/v1/viewDynamicAnalysis.php', 'DynamicAnalysisController@apiViewDynamicAnalysis');
39-
Route::get('/v1/viewDynamicAnalysisFile.php', 'DynamicAnalysisController@apiViewDynamicAnalysisFile');
4039

4140
Route::get('/v1/buildProperties.php', 'BuildPropertiesController@apiBuildProperties');
4241

0 commit comments

Comments
 (0)