From ea982715735577fef741bd4de857c526f48dc857 Mon Sep 17 00:00:00 2001
From: William Allen <16820599+williamjallen@users.noreply.github.com>
Date: Fri, 7 Feb 2025 13:12:30 -0500
Subject: [PATCH] Remove `dailyupdatefile` table (#2703)
The `dailyupdatefile` table is currently only used to display a list of
users who have committed to the project recently but don't have a CDash
account. As we rethink what it means for CDash to be integrated with
version control systems, it seems unlikely that we will want CDash to be
responsible for interacting with version control systems directly,
instead relying upon CTest to include the necessary information in the
Update step.
---
app/Console/Commands/CleanDatabase.php | 1 -
.../ManageProjectRolesController.php | 50 -------------------
app/cdash/app/Model/Project.php | 7 ---
app/cdash/include/dailyupdates.php | 33 ------------
app/cdash/public/manageProjectRoles.xsl | 18 -------
app/cdash/tests/test_removebuilds.php | 11 ----
...2_06_220212_drop_dailyupdatefile_table.php | 29 +++++++++++
phpstan-baseline.neon | 22 +++-----
8 files changed, 35 insertions(+), 136 deletions(-)
create mode 100644 database/migrations/2025_02_06_220212_drop_dailyupdatefile_table.php
diff --git a/app/Console/Commands/CleanDatabase.php b/app/Console/Commands/CleanDatabase.php
index 97f75e36a4..bef6f71b77 100644
--- a/app/Console/Commands/CleanDatabase.php
+++ b/app/Console/Commands/CleanDatabase.php
@@ -37,7 +37,6 @@ public function handle(): void
DatabaseCleanupUtils::deleteUnusedRows('buildfailuredetails', 'id', 'buildfailure', 'detailsid');
DatabaseCleanupUtils::deleteUnusedRows('configure', 'id', 'build2configure', 'configureid');
DatabaseCleanupUtils::deleteUnusedRows('coveragefile', 'id', 'coverage', 'fileid');
- DatabaseCleanupUtils::deleteUnusedRows('dailyupdatefile', 'dailyupdateid', 'dailyupdate');
DatabaseCleanupUtils::deleteUnusedRows('note', 'id', 'build2note', 'noteid');
DatabaseCleanupUtils::deleteUnusedRows('testoutput', 'id', 'build2test', 'outputid');
DatabaseCleanupUtils::deleteUnusedRows('uploadfile', 'id', 'build2uploadfile', 'fileid');
diff --git a/app/Http/Controllers/ManageProjectRolesController.php b/app/Http/Controllers/ManageProjectRolesController.php
index df89d281f1..14e842a62f 100644
--- a/app/Http/Controllers/ManageProjectRolesController.php
+++ b/app/Http/Controllers/ManageProjectRolesController.php
@@ -329,56 +329,6 @@ public function viewPage(): View|RedirectResponse
$xml .= '';
}
-
- if (is_array($project_array)) {
- // Check if a user is committing without being registered to CDash or with email disabled
- $date = date(FMT_DATETIME, strtotime(date(FMT_DATETIME) . ' -30 days'));
- $query = $db->executePrepared('
- SELECT DISTINCT
- author,
- emailtype,
- u.email
- FROM
- dailyupdate,
- dailyupdatefile
- LEFT JOIN user2repository ON (
- dailyupdatefile.author=user2repository.credential
- AND (
- user2repository.projectid=0
- OR user2repository.projectid=?
- )
- )
- LEFT JOIN user2project ON (
- user2repository.userid= user2project.userid
- AND user2project.projectid=?
- )
- LEFT JOIN users AS u ON (
- user2project.userid=u.id
- )
- WHERE
- dailyupdatefile.dailyupdateid=dailyupdate.id
- AND dailyupdate.projectid=?
- AND dailyupdatefile.checkindate>?
- AND (
- emailtype=0
- OR emailtype IS NULL
- )
- ', [
- intval($project_array['id']),
- intval($project_array['id']),
- intval($project_array['id']),
- $date,
- ]);
-
- add_last_sql_error('ManageProjectRole');
- foreach ($query as $query_array) {
- $xml .= '
- |
-
- - |
-
diff --git a/app/cdash/tests/test_removebuilds.php b/app/cdash/tests/test_removebuilds.php index a5e25388fe..fd956a5d65 100644 --- a/app/cdash/tests/test_removebuilds.php +++ b/app/cdash/tests/test_removebuilds.php @@ -414,16 +414,6 @@ public function testBuildRemovalWorksAsExpected(): void 'status' => 0, 'revision' => 'DEADBEEF', ]); - DB::table('dailyupdatefile')->insert([ - 'dailyupdateid' => $dailyupdate_id, - 'filename' => 'test_removebuilds.php', - 'checkindate' => $time, - 'author' => 'CDash', - 'email' => 'admin@cdash.org', - 'log' => 'test_removebuilds.php', - 'revision' => 'DEADBEEF', - 'priorrevision' => '00000000', - ]); $image_id = DB::table('image')->insertGetId([ 'img' => 'asdf', 'extension' => 'png', @@ -455,7 +445,6 @@ public function testBuildRemovalWorksAsExpected(): void $this->verify('configure', 'id', '=', $configure_id, 0, $extra_msg); $this->verify('coveragefile', 'id', '=', $coveragefile_id, 0, $extra_msg); $this->verify('dailyupdate', 'id', '=', $dailyupdate_id, 0, $extra_msg); - $this->verify('dailyupdatefile', 'dailyupdateid', '=', $dailyupdate_id, 0, $extra_msg); $this->verify('image', 'id', '=', $image_id, 0, $extra_msg); $this->verify('note', 'id', '=', $note_id, 0, $extra_msg); $this->verify('testoutput', 'id', '=', $testoutput_id, 0, $extra_msg); diff --git a/database/migrations/2025_02_06_220212_drop_dailyupdatefile_table.php b/database/migrations/2025_02_06_220212_drop_dailyupdatefile_table.php new file mode 100644 index 0000000000..de6d928b35 --- /dev/null +++ b/database/migrations/2025_02_06_220212_drop_dailyupdatefile_table.php @@ -0,0 +1,29 @@ +integer('dailyupdateid')->default(0)->index(); + $table->string('filename')->default(''); + $table->timestamp('checkindate')->default(DB::raw('CURRENT_TIMESTAMP')); + $table->string('author')->default('')->index(); + $table->string('email')->default(''); + $table->text('log'); + $table->string('revision', 60)->default('0'); + $table->string('priorrevision', 60)->default('0'); + }); + } + } +}; diff --git a/phpstan-baseline.neon b/phpstan-baseline.neon index cc4d1a9be6..8b78a51952 100644 --- a/phpstan-baseline.neon +++ b/phpstan-baseline.neon @@ -1747,7 +1747,7 @@ parameters: - message: "#^Argument of an invalid type array\\|false supplied for foreach, only iterables are supported\\.$#" - count: 5 + count: 4 path: app/Http/Controllers/ManageProjectRolesController.php - @@ -1760,7 +1760,7 @@ parameters: #^Call to deprecated function add_last_sql_error\\(\\)\\: 04/22/2023$# """ - count: 3 + count: 2 path: app/Http/Controllers/ManageProjectRolesController.php - @@ -1784,7 +1784,7 @@ parameters: #^Call to deprecated method executePrepared\\(\\) of class CDash\\\\Database\\: 04/22/2023 Use Laravel query builder or Eloquent instead$# """ - count: 5 + count: 4 path: app/Http/Controllers/ManageProjectRolesController.php - @@ -1914,21 +1914,11 @@ parameters: - message: "#^Parameter \\#1 \\$value of function intval expects array\\|bool\\|float\\|int\\|resource\\|string\\|null, mixed given\\.$#" - count: 4 - path: app/Http/Controllers/ManageProjectRolesController.php - - - - message: "#^Parameter \\#2 \\$string of function explode expects string, mixed given\\.$#" count: 1 path: app/Http/Controllers/ManageProjectRolesController.php - - message: "#^Parameter \\#2 \\$timestamp of function date expects int\\|null, int\\|false given\\.$#" - count: 1 - path: app/Http/Controllers/ManageProjectRolesController.php - - - - message: "#^Variable \\$project_array might not be defined\\.$#" + message: "#^Parameter \\#2 \\$string of function explode expects string, mixed given\\.$#" count: 1 path: app/Http/Controllers/ManageProjectRolesController.php @@ -13858,7 +13848,7 @@ parameters: #^Call to deprecated function add_last_sql_error\\(\\)\\: 04/22/2023$# """ - count: 3 + count: 2 path: app/cdash/include/dailyupdates.php - @@ -13882,7 +13872,7 @@ parameters: #^Call to deprecated method executePreparedSingleRow\\(\\) of class CDash\\\\Database\\: 04/22/2023 Use Laravel query builder or Eloquent instead$# """ - count: 8 + count: 7 path: app/cdash/include/dailyupdates.php - |