diff --git a/app/Http/Controllers/BuildController.php b/app/Http/Controllers/BuildController.php index d0f13a9b38..7cb3f4042c 100644 --- a/app/Http/Controllers/BuildController.php +++ b/app/Http/Controllers/BuildController.php @@ -18,7 +18,6 @@ use CDash\Model\BuildGroupRule; use CDash\Model\BuildRelationship; use Illuminate\Http\JsonResponse; -use Illuminate\Http\RedirectResponse; use Illuminate\Http\Request; use Illuminate\Support\Carbon; use Illuminate\Support\Facades\Auth; @@ -534,93 +533,6 @@ public function apiBuildSummary(): JsonResponse return response()->json(cast_data_for_JSON($response)); } - /** - * TODO: (williamjallen) this function contains legacy XSL templating and should be converted - * to a proper Blade template with Laravel-based DB queries eventually. This contents - * this function are originally from buildOverview.php and have been copied (almost) as-is. - */ - public function buildOverview(): View|RedirectResponse - { - $this->setProjectByName(htmlspecialchars($_GET['project'] ?? '')); - - $date = htmlspecialchars($_GET['date'] ?? ''); - - // We select the builds - $currentstarttime = get_dates($date, $this->project->NightlyTime)[1]; - - // Return the available groups - $selected_group = (int) ($_POST['groupSelection'] ?? 0); - - // Check the builds - $beginning_timestamp = $currentstarttime; - $end_timestamp = $currentstarttime + 3600 * 24; - - $beginning_UTCDate = gmdate(FMT_DATETIME, $beginning_timestamp); - $end_UTCDate = gmdate(FMT_DATETIME, $end_timestamp); - - $groupSelectionSQL = ''; - $params = []; - if ($selected_group > 0) { - $groupSelectionSQL = ' AND b2g.groupid=? '; - $params[] = $selected_group; - } - - $builds = DB::select(" - SELECT - s.name AS sitename, - b.name AS buildname, - be.type, - be.sourcefile, - be.sourceline, - be.stderror as text - FROM - build AS b, - builderror as be, - site AS s, - build2group AS b2g - WHERE - b.starttime - AND b.starttime>? - AND b.projectid=? - AND be.buildid=b.id - AND s.id=b.siteid - AND b2g.buildid=b.id - $groupSelectionSQL - ORDER BY - be.sourcefile ASC, - be.type ASC, - be.sourceline ASC - ", array_merge([$end_UTCDate, $beginning_UTCDate, $this->project->Id], $params)); - - $sourcefiles = []; - - // NOTE: Query results are already ordered by sourcefile... - foreach ($builds as $build_array) { - $filename = $build_array->sourcefile; - - if (!isset($sourcefiles[$filename])) { - $sourcefiles[$filename] = [ - 'name' => $filename, - 'errors' => [], - 'warnings' => [], - ]; - } - - $type = (int) $build_array->type === 0 ? 'errors' : 'warnings'; - $sourcefiles[$filename][$type][] = [ - 'line' => (int) $build_array->sourceline, - 'sitename' => $build_array->sitename, - 'buildname' => $build_array->buildname, - 'text' => $build_array->text, - ]; - } - - return $this->view('build.overview', 'Build Overview') - ->with('selected_group', $selected_group) - ->with('sourcefiles', $sourcefiles) - ->with('startdate', date('l, F d Y H:i:s', $currentstarttime)); - } - public function viewUpdatePageContent(): JsonResponse { $pageTimer = new PageTimer(); diff --git a/app/cdash/tests/CMakeLists.txt b/app/cdash/tests/CMakeLists.txt index 51879b900f..20db172bb7 100644 --- a/app/cdash/tests/CMakeLists.txt +++ b/app/cdash/tests/CMakeLists.txt @@ -541,11 +541,8 @@ set_tests_properties(buildconfigure PROPERTIES DEPENDS aggregatecoverage) add_php_test(buildgrouprule) set_tests_properties(buildgrouprule PROPERTIES DEPENDS buildconfigure) -add_php_test(buildoverview) -set_tests_properties(buildoverview PROPERTIES DEPENDS buildgrouprule) - add_php_test(committerinfo) -set_tests_properties(committerinfo PROPERTIES DEPENDS buildoverview) +set_tests_properties(committerinfo PROPERTIES DEPENDS buildgrouprule) add_php_test(displayimage) set_tests_properties(displayimage PROPERTIES DEPENDS committerinfo) diff --git a/app/cdash/tests/test_buildoverview.php b/app/cdash/tests/test_buildoverview.php deleted file mode 100644 index 565e3f05d2..0000000000 --- a/app/cdash/tests/test_buildoverview.php +++ /dev/null @@ -1,31 +0,0 @@ -login(); - $this->get($this->url . '/buildOverview.php'); - if (!str_contains($this->getBrowser()->getContentAsText(), 'You do not have access to the requested project or the requested project does not exist.')) { - $this->fail("'Project not specified' not found when expected"); - return 1; - } - $this->get($this->url . '/buildOverview.php?project=InsightExample'); - if (!str_contains($this->getBrowser()->getContentAsText(), 'Build summary')) { - $this->fail("'Build summary' not found when expected"); - return 1; - } - $this->pass('Passed'); - } -} diff --git a/phpstan-baseline.neon b/phpstan-baseline.neon index 1fecd41ae6..c119ee49e1 100644 --- a/phpstan-baseline.neon +++ b/phpstan-baseline.neon @@ -705,7 +705,7 @@ parameters: - rawMessage: Cannot cast mixed to int. identifier: cast.int - count: 11 + count: 10 path: app/Http/Controllers/BuildController.php - @@ -756,12 +756,6 @@ parameters: count: 1 path: app/Http/Controllers/BuildController.php - - - rawMessage: 'Method App\Http\Controllers\BuildController::buildOverview() never returns Illuminate\Http\RedirectResponse so it can be removed from the return type.' - identifier: return.unusedType - count: 1 - path: app/Http/Controllers/BuildController.php - - rawMessage: 'Only numeric types are allowed in *, (int|false) given on the left side.' identifier: mul.leftNonNumeric @@ -816,12 +810,6 @@ parameters: count: 4 path: app/Http/Controllers/BuildController.php - - - rawMessage: 'Parameter #1 $string of function htmlspecialchars expects string, mixed given.' - identifier: argument.type - count: 2 - path: app/Http/Controllers/BuildController.php - - rawMessage: 'Parameter #1 $value of function count expects array|Countable, array|false given.' identifier: argument.type @@ -834,12 +822,6 @@ parameters: count: 11 path: app/Http/Controllers/BuildController.php - - - rawMessage: 'Parameter #2 $timestamp of function gmdate expects int|null, (float|int) given.' - identifier: argument.type - count: 1 - path: app/Http/Controllers/BuildController.php - - rawMessage: 'Parameter #3 $length of function substr expects int|null, int|false given.' identifier: argument.type @@ -18372,18 +18354,6 @@ parameters: count: 1 path: app/cdash/tests/test_buildmodel.php - - - rawMessage: 'Call to deprecated method pass() of class SimpleTestCase.' - identifier: method.deprecated - count: 1 - path: app/cdash/tests/test_buildoverview.php - - - - rawMessage: 'Method BuildOverviewTestCase::testBuildOverview() has no return type specified.' - identifier: missingType.return - count: 1 - path: app/cdash/tests/test_buildoverview.php - - rawMessage: ''' Call to deprecated function pdo_execute(): diff --git a/resources/views/build/overview.blade.php b/resources/views/build/overview.blade.php deleted file mode 100644 index 4bb5ead7f2..0000000000 --- a/resources/views/build/overview.blade.php +++ /dev/null @@ -1,54 +0,0 @@ -@use(App\Services\ProjectService) - -@extends('cdash', [ - 'title' => 'Build Overview' -]) - -@section('main_content') -
{{ $error['text'] }}
- @endforeach
- @endif
-
- {{-- Warnings --}}
- @if(count($sourcefile['warnings']) > 0)
- {{ $warning['text'] }}
- @endforeach
- @endif
-