Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Delete unused buildgroup.php GET endpoint #1679

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
58 changes: 2 additions & 56 deletions app/cdash/public/api/v1/buildgroup.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,12 @@
namespace CDash\Api\v1\BuildGroup;

require_once 'include/api_common.php';
require_once 'include/version.php';

use App\Services\PageTimer;
use CDash\Model\Build;
use CDash\Model\BuildGroup;
use CDash\Model\BuildGroupRule;
use App\Models\Site;
use Symfony\Component\HttpFoundation\Response;

// Require administrative access to view this page.
init_api_request();
Expand Down Expand Up @@ -53,61 +52,8 @@
case 'PUT':
rest_put($projectid);
break;
case 'GET':
default:
rest_get($pdo, $projectid);
break;
}

/** Handle GET requests */
function rest_get($pdo, $projectid)
{
if (!isset($_GET['buildgroupid'])) {
abort(400, 'buildgroupid not specified');
}
$buildgroupid = pdo_real_escape_numeric($_GET['buildgroupid']);

$pageTimer = new PageTimer();
$response = begin_JSON_response();
$response['projectid'] = $projectid;
$response['buildgroupid'] = $buildgroupid;

$BuildGroup = new BuildGroup();
$BuildGroup->SetId($buildgroupid);
$response['name'] = $BuildGroup->GetName();
$response['group'] = $BuildGroup->GetGroupId();

$stmt = $pdo->prepare(
"SELECT id, name FROM buildgroup
WHERE projectid = ? AND endtime = '1980-01-01 00:00:00'");
pdo_execute($stmt, [$projectid]);

$dependencies = $BuildGroup->GetDependencies();
$dependencies_response = [];
$available_dependencies_response = [];

while ($row = $stmt->fetch()) {
if ($row['id'] == $buildgroupid) {
continue;
}
if (is_array($dependencies) && in_array($row['id'], $dependencies)) {
$dep = [];
$dep['id'] = $row['id'];
$dep['name'] = $row['name'];
$dependencies_response[] = $dep;
} else {
$avail = [];
$avail['id'] = $row['id'];
$avail['name'] = $row['name'];
$available_dependencies_response[] = $avail;
}
}

$response['dependencies'] = $dependencies_response;
$response['available_dependencies'] = $available_dependencies_response;

$pageTimer->end($response);
echo json_encode(cast_data_for_JSON($response));
abort(Response::HTTP_NOT_IMPLEMENTED);
}

/** Handle DELETE requests */
Expand Down
36 changes: 3 additions & 33 deletions phpstan-baseline.neon
Original file line number Diff line number Diff line change
Expand Up @@ -15883,16 +15883,6 @@ parameters:
count: 1
path: app/cdash/public/api/v1/build.php

-
message: "#^Call to an undefined method CDash\\\\Model\\\\BuildGroup\\:\\:GetDependencies\\(\\)\\.$#"
count: 1
path: app/cdash/public/api/v1/buildgroup.php

-
message: "#^Call to an undefined method CDash\\\\Model\\\\BuildGroup\\:\\:GetGroupId\\(\\)\\.$#"
count: 1
path: app/cdash/public/api/v1/buildgroup.php

-
message: """
#^Call to deprecated function get_link_identifier\\(\\)\\:
Expand All @@ -15906,15 +15896,15 @@ parameters:
#^Call to deprecated function pdo_execute\\(\\)\\:
v2\\.5\\.0 01/22/2018$#
"""
count: 4
count: 3
path: app/cdash/public/api/v1/buildgroup.php

-
message: """
#^Call to deprecated function pdo_real_escape_numeric\\(\\)\\:
04/01/2023$#
"""
count: 10
count: 9
path: app/cdash/public/api/v1/buildgroup.php

-
Expand All @@ -15933,11 +15923,6 @@ parameters:
count: 1
path: app/cdash/public/api/v1/buildgroup.php

-
message: "#^Call to function in_array\\(\\) requires parameter \\#3 to be set\\.$#"
count: 1
path: app/cdash/public/api/v1/buildgroup.php

-
message: "#^Construct empty\\(\\) is not allowed\\. Use more strict comparison\\.$#"
count: 6
Expand All @@ -15958,21 +15943,6 @@ parameters:
count: 1
path: app/cdash/public/api/v1/buildgroup.php

-
message: "#^Function CDash\\\\Api\\\\v1\\\\BuildGroup\\\\rest_get\\(\\) has no return type specified\\.$#"
count: 1
path: app/cdash/public/api/v1/buildgroup.php

-
message: "#^Function CDash\\\\Api\\\\v1\\\\BuildGroup\\\\rest_get\\(\\) has parameter \\$pdo with no type specified\\.$#"
count: 1
path: app/cdash/public/api/v1/buildgroup.php

-
message: "#^Function CDash\\\\Api\\\\v1\\\\BuildGroup\\\\rest_get\\(\\) has parameter \\$projectid with no type specified\\.$#"
count: 1
path: app/cdash/public/api/v1/buildgroup.php

-
message: "#^Function CDash\\\\Api\\\\v1\\\\BuildGroup\\\\rest_post\\(\\) has no return type specified\\.$#"
count: 1
Expand Down Expand Up @@ -16000,7 +15970,7 @@ parameters:

-
message: "#^Loose comparison via \"\\=\\=\" is not allowed\\.$#"
count: 5
count: 4
path: app/cdash/public/api/v1/buildgroup.php

-
Expand Down