From 734a8bc1a3b022d78df36a468398fe52e6574289 Mon Sep 17 00:00:00 2001 From: William Allen <16820599+williamjallen@users.noreply.github.com> Date: Mon, 7 Aug 2023 14:38:02 -0400 Subject: [PATCH 1/5] Remove unnecessary `common.php` includes --- app/Console/Commands/AutoRemoveBuilds.php | 1 - app/Jobs/ProcessSubmission.php | 1 - app/Models/BuildTest.php | 1 - app/Services/UnparsedSubmissionProcessor.php | 2 +- app/cdash/app/Model/Build.php | 1 - app/cdash/app/Model/BuildFailure.php | 2 +- app/cdash/app/Model/Project.php | 4 +--- app/cdash/app/Model/User.php | 2 +- app/cdash/include/Test/CDashTestCase.php | 2 ++ app/cdash/include/api_common.php | 2 +- app/cdash/include/autoremove.php | 4 ++-- app/cdash/include/ctestparser.php | 2 +- app/cdash/include/dailyupdates.php | 5 ----- app/cdash/include/sendemail.php | 3 --- app/cdash/public/api/v1/deleteSubmissionFile.php | 1 - app/cdash/public/api/v1/getSubmissionFile.php | 1 - app/cdash/public/api/v1/getbuildid.php | 2 +- app/cdash/public/api/v1/getuserid.php | 2 +- app/cdash/public/api/v1/hasfile.php | 2 +- app/cdash/public/api/v1/manageBuildGroup.php | 2 +- app/cdash/public/api/v1/manageMeasurements.php | 2 +- app/cdash/public/api/v1/manageOverview.php | 1 - app/cdash/public/api/v1/project.php | 4 ++-- app/cdash/public/api/v1/subproject.php | 1 - app/cdash/tests/kwtest/kw_web_tester.php | 1 - app/cdash/tests/test_actualbranchcoverage.php | 2 +- app/cdash/tests/test_addbuildapi.php | 2 +- app/cdash/tests/test_aggregatecoverage.php | 2 +- app/cdash/tests/test_api.php | 2 +- app/cdash/tests/test_authtoken.php | 2 +- app/cdash/tests/test_autoremovebuilds_on_submit.php | 2 +- app/cdash/tests/test_bazeljson.php | 2 +- app/cdash/tests/test_branchcoverage.php | 2 +- app/cdash/tests/test_buildconfigure.php | 2 +- app/cdash/tests/test_builddetails.php | 2 +- app/cdash/tests/test_buildfailuredetails.php | 2 +- app/cdash/tests/test_buildgetdate.php | 2 +- app/cdash/tests/test_buildgrouprule.php | 2 +- app/cdash/tests/test_buildmodel.php | 2 +- app/cdash/tests/test_buildproperties.php | 2 +- app/cdash/tests/test_buildrelationship.php | 2 +- app/cdash/tests/test_buildusernote.php | 2 +- app/cdash/tests/test_configurewarnings.php | 2 +- app/cdash/tests/test_coveragedirectories.php | 2 +- app/cdash/tests/test_createprojectpermissions.php | 2 +- app/cdash/tests/test_csvexport.php | 2 +- app/cdash/tests/test_dailyupdatefile.php | 2 +- app/cdash/tests/test_deferredsubmissions.php | 2 +- app/cdash/tests/test_disabledtests.php | 2 +- app/cdash/tests/test_donehandler.php | 2 +- app/cdash/tests/test_dynamicanalysissummary.php | 2 +- app/cdash/tests/test_expectedandmissing.php | 2 +- app/cdash/tests/test_expiredbuildrules.php | 2 +- app/cdash/tests/test_externallinksfromtests.php | 2 +- app/cdash/tests/test_extracttar.php | 2 +- app/cdash/tests/test_filterbuilderrors.php | 2 +- app/cdash/tests/test_filtertestlabels.php | 2 +- app/cdash/tests/test_hidecolumns.php | 2 +- app/cdash/tests/test_image.php | 2 +- app/cdash/tests/test_imagecomparison.php | 2 +- app/cdash/tests/test_indexfilters.php | 2 +- app/cdash/tests/test_indexnextprevious.php | 2 +- app/cdash/tests/test_issuecreation.php | 2 +- app/cdash/tests/test_junithandler.php | 2 +- app/cdash/tests/test_limitedbuilds.php | 2 +- app/cdash/tests/test_managemeasurements.php | 2 +- app/cdash/tests/test_multicoverage.php | 2 +- app/cdash/tests/test_multiplesubprojects.php | 2 +- app/cdash/tests/test_nobackup.php | 2 +- app/cdash/tests/test_notesapi.php | 2 +- app/cdash/tests/test_opencovercoverage.php | 2 +- app/cdash/tests/test_outputcolor.php | 2 +- app/cdash/tests/test_parallelsubmissions.php | 2 +- app/cdash/tests/test_projectmodel.php | 2 +- app/cdash/tests/test_putdynamicbuilds.php | 2 +- app/cdash/tests/test_recoverpassword.php | 2 +- app/cdash/tests/test_removebuilds.php | 2 +- app/cdash/tests/test_replacebuild.php | 2 +- app/cdash/tests/test_seconds_from_interval.php | 2 +- app/cdash/tests/test_submission_assign_buildid.php | 2 +- app/cdash/tests/test_subprojectemail.php | 2 +- app/cdash/tests/test_subprojectnextprevious.php | 2 +- app/cdash/tests/test_subscribeprojectshowlabels.php | 2 +- app/cdash/tests/test_summaryemail.php | 2 +- app/cdash/tests/test_testgraphpermissions.php | 2 +- app/cdash/tests/test_testhistory.php | 2 +- app/cdash/tests/test_timeline.php | 2 +- app/cdash/tests/test_timeoutsandmissingtests.php | 2 +- app/cdash/tests/test_timestatus.php | 2 +- app/cdash/tests/test_truncateoutput.php | 2 +- app/cdash/tests/test_uniquediffs.php | 2 +- app/cdash/tests/test_updateappend.php | 2 +- app/cdash/tests/test_updateonlyuserstats.php | 2 +- app/cdash/tests/test_upgrade.php | 10 +++++----- app/cdash/tests/test_uploadfile.php | 2 +- app/cdash/tests/test_user.php | 2 +- app/cdash/tests/test_usernotes.php | 2 +- app/cdash/tests/test_viewdynamicanalysisfile.php | 1 - tests/CreatesApplication.php | 2 ++ 99 files changed, 95 insertions(+), 111 deletions(-) diff --git a/app/Console/Commands/AutoRemoveBuilds.php b/app/Console/Commands/AutoRemoveBuilds.php index bf1123918f..edb412c5aa 100644 --- a/app/Console/Commands/AutoRemoveBuilds.php +++ b/app/Console/Commands/AutoRemoveBuilds.php @@ -5,7 +5,6 @@ use CDash\Database; use Illuminate\Console\Command; -require_once 'include/common.php'; require_once 'include/pdo.php'; require_once 'include/autoremove.php'; diff --git a/app/Jobs/ProcessSubmission.php b/app/Jobs/ProcessSubmission.php index e9a9a29a4c..ad6e2cf7f7 100644 --- a/app/Jobs/ProcessSubmission.php +++ b/app/Jobs/ProcessSubmission.php @@ -19,7 +19,6 @@ use UpdateHandler; -include_once 'include/common.php'; require_once 'include/ctestparser.php'; require_once 'include/sendemail.php'; diff --git a/app/Models/BuildTest.php b/app/Models/BuildTest.php index 815d3d4038..769c0ff857 100644 --- a/app/Models/BuildTest.php +++ b/app/Models/BuildTest.php @@ -111,7 +111,6 @@ public static function marshalStatus($status): array // Only used in api/v1/viewTest.php public static function marshal($data, $buildid, $projectid, $projectshowtesttime, $testtimemaxstatus, $testdate): array { - require_once 'include/common.php'; $marshaledStatus = self::marshalStatus($data['status']); if ($data['details'] === 'Disabled') { $marshaledStatus = array('Not Run', 'disabled-test'); diff --git a/app/Services/UnparsedSubmissionProcessor.php b/app/Services/UnparsedSubmissionProcessor.php index fae6d6e9f3..a43e306340 100644 --- a/app/Services/UnparsedSubmissionProcessor.php +++ b/app/Services/UnparsedSubmissionProcessor.php @@ -31,7 +31,7 @@ use Illuminate\Support\Str; use Symfony\Component\HttpFoundation\Response; -require_once 'include/common.php'; + /** * This class handles submissions that should be parsed on the server-side diff --git a/app/cdash/app/Model/Build.php b/app/cdash/app/Model/Build.php index 1c530ceb9b..a6ae0895a5 100644 --- a/app/cdash/app/Model/Build.php +++ b/app/cdash/app/Model/Build.php @@ -16,7 +16,6 @@ namespace CDash\Model; -include_once 'include/common.php'; include_once 'include/ctestparserutils.php'; include_once 'include/repository.php'; diff --git a/app/cdash/app/Model/BuildFailure.php b/app/cdash/app/Model/BuildFailure.php index 4cc7ed226e..ded5222903 100644 --- a/app/cdash/app/Model/BuildFailure.php +++ b/app/cdash/app/Model/BuildFailure.php @@ -15,7 +15,7 @@ =========================================================================*/ namespace CDash\Model; -require_once 'include/common.php'; + require_once 'include/repository.php'; use CDash\Config; diff --git a/app/cdash/app/Model/Project.php b/app/cdash/app/Model/Project.php index 2b85d630d2..bf1b3b9d63 100644 --- a/app/cdash/app/Model/Project.php +++ b/app/cdash/app/Model/Project.php @@ -15,7 +15,6 @@ =========================================================================*/ namespace CDash\Model; -require_once 'include/common.php'; require_once 'include/cdashmail.php'; use CDash\Collection\SubscriberCollection; @@ -639,7 +638,6 @@ public function Fill(): void $this->WebApiKey = $project_array['webapikey']; if ($this->WebApiKey == '') { // If no web API key exists, we add one - include_once 'include/common.php'; $newKey = generate_password(40); $this->PDO->executePrepared(' UPDATE project SET webapikey=? WHERE id=? @@ -1644,7 +1642,7 @@ public function CullUploadedFiles(): bool $totalUploadSize = $this->GetUploadsTotalSize(); if ($totalUploadSize > $this->UploadQuota) { - require_once 'include/common.php'; + add_log('Upload quota exceeded, removing old files', 'Project::CullUploadedFiles', LOG_INFO, $this->Id); diff --git a/app/cdash/app/Model/User.php b/app/cdash/app/Model/User.php index f05a77d64a..0956896056 100644 --- a/app/cdash/app/Model/User.php +++ b/app/cdash/app/Model/User.php @@ -17,7 +17,7 @@ use CDash\Database; -require_once 'include/common.php'; + class User { diff --git a/app/cdash/include/Test/CDashTestCase.php b/app/cdash/include/Test/CDashTestCase.php index 9a31fec091..e8e6a96b1d 100644 --- a/app/cdash/include/Test/CDashTestCase.php +++ b/app/cdash/include/Test/CDashTestCase.php @@ -29,6 +29,8 @@ use Tests\TestCase; +require_once 'include/common.php'; + class CDashTestCase extends TestCase { protected $mockPDO; diff --git a/app/cdash/include/api_common.php b/app/cdash/include/api_common.php index e061623769..2febe7741b 100644 --- a/app/cdash/include/api_common.php +++ b/app/cdash/include/api_common.php @@ -14,7 +14,7 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -require_once 'include/common.php'; + use CDash\Model\Build; diff --git a/app/cdash/include/autoremove.php b/app/cdash/include/autoremove.php index e5e59ade34..f72d9e7878 100644 --- a/app/cdash/include/autoremove.php +++ b/app/cdash/include/autoremove.php @@ -20,7 +20,7 @@ function removeBuildsGroupwise($projectid, $maxbuilds, $force = false) { require_once 'include/pdo.php'; - require_once 'include/common.php'; + if (!$force && !config('cdash.autoremove_builds')) { return; @@ -71,7 +71,7 @@ function removeBuildsGroupwise($projectid, $maxbuilds, $force = false) function removeFirstBuilds($projectid, $days, $maxbuilds, $force = false, $echo = true) { require_once 'include/pdo.php'; - require_once 'include/common.php'; + @set_time_limit(0); $remove_builds = config('cdash.autoremove_builds'); diff --git a/app/cdash/include/ctestparser.php b/app/cdash/include/ctestparser.php index 3d88d18746..44a3c30191 100644 --- a/app/cdash/include/ctestparser.php +++ b/app/cdash/include/ctestparser.php @@ -180,7 +180,7 @@ function parse_put_submission($filehandler, $projectid, $expected_md5) /** Main function to parse the incoming xml from ctest */ function ctest_parse($filehandle, $projectid, $expected_md5 = '') { - require_once 'include/common.php'; + include 'include/version.php'; // Check if this is a new style PUT submission. diff --git a/app/cdash/include/dailyupdates.php b/app/cdash/include/dailyupdates.php index 727333e6a2..f62e16c083 100644 --- a/app/cdash/include/dailyupdates.php +++ b/app/cdash/include/dailyupdates.php @@ -20,7 +20,6 @@ // require_once 'include/pdo.php'; -include_once 'include/common.php'; require_once 'include/cdashmail.php'; use CDash\Config; @@ -889,7 +888,6 @@ function sendEmailExpectedBuilds($projectid, $currentstarttime): void /** Remove the buildemail that have been there from more than 48h */ function cleanBuildEmail(): void { - include_once 'include/common.php'; $now = date(FMT_DATETIME, time() - 3600 * 48); $db = Database::getInstance(); @@ -899,7 +897,6 @@ function cleanBuildEmail(): void /** Clean the usertemp table if more than 24hrs */ function cleanUserTemp(): void { - include_once 'include/common.php'; $now = date(FMT_DATETIME, time() - 3600 * 24); $db = Database::getInstance(); @@ -909,7 +906,6 @@ function cleanUserTemp(): void /** Send an email to administrator of the project for users who are not registered */ function sendEmailUnregisteredUsers(int $projectid, $cvsauthors): void { - include_once 'include/common.php'; $config = Config::getInstance(); $unregisteredusers = array(); foreach ($cvsauthors as $author) { @@ -974,7 +970,6 @@ function sendEmailUnregisteredUsers(int $projectid, $cvsauthors): void /** Add daily changes if necessary */ function addDailyChanges(int $projectid): void { - include_once 'include/common.php'; include_once 'include/sendemail.php'; $project = new Project(); diff --git a/app/cdash/include/sendemail.php b/app/cdash/include/sendemail.php index 957dc676d9..f7f2fb6ba8 100644 --- a/app/cdash/include/sendemail.php +++ b/app/cdash/include/sendemail.php @@ -347,8 +347,6 @@ function get_email_summary(int $buildid, array $errors, $errorkey, int $maxitems /** Generate the title and body for a broken build. */ function generate_broken_build_message(array $emailtext, $Build, $Project): array|false { - include_once 'include/common.php'; - $config = Config::getInstance(); $serverURI = $config->getBaseUrl(); @@ -502,7 +500,6 @@ function generate_broken_build_message(array $emailtext, $Build, $Project): arra /** function to send email to site maintainers when the update step fails */ function send_update_email(UpdateHandler $handler, int $projectid): void { - include_once 'include/common.php'; require_once 'include/pdo.php'; $Project = new Project(); diff --git a/app/cdash/public/api/v1/deleteSubmissionFile.php b/app/cdash/public/api/v1/deleteSubmissionFile.php index c24ac6a69c..2c6419870d 100644 --- a/app/cdash/public/api/v1/deleteSubmissionFile.php +++ b/app/cdash/public/api/v1/deleteSubmissionFile.php @@ -17,7 +17,6 @@ namespace CDash\Api\v1\DeleteSubmissionFile; require_once 'include/pdo.php'; -include_once 'include/common.php'; include_once 'include/ctestparser.php'; use Illuminate\Support\Facades\Storage; diff --git a/app/cdash/public/api/v1/getSubmissionFile.php b/app/cdash/public/api/v1/getSubmissionFile.php index b50f3617a0..6739b9364b 100644 --- a/app/cdash/public/api/v1/getSubmissionFile.php +++ b/app/cdash/public/api/v1/getSubmissionFile.php @@ -17,7 +17,6 @@ namespace CDash\Api\v1\GetSubmissionFile; require_once 'include/pdo.php'; -include_once 'include/common.php'; use Illuminate\Support\Facades\Storage; use Symfony\Component\HttpFoundation\Response; diff --git a/app/cdash/public/api/v1/getbuildid.php b/app/cdash/public/api/v1/getbuildid.php index 231c97030d..19515b9b0c 100644 --- a/app/cdash/public/api/v1/getbuildid.php +++ b/app/cdash/public/api/v1/getbuildid.php @@ -16,7 +16,7 @@ namespace CDash\Api\v1\GetBuildID; -require_once 'include/common.php'; + require_once 'include/api_common.php'; require_once 'include/pdo.php'; diff --git a/app/cdash/public/api/v1/getuserid.php b/app/cdash/public/api/v1/getuserid.php index 20cbc62582..fa3975d119 100644 --- a/app/cdash/public/api/v1/getuserid.php +++ b/app/cdash/public/api/v1/getuserid.php @@ -16,7 +16,7 @@ namespace CDash\Api\v1\GetUserID; -require_once 'include/common.php'; + require_once 'include/api_common.php'; require_once 'include/pdo.php'; diff --git a/app/cdash/public/api/v1/hasfile.php b/app/cdash/public/api/v1/hasfile.php index 92735edf4b..8dcbd1b517 100644 --- a/app/cdash/public/api/v1/hasfile.php +++ b/app/cdash/public/api/v1/hasfile.php @@ -16,7 +16,7 @@ namespace CDash\Api\v1\HasFile; -require_once 'include/common.php'; + require_once 'include/pdo.php'; use CDash\Database; diff --git a/app/cdash/public/api/v1/manageBuildGroup.php b/app/cdash/public/api/v1/manageBuildGroup.php index 8ca74f7333..051acaef1d 100644 --- a/app/cdash/public/api/v1/manageBuildGroup.php +++ b/app/cdash/public/api/v1/manageBuildGroup.php @@ -17,7 +17,7 @@ namespace CDash\Api\v1\ManageBuildGroup; require_once 'include/pdo.php'; -require_once 'include/common.php'; + use App\Services\PageTimer; use CDash\Database; diff --git a/app/cdash/public/api/v1/manageMeasurements.php b/app/cdash/public/api/v1/manageMeasurements.php index 15147dae0f..c4280a5521 100644 --- a/app/cdash/public/api/v1/manageMeasurements.php +++ b/app/cdash/public/api/v1/manageMeasurements.php @@ -16,7 +16,7 @@ namespace CDash\Api\v1\ManageMeasurements; require_once 'include/pdo.php'; -require_once 'include/common.php'; + require_once 'include/api_common.php'; use App\Models\Measurement; diff --git a/app/cdash/public/api/v1/manageOverview.php b/app/cdash/public/api/v1/manageOverview.php index 9506920521..3c34c10f04 100644 --- a/app/cdash/public/api/v1/manageOverview.php +++ b/app/cdash/public/api/v1/manageOverview.php @@ -17,7 +17,6 @@ namespace CDash\Api\v1\ManageOverview; require_once 'include/pdo.php'; -include_once 'include/common.php'; include_once 'include/api_common.php'; use App\Services\PageTimer; diff --git a/app/cdash/public/api/v1/project.php b/app/cdash/public/api/v1/project.php index 6dd2d6192a..66c2f4f1e6 100644 --- a/app/cdash/public/api/v1/project.php +++ b/app/cdash/public/api/v1/project.php @@ -18,7 +18,7 @@ require_once 'include/pdo.php'; require_once 'include/api_common.php'; -require_once 'include/common.php'; + use CDash\Model\Project; @@ -134,7 +134,7 @@ function rest_post($user) function get_repo_url_example() { - require_once 'include/common.php'; + require_once 'include/repository.php'; $url = get_param('url'); $type = get_param('type'); diff --git a/app/cdash/public/api/v1/subproject.php b/app/cdash/public/api/v1/subproject.php index 17e29efa79..e24fbc88da 100644 --- a/app/cdash/public/api/v1/subproject.php +++ b/app/cdash/public/api/v1/subproject.php @@ -17,7 +17,6 @@ namespace CDash\Api\v1\SubProject; require_once 'include/pdo.php'; -include_once 'include/common.php'; use App\Services\PageTimer; diff --git a/app/cdash/tests/kwtest/kw_web_tester.php b/app/cdash/tests/kwtest/kw_web_tester.php index b1203a4260..d1cb1a22f5 100644 --- a/app/cdash/tests/kwtest/kw_web_tester.php +++ b/app/cdash/tests/kwtest/kw_web_tester.php @@ -315,7 +315,6 @@ public function getCtestSubmission() public function userExists($email) { - require_once('include/common.php'); require_once('include/pdo.php'); $pdo = get_link_identifier()->getPdo(); $user_table = qid('user'); diff --git a/app/cdash/tests/test_actualbranchcoverage.php b/app/cdash/tests/test_actualbranchcoverage.php index 4dfac4a027..d08cce5085 100644 --- a/app/cdash/tests/test_actualbranchcoverage.php +++ b/app/cdash/tests/test_actualbranchcoverage.php @@ -5,7 +5,7 @@ // require_once dirname(__FILE__) . '/cdash_test_case.php'; require_once 'tests/test_branchcoverage.php'; -require_once 'include/common.php'; + require_once 'include/pdo.php'; diff --git a/app/cdash/tests/test_addbuildapi.php b/app/cdash/tests/test_addbuildapi.php index 3642cd841e..76686777f1 100644 --- a/app/cdash/tests/test_addbuildapi.php +++ b/app/cdash/tests/test_addbuildapi.php @@ -5,7 +5,7 @@ // require_once dirname(__FILE__) . '/cdash_test_case.php'; -require_once 'include/common.php'; + require_once 'include/pdo.php'; use CDash\Model\Build; diff --git a/app/cdash/tests/test_aggregatecoverage.php b/app/cdash/tests/test_aggregatecoverage.php index fb23f5622f..88a51defd8 100644 --- a/app/cdash/tests/test_aggregatecoverage.php +++ b/app/cdash/tests/test_aggregatecoverage.php @@ -17,7 +17,7 @@ // relative to the top of the CDash source tree // require_once dirname(__FILE__) . '/cdash_test_case.php'; -require_once 'include/common.php'; + require_once 'include/pdo.php'; class AggregateCoverageTestCase extends KWWebTestCase diff --git a/app/cdash/tests/test_api.php b/app/cdash/tests/test_api.php index d95b805281..a77658f654 100644 --- a/app/cdash/tests/test_api.php +++ b/app/cdash/tests/test_api.php @@ -5,7 +5,7 @@ // require_once dirname(__FILE__) . '/cdash_test_case.php'; -require_once 'include/common.php'; + require_once 'include/pdo.php'; class APITestCase extends KWWebTestCase diff --git a/app/cdash/tests/test_authtoken.php b/app/cdash/tests/test_authtoken.php index 6b53dbb980..d9bbe47536 100644 --- a/app/cdash/tests/test_authtoken.php +++ b/app/cdash/tests/test_authtoken.php @@ -1,6 +1,6 @@ make(Kernel::class)->bootstrap(); + require_once 'include/common.php'; + return $app; } } From bb24956c055f97c75bffc0211580c0ed4e1ef6e2 Mon Sep 17 00:00:00 2001 From: William Allen <16820599+williamjallen@users.noreply.github.com> Date: Mon, 7 Aug 2023 14:58:03 -0400 Subject: [PATCH 2/5] Remove unnecessary `pdo.php` includes --- app/Console/Commands/AutoRemoveBuilds.php | 2 +- app/Http/Controllers/AbstractController.php | 3 ++- app/cdash/include/autoremove.php | 4 ++-- app/cdash/include/dailyupdates.php | 2 +- app/cdash/include/log.php | 2 +- app/cdash/include/sendemail.php | 2 +- app/cdash/public/api/v1/build.php | 2 +- app/cdash/public/api/v1/buildgroup.php | 2 +- app/cdash/public/api/v1/computeClassifier.php | 2 +- app/cdash/public/api/v1/deleteSubmissionFile.php | 2 +- app/cdash/public/api/v1/expectedbuild.php | 2 +- app/cdash/public/api/v1/getSubmissionFile.php | 2 +- app/cdash/public/api/v1/getbuildid.php | 2 +- app/cdash/public/api/v1/getuserid.php | 2 +- app/cdash/public/api/v1/hasfile.php | 2 +- app/cdash/public/api/v1/index.php | 2 +- app/cdash/public/api/v1/manageBuildGroup.php | 2 +- app/cdash/public/api/v1/manageMeasurements.php | 2 +- app/cdash/public/api/v1/manageOverview.php | 2 +- app/cdash/public/api/v1/overview.php | 2 +- app/cdash/public/api/v1/project.php | 2 +- app/cdash/public/api/v1/subproject.php | 2 +- app/cdash/tests/kwtest/kw_db.php | 2 -- app/cdash/tests/kwtest/kw_web_tester.php | 1 - app/cdash/tests/test_actualbranchcoverage.php | 2 +- app/cdash/tests/test_addbuildapi.php | 2 +- app/cdash/tests/test_aggregatecoverage.php | 2 +- app/cdash/tests/test_api.php | 2 +- app/cdash/tests/test_authtoken.php | 2 +- app/cdash/tests/test_autoremovebuilds.php | 2 +- app/cdash/tests/test_bazeljson.php | 2 +- app/cdash/tests/test_branchcoverage.php | 2 +- app/cdash/tests/test_buildconfigure.php | 2 +- app/cdash/tests/test_builddetails.php | 2 +- app/cdash/tests/test_buildfailuredetails.php | 2 +- app/cdash/tests/test_buildgrouprule.php | 2 +- app/cdash/tests/test_buildmodel.php | 2 +- app/cdash/tests/test_buildproperties.php | 2 +- app/cdash/tests/test_buildrelationship.php | 2 +- app/cdash/tests/test_buildusernote.php | 2 +- app/cdash/tests/test_configurewarnings.php | 2 +- app/cdash/tests/test_coveragedirectories.php | 2 +- app/cdash/tests/test_createprojectpermissions.php | 2 +- app/cdash/tests/test_createpublicdashboard.php | 2 +- app/cdash/tests/test_crosssubprojectcoverage.php | 2 +- app/cdash/tests/test_csvexport.php | 2 +- app/cdash/tests/test_dailyupdatefile.php | 2 +- app/cdash/tests/test_deferredsubmissions.php | 2 +- app/cdash/tests/test_disabledtests.php | 2 +- app/cdash/tests/test_donehandler.php | 2 +- app/cdash/tests/test_dynamicanalysissummary.php | 2 +- app/cdash/tests/test_email.php | 2 +- app/cdash/tests/test_expectedandmissing.php | 2 +- app/cdash/tests/test_externallinksfromtests.php | 2 +- app/cdash/tests/test_filterbuilderrors.php | 2 +- app/cdash/tests/test_filtertestlabels.php | 2 +- app/cdash/tests/test_hidecolumns.php | 2 +- app/cdash/tests/test_image.php | 2 +- app/cdash/tests/test_imagecomparison.php | 2 +- app/cdash/tests/test_indexfilters.php | 2 +- app/cdash/tests/test_issuecreation.php | 2 +- app/cdash/tests/test_junithandler.php | 2 +- app/cdash/tests/test_limitedbuilds.php | 2 +- app/cdash/tests/test_managemeasurements.php | 2 +- app/cdash/tests/test_multicoverage.php | 2 +- app/cdash/tests/test_multiplesubprojects.php | 2 +- app/cdash/tests/test_nobackup.php | 2 +- app/cdash/tests/test_notesapi.php | 2 +- app/cdash/tests/test_opencovercoverage.php | 2 +- app/cdash/tests/test_outputcolor.php | 2 +- app/cdash/tests/test_parallelsubmissions.php | 2 +- app/cdash/tests/test_pdoexecutelogserrors.php | 2 +- app/cdash/tests/test_projectmodel.php | 2 +- app/cdash/tests/test_putdynamicbuilds.php | 2 +- app/cdash/tests/test_removebuilds.php | 2 +- app/cdash/tests/test_replacebuild.php | 2 +- app/cdash/tests/test_sequenceindependence.php | 2 +- app/cdash/tests/test_setup_repositories.php | 2 +- app/cdash/tests/test_subprojectemail.php | 2 +- app/cdash/tests/test_subprojectnextprevious.php | 2 +- app/cdash/tests/test_subscribeprojectshowlabels.php | 2 +- app/cdash/tests/test_summaryemail.php | 2 +- app/cdash/tests/test_testgraphpermissions.php | 2 +- app/cdash/tests/test_testhistory.php | 2 +- app/cdash/tests/test_testoverview.php | 2 +- app/cdash/tests/test_timeline.php | 2 +- app/cdash/tests/test_timeoutsandmissingtests.php | 2 +- app/cdash/tests/test_timestatus.php | 2 +- app/cdash/tests/test_truncateoutput.php | 2 +- app/cdash/tests/test_uniquediffs.php | 2 +- app/cdash/tests/test_updateappend.php | 2 +- app/cdash/tests/test_updateonlyuserstats.php | 2 +- app/cdash/tests/test_upgrade.php | 12 ++++++------ app/cdash/tests/test_uploadfile.php | 2 +- app/cdash/tests/test_user.php | 2 +- app/cdash/tests/test_usernotes.php | 2 +- app/cdash/tests/test_viewdynamicanalysisfile.php | 2 -- tests/CreatesApplication.php | 1 + 98 files changed, 102 insertions(+), 105 deletions(-) diff --git a/app/Console/Commands/AutoRemoveBuilds.php b/app/Console/Commands/AutoRemoveBuilds.php index edb412c5aa..be6ab1006b 100644 --- a/app/Console/Commands/AutoRemoveBuilds.php +++ b/app/Console/Commands/AutoRemoveBuilds.php @@ -5,7 +5,7 @@ use CDash\Database; use Illuminate\Console\Command; -require_once 'include/pdo.php'; + require_once 'include/autoremove.php'; class AutoRemoveBuilds extends Command diff --git a/app/Http/Controllers/AbstractController.php b/app/Http/Controllers/AbstractController.php index 16fc38196f..dc022a2278 100755 --- a/app/Http/Controllers/AbstractController.php +++ b/app/Http/Controllers/AbstractController.php @@ -8,7 +8,8 @@ use Illuminate\Foundation\Validation\ValidatesRequests; use Illuminate\Foundation\Auth\Access\AuthorizesRequests; -include_once 'include/common.php'; +require_once 'include/common.php'; +require_once 'include/pdo.php'; require_once 'include/defines.php'; abstract class AbstractController extends BaseController diff --git a/app/cdash/include/autoremove.php b/app/cdash/include/autoremove.php index f72d9e7878..32a4db954f 100644 --- a/app/cdash/include/autoremove.php +++ b/app/cdash/include/autoremove.php @@ -19,7 +19,7 @@ /** Remove builds by their group-specific auto-remove timeframe setting */ function removeBuildsGroupwise($projectid, $maxbuilds, $force = false) { - require_once 'include/pdo.php'; + if (!$force && !config('cdash.autoremove_builds')) { @@ -70,7 +70,7 @@ function removeBuildsGroupwise($projectid, $maxbuilds, $force = false) /** Remove the first builds that are at the beginning of the queue */ function removeFirstBuilds($projectid, $days, $maxbuilds, $force = false, $echo = true) { - require_once 'include/pdo.php'; + @set_time_limit(0); diff --git a/app/cdash/include/dailyupdates.php b/app/cdash/include/dailyupdates.php index f62e16c083..dc49e261c8 100644 --- a/app/cdash/include/dailyupdates.php +++ b/app/cdash/include/dailyupdates.php @@ -19,7 +19,7 @@ // the input, the project's nightly start time, now // -require_once 'include/pdo.php'; + require_once 'include/cdashmail.php'; use CDash\Config; diff --git a/app/cdash/include/log.php b/app/cdash/include/log.php index 5351c8c36e..19efaa4ba1 100644 --- a/app/cdash/include/log.php +++ b/app/cdash/include/log.php @@ -15,7 +15,7 @@ =========================================================================*/ require_once 'include/defines.php'; -require_once 'include/pdo.php'; + use Illuminate\Support\Facades\Log; diff --git a/app/cdash/include/sendemail.php b/app/cdash/include/sendemail.php index f7f2fb6ba8..6f3a58fcd7 100644 --- a/app/cdash/include/sendemail.php +++ b/app/cdash/include/sendemail.php @@ -500,7 +500,7 @@ function generate_broken_build_message(array $emailtext, $Build, $Project): arra /** function to send email to site maintainers when the update step fails */ function send_update_email(UpdateHandler $handler, int $projectid): void { - require_once 'include/pdo.php'; + $Project = new Project(); $Project->Id = $projectid; diff --git a/app/cdash/public/api/v1/build.php b/app/cdash/public/api/v1/build.php index d497b1123e..73b3745793 100644 --- a/app/cdash/public/api/v1/build.php +++ b/app/cdash/public/api/v1/build.php @@ -16,7 +16,7 @@ namespace CDash\Api\v1\Build; -require_once 'include/pdo.php'; + require_once 'include/api_common.php'; use CDash\Database; diff --git a/app/cdash/public/api/v1/buildgroup.php b/app/cdash/public/api/v1/buildgroup.php index da9593889b..15e198e54d 100644 --- a/app/cdash/public/api/v1/buildgroup.php +++ b/app/cdash/public/api/v1/buildgroup.php @@ -16,7 +16,7 @@ namespace CDash\Api\v1\BuildGroup; -require_once 'include/pdo.php'; + require_once 'include/api_common.php'; require_once 'include/version.php'; diff --git a/app/cdash/public/api/v1/computeClassifier.php b/app/cdash/public/api/v1/computeClassifier.php index 79c566574c..ffc98eb5b4 100644 --- a/app/cdash/public/api/v1/computeClassifier.php +++ b/app/cdash/public/api/v1/computeClassifier.php @@ -17,7 +17,7 @@ namespace CDash\Api\v1\ComputeClassifier; require_once 'include/log.php'; -require_once 'include/pdo.php'; + require_once 'include/api_common.php'; $builds = $_GET['builds']; diff --git a/app/cdash/public/api/v1/deleteSubmissionFile.php b/app/cdash/public/api/v1/deleteSubmissionFile.php index 2c6419870d..a557ac927e 100644 --- a/app/cdash/public/api/v1/deleteSubmissionFile.php +++ b/app/cdash/public/api/v1/deleteSubmissionFile.php @@ -16,7 +16,7 @@ namespace CDash\Api\v1\DeleteSubmissionFile; -require_once 'include/pdo.php'; + include_once 'include/ctestparser.php'; use Illuminate\Support\Facades\Storage; diff --git a/app/cdash/public/api/v1/expectedbuild.php b/app/cdash/public/api/v1/expectedbuild.php index 1d7599c8f6..156d0477ea 100644 --- a/app/cdash/public/api/v1/expectedbuild.php +++ b/app/cdash/public/api/v1/expectedbuild.php @@ -16,7 +16,7 @@ namespace CDash\Api\v1\ExpectedBuild; -require_once 'include/pdo.php'; + require_once 'include/api_common.php'; use App\Models\User; diff --git a/app/cdash/public/api/v1/getSubmissionFile.php b/app/cdash/public/api/v1/getSubmissionFile.php index 6739b9364b..6d20d3eca2 100644 --- a/app/cdash/public/api/v1/getSubmissionFile.php +++ b/app/cdash/public/api/v1/getSubmissionFile.php @@ -16,7 +16,7 @@ namespace CDash\Api\v1\GetSubmissionFile; -require_once 'include/pdo.php'; + use Illuminate\Support\Facades\Storage; use Symfony\Component\HttpFoundation\Response; diff --git a/app/cdash/public/api/v1/getbuildid.php b/app/cdash/public/api/v1/getbuildid.php index 19515b9b0c..463caa2057 100644 --- a/app/cdash/public/api/v1/getbuildid.php +++ b/app/cdash/public/api/v1/getbuildid.php @@ -18,7 +18,7 @@ require_once 'include/api_common.php'; -require_once 'include/pdo.php'; + use CDash\Database; diff --git a/app/cdash/public/api/v1/getuserid.php b/app/cdash/public/api/v1/getuserid.php index fa3975d119..fbe971c1e7 100644 --- a/app/cdash/public/api/v1/getuserid.php +++ b/app/cdash/public/api/v1/getuserid.php @@ -18,7 +18,7 @@ require_once 'include/api_common.php'; -require_once 'include/pdo.php'; + use App\Models\User; use CDash\Model\Project; diff --git a/app/cdash/public/api/v1/hasfile.php b/app/cdash/public/api/v1/hasfile.php index 8dcbd1b517..b9f4124d87 100644 --- a/app/cdash/public/api/v1/hasfile.php +++ b/app/cdash/public/api/v1/hasfile.php @@ -17,7 +17,7 @@ namespace CDash\Api\v1\HasFile; -require_once 'include/pdo.php'; + use CDash\Database; diff --git a/app/cdash/public/api/v1/index.php b/app/cdash/public/api/v1/index.php index 91b32e1591..834ef1b8c6 100644 --- a/app/cdash/public/api/v1/index.php +++ b/app/cdash/public/api/v1/index.php @@ -16,7 +16,7 @@ namespace CDash\Api\v1\Index; -require_once 'include/pdo.php'; + require_once 'include/api_common.php'; require_once 'include/filterdataFunctions.php'; diff --git a/app/cdash/public/api/v1/manageBuildGroup.php b/app/cdash/public/api/v1/manageBuildGroup.php index 051acaef1d..f728234a7b 100644 --- a/app/cdash/public/api/v1/manageBuildGroup.php +++ b/app/cdash/public/api/v1/manageBuildGroup.php @@ -16,7 +16,7 @@ namespace CDash\Api\v1\ManageBuildGroup; -require_once 'include/pdo.php'; + use App\Services\PageTimer; diff --git a/app/cdash/public/api/v1/manageMeasurements.php b/app/cdash/public/api/v1/manageMeasurements.php index c4280a5521..b8e065179f 100644 --- a/app/cdash/public/api/v1/manageMeasurements.php +++ b/app/cdash/public/api/v1/manageMeasurements.php @@ -15,7 +15,7 @@ namespace CDash\Api\v1\ManageMeasurements; -require_once 'include/pdo.php'; + require_once 'include/api_common.php'; diff --git a/app/cdash/public/api/v1/manageOverview.php b/app/cdash/public/api/v1/manageOverview.php index 3c34c10f04..e33f37a17b 100644 --- a/app/cdash/public/api/v1/manageOverview.php +++ b/app/cdash/public/api/v1/manageOverview.php @@ -16,7 +16,7 @@ namespace CDash\Api\v1\ManageOverview; -require_once 'include/pdo.php'; + include_once 'include/api_common.php'; use App\Services\PageTimer; diff --git a/app/cdash/public/api/v1/overview.php b/app/cdash/public/api/v1/overview.php index 92ca6d1e48..dae37f5b70 100644 --- a/app/cdash/public/api/v1/overview.php +++ b/app/cdash/public/api/v1/overview.php @@ -10,7 +10,7 @@ namespace CDash\Api\v1\Overview; -require_once 'include/pdo.php'; + require_once 'include/api_common.php'; require_once 'include/memcache_functions.php'; diff --git a/app/cdash/public/api/v1/project.php b/app/cdash/public/api/v1/project.php index 66c2f4f1e6..9719b72c43 100644 --- a/app/cdash/public/api/v1/project.php +++ b/app/cdash/public/api/v1/project.php @@ -16,7 +16,7 @@ namespace CDash\Api\v1\Project; -require_once 'include/pdo.php'; + require_once 'include/api_common.php'; diff --git a/app/cdash/public/api/v1/subproject.php b/app/cdash/public/api/v1/subproject.php index e24fbc88da..353b567fa3 100644 --- a/app/cdash/public/api/v1/subproject.php +++ b/app/cdash/public/api/v1/subproject.php @@ -16,7 +16,7 @@ namespace CDash\Api\v1\SubProject; -require_once 'include/pdo.php'; + use App\Services\PageTimer; diff --git a/app/cdash/tests/kwtest/kw_db.php b/app/cdash/tests/kwtest/kw_db.php index 90b6731610..969458e3f2 100644 --- a/app/cdash/tests/kwtest/kw_db.php +++ b/app/cdash/tests/kwtest/kw_db.php @@ -14,8 +14,6 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -require_once dirname(dirname(dirname(__FILE__))) . '/include/pdo.php'; - /** * db object to allow the user to interact with * a database diff --git a/app/cdash/tests/kwtest/kw_web_tester.php b/app/cdash/tests/kwtest/kw_web_tester.php index d1cb1a22f5..44af64bf38 100644 --- a/app/cdash/tests/kwtest/kw_web_tester.php +++ b/app/cdash/tests/kwtest/kw_web_tester.php @@ -315,7 +315,6 @@ public function getCtestSubmission() public function userExists($email) { - require_once('include/pdo.php'); $pdo = get_link_identifier()->getPdo(); $user_table = qid('user'); $stmt = $pdo->prepare("SELECT id FROM $user_table WHERE email = ?"); diff --git a/app/cdash/tests/test_actualbranchcoverage.php b/app/cdash/tests/test_actualbranchcoverage.php index d08cce5085..a86481e754 100644 --- a/app/cdash/tests/test_actualbranchcoverage.php +++ b/app/cdash/tests/test_actualbranchcoverage.php @@ -6,7 +6,7 @@ require_once dirname(__FILE__) . '/cdash_test_case.php'; require_once 'tests/test_branchcoverage.php'; -require_once 'include/pdo.php'; + class ActualBranchCoverageTestCase extends BranchCoverageTestCase diff --git a/app/cdash/tests/test_addbuildapi.php b/app/cdash/tests/test_addbuildapi.php index 76686777f1..c228092fd1 100644 --- a/app/cdash/tests/test_addbuildapi.php +++ b/app/cdash/tests/test_addbuildapi.php @@ -6,7 +6,7 @@ require_once dirname(__FILE__) . '/cdash_test_case.php'; -require_once 'include/pdo.php'; + use CDash\Model\Build; diff --git a/app/cdash/tests/test_aggregatecoverage.php b/app/cdash/tests/test_aggregatecoverage.php index 88a51defd8..a23cd488a8 100644 --- a/app/cdash/tests/test_aggregatecoverage.php +++ b/app/cdash/tests/test_aggregatecoverage.php @@ -18,7 +18,7 @@ // require_once dirname(__FILE__) . '/cdash_test_case.php'; -require_once 'include/pdo.php'; + class AggregateCoverageTestCase extends KWWebTestCase { diff --git a/app/cdash/tests/test_api.php b/app/cdash/tests/test_api.php index a77658f654..852a2b17f9 100644 --- a/app/cdash/tests/test_api.php +++ b/app/cdash/tests/test_api.php @@ -6,7 +6,7 @@ require_once dirname(__FILE__) . '/cdash_test_case.php'; -require_once 'include/pdo.php'; + class APITestCase extends KWWebTestCase { diff --git a/app/cdash/tests/test_authtoken.php b/app/cdash/tests/test_authtoken.php index d9bbe47536..0daca449c7 100644 --- a/app/cdash/tests/test_authtoken.php +++ b/app/cdash/tests/test_authtoken.php @@ -1,7 +1,7 @@ getPdo(); diff --git a/app/cdash/tests/test_uploadfile.php b/app/cdash/tests/test_uploadfile.php index 589bf6808f..2dfc02074f 100644 --- a/app/cdash/tests/test_uploadfile.php +++ b/app/cdash/tests/test_uploadfile.php @@ -6,7 +6,7 @@ require_once dirname(__FILE__) . '/cdash_test_case.php'; -require_once 'include/pdo.php'; + class UploadFileTestCase extends KWWebTestCase { diff --git a/app/cdash/tests/test_user.php b/app/cdash/tests/test_user.php index 3140fd097f..21b862096b 100644 --- a/app/cdash/tests/test_user.php +++ b/app/cdash/tests/test_user.php @@ -6,7 +6,7 @@ require_once dirname(__FILE__) . '/cdash_test_case.php'; -require_once 'include/pdo.php'; + use CDash\Model\User; diff --git a/app/cdash/tests/test_usernotes.php b/app/cdash/tests/test_usernotes.php index 545ba186b6..5fc31b2468 100644 --- a/app/cdash/tests/test_usernotes.php +++ b/app/cdash/tests/test_usernotes.php @@ -5,7 +5,7 @@ // require_once dirname(__FILE__) . '/cdash_test_case.php'; -require_once 'include/pdo.php'; + use CDash\Model\Project; diff --git a/app/cdash/tests/test_viewdynamicanalysisfile.php b/app/cdash/tests/test_viewdynamicanalysisfile.php index a6f433bde2..84206db0a7 100644 --- a/app/cdash/tests/test_viewdynamicanalysisfile.php +++ b/app/cdash/tests/test_viewdynamicanalysisfile.php @@ -24,8 +24,6 @@ public function testViewDynamicAnalysisFile() public function testNextPrevious() { - require_once('include/pdo.php'); - // Get id of existing build. $pdo = get_link_identifier()->getPdo(); $stmt = $pdo->query( diff --git a/tests/CreatesApplication.php b/tests/CreatesApplication.php index a3b16e53e3..a4f7d1227b 100755 --- a/tests/CreatesApplication.php +++ b/tests/CreatesApplication.php @@ -18,6 +18,7 @@ public function createApplication() $app->make(Kernel::class)->bootstrap(); require_once 'include/common.php'; + require_once 'include/pdo.php'; return $app; } From 2a05910f900fc3ac7e5e759022b84a4bdc02559c Mon Sep 17 00:00:00 2001 From: William Allen <16820599+williamjallen@users.noreply.github.com> Date: Mon, 7 Aug 2023 15:04:16 -0400 Subject: [PATCH 3/5] Prefer `require_once` over `include_once` `require_once` generates an error, while `include_once` generates a warning and then continues running. --- app/Http/Controllers/BuildController.php | 2 +- app/Http/Controllers/FilterController.php | 2 +- app/Http/Controllers/TestController.php | 2 +- app/cdash/app/Model/Build.php | 4 ++-- app/cdash/include/dailyupdates.php | 4 ++-- app/cdash/include/repository.php | 2 +- app/cdash/public/api/v1/deleteSubmissionFile.php | 2 +- 7 files changed, 9 insertions(+), 9 deletions(-) diff --git a/app/Http/Controllers/BuildController.php b/app/Http/Controllers/BuildController.php index 4161e8b6ed..a9420ef38d 100644 --- a/app/Http/Controllers/BuildController.php +++ b/app/Http/Controllers/BuildController.php @@ -26,7 +26,7 @@ use Illuminate\View\View; use PDO; -require_once('include/repository.php'); +require_once 'include/repository.php'; final class BuildController extends AbstractBuildController { diff --git a/app/Http/Controllers/FilterController.php b/app/Http/Controllers/FilterController.php index 5c6de05926..014430d4e9 100644 --- a/app/Http/Controllers/FilterController.php +++ b/app/Http/Controllers/FilterController.php @@ -3,7 +3,7 @@ use Illuminate\Http\JsonResponse; -include_once 'include/filterdataFunctions.php'; +require_once 'include/filterdataFunctions.php'; class FilterController extends AbstractController { diff --git a/app/Http/Controllers/TestController.php b/app/Http/Controllers/TestController.php index 5b833e246d..76fa31b563 100644 --- a/app/Http/Controllers/TestController.php +++ b/app/Http/Controllers/TestController.php @@ -10,7 +10,7 @@ use Illuminate\View\View; use Symfony\Component\HttpFoundation\StreamedResponse; -include_once 'include/repository.php'; +require_once 'include/repository.php'; final class TestController extends AbstractProjectController { diff --git a/app/cdash/app/Model/Build.php b/app/cdash/app/Model/Build.php index a6ae0895a5..be6f0612f1 100644 --- a/app/cdash/app/Model/Build.php +++ b/app/cdash/app/Model/Build.php @@ -16,8 +16,8 @@ namespace CDash\Model; -include_once 'include/ctestparserutils.php'; -include_once 'include/repository.php'; +require_once 'include/ctestparserutils.php'; +require_once 'include/repository.php'; use App\Models\Test; use App\Services\TestingDay; diff --git a/app/cdash/include/dailyupdates.php b/app/cdash/include/dailyupdates.php index dc49e261c8..567942d923 100644 --- a/app/cdash/include/dailyupdates.php +++ b/app/cdash/include/dailyupdates.php @@ -970,7 +970,7 @@ function sendEmailUnregisteredUsers(int $projectid, $cvsauthors): void /** Add daily changes if necessary */ function addDailyChanges(int $projectid): void { - include_once 'include/sendemail.php'; + require_once 'include/sendemail.php'; $project = new Project(); $project->Id = $projectid; @@ -1194,7 +1194,7 @@ function addDailyChanges(int $projectid): void } // Remove the first builds of the project - include_once 'include/autoremove.php'; + require_once 'include/autoremove.php'; removeFirstBuilds($projectid, $project->AutoremoveTimeframe, $project->AutoremoveMaxBuilds); removeBuildsGroupwise($projectid, $project->AutoremoveMaxBuilds); } diff --git a/app/cdash/include/repository.php b/app/cdash/include/repository.php index 6894896a06..37638e20ae 100644 --- a/app/cdash/include/repository.php +++ b/app/cdash/include/repository.php @@ -858,7 +858,7 @@ function generate_bugtracker_new_issue_link($build, $project) } // Use our email functions to generate a message body and title for this build. - require_once('include/sendemail.php'); + require_once 'include/sendemail.php'; $errors = check_email_errors(intval($build->Id), false, 0, true); $emailtext = []; foreach ($errors as $errorkey => $nerrors) { diff --git a/app/cdash/public/api/v1/deleteSubmissionFile.php b/app/cdash/public/api/v1/deleteSubmissionFile.php index a557ac927e..1550ea76bd 100644 --- a/app/cdash/public/api/v1/deleteSubmissionFile.php +++ b/app/cdash/public/api/v1/deleteSubmissionFile.php @@ -17,7 +17,7 @@ namespace CDash\Api\v1\DeleteSubmissionFile; -include_once 'include/ctestparser.php'; +require_once 'include/ctestparser.php'; use Illuminate\Support\Facades\Storage; use Symfony\Component\HttpFoundation\Response; From f5f8c478dbcd1557df7d3a5c52bc9acfc18db23f Mon Sep 17 00:00:00 2001 From: William Allen <16820599+williamjallen@users.noreply.github.com> Date: Mon, 7 Aug 2023 15:07:22 -0400 Subject: [PATCH 4/5] Delete unnecessary `log.php` includes --- app/cdash/app/Lib/Repository/GitHub.php | 2 -- app/cdash/include/pdo.php | 2 -- app/cdash/include/repository.php | 3 --- app/cdash/public/api/v1/computeClassifier.php | 2 -- app/cdash/tests/case/CDash/Model/BuildRelationshipTest.php | 1 - 5 files changed, 10 deletions(-) diff --git a/app/cdash/app/Lib/Repository/GitHub.php b/app/cdash/app/Lib/Repository/GitHub.php index 23844341c6..3b0e50aac5 100644 --- a/app/cdash/app/Lib/Repository/GitHub.php +++ b/app/cdash/app/Lib/Repository/GitHub.php @@ -32,8 +32,6 @@ use CDash\Model\PendingSubmissions; use CDash\Model\Project; -require_once 'include/log.php'; - /** * Class GitHub * @package CDash\Lib\Repository diff --git a/app/cdash/include/pdo.php b/app/cdash/include/pdo.php index 8903145c98..93c76edb20 100644 --- a/app/cdash/include/pdo.php +++ b/app/cdash/include/pdo.php @@ -14,8 +14,6 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -require_once 'include/log.php'; - use CDash\Database; /** diff --git a/app/cdash/include/repository.php b/app/cdash/include/repository.php index 37638e20ae..02f5048f77 100644 --- a/app/cdash/include/repository.php +++ b/app/cdash/include/repository.php @@ -14,9 +14,6 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -require_once 'include/log.php'; - -use CDash\Model\Build; use CDash\Model\Project; use CDash\ServiceContainer; use CDash\Database; diff --git a/app/cdash/public/api/v1/computeClassifier.php b/app/cdash/public/api/v1/computeClassifier.php index ffc98eb5b4..4b98d19e9d 100644 --- a/app/cdash/public/api/v1/computeClassifier.php +++ b/app/cdash/public/api/v1/computeClassifier.php @@ -16,8 +16,6 @@ namespace CDash\Api\v1\ComputeClassifier; -require_once 'include/log.php'; - require_once 'include/api_common.php'; $builds = $_GET['builds']; diff --git a/app/cdash/tests/case/CDash/Model/BuildRelationshipTest.php b/app/cdash/tests/case/CDash/Model/BuildRelationshipTest.php index 57d13baceb..64f8bc7bd7 100644 --- a/app/cdash/tests/case/CDash/Model/BuildRelationshipTest.php +++ b/app/cdash/tests/case/CDash/Model/BuildRelationshipTest.php @@ -12,7 +12,6 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -require_once 'include/log.php'; use CDash\Model\Build; use CDash\Model\BuildRelationship; use CDash\Model\Project; From 2f09727e6e5eb3134dd564830033a6da897ffaaa Mon Sep 17 00:00:00 2001 From: William Allen <16820599+williamjallen@users.noreply.github.com> Date: Mon, 7 Aug 2023 15:16:20 -0400 Subject: [PATCH 5/5] Code cleanup --- app/Console/Commands/AutoRemoveBuilds.php | 1 - app/Services/UnparsedSubmissionProcessor.php | 2 -- app/cdash/app/Model/BuildFailure.php | 1 - app/cdash/app/Model/User.php | 2 -- app/cdash/public/api/v1/build.php | 1 - app/cdash/public/api/v1/buildgroup.php | 1 - app/cdash/public/api/v1/deleteSubmissionFile.php | 1 - app/cdash/public/api/v1/expectedbuild.php | 1 - app/cdash/public/api/v1/getSubmissionFile.php | 2 -- app/cdash/public/api/v1/getbuildid.php | 1 - app/cdash/public/api/v1/getuserid.php | 1 - app/cdash/public/api/v1/hasfile.php | 3 --- app/cdash/public/api/v1/index.php | 1 - app/cdash/public/api/v1/manageBuildGroup.php | 3 --- app/cdash/public/api/v1/manageMeasurements.php | 2 -- app/cdash/public/api/v1/manageOverview.php | 1 - app/cdash/public/api/v1/overview.php | 1 - app/cdash/public/api/v1/project.php | 1 - app/cdash/public/api/v1/subproject.php | 2 -- phpstan-baseline.neon | 12 ++++++------ 20 files changed, 6 insertions(+), 34 deletions(-) diff --git a/app/Console/Commands/AutoRemoveBuilds.php b/app/Console/Commands/AutoRemoveBuilds.php index be6ab1006b..d463c002c5 100644 --- a/app/Console/Commands/AutoRemoveBuilds.php +++ b/app/Console/Commands/AutoRemoveBuilds.php @@ -5,7 +5,6 @@ use CDash\Database; use Illuminate\Console\Command; - require_once 'include/autoremove.php'; class AutoRemoveBuilds extends Command diff --git a/app/Services/UnparsedSubmissionProcessor.php b/app/Services/UnparsedSubmissionProcessor.php index a43e306340..e9c36d644f 100644 --- a/app/Services/UnparsedSubmissionProcessor.php +++ b/app/Services/UnparsedSubmissionProcessor.php @@ -31,8 +31,6 @@ use Illuminate\Support\Str; use Symfony\Component\HttpFoundation\Response; - - /** * This class handles submissions that should be parsed on the server-side * by CDash. This is in contrast to the XML files that are typically generated diff --git a/app/cdash/app/Model/BuildFailure.php b/app/cdash/app/Model/BuildFailure.php index ded5222903..1d9a51bbd3 100644 --- a/app/cdash/app/Model/BuildFailure.php +++ b/app/cdash/app/Model/BuildFailure.php @@ -15,7 +15,6 @@ =========================================================================*/ namespace CDash\Model; - require_once 'include/repository.php'; use CDash\Config; diff --git a/app/cdash/app/Model/User.php b/app/cdash/app/Model/User.php index 0956896056..6f5f70320c 100644 --- a/app/cdash/app/Model/User.php +++ b/app/cdash/app/Model/User.php @@ -17,8 +17,6 @@ use CDash\Database; - - class User { public $Id; diff --git a/app/cdash/public/api/v1/build.php b/app/cdash/public/api/v1/build.php index 73b3745793..219653fd88 100644 --- a/app/cdash/public/api/v1/build.php +++ b/app/cdash/public/api/v1/build.php @@ -16,7 +16,6 @@ namespace CDash\Api\v1\Build; - require_once 'include/api_common.php'; use CDash\Database; diff --git a/app/cdash/public/api/v1/buildgroup.php b/app/cdash/public/api/v1/buildgroup.php index 15e198e54d..a24aa8e39e 100644 --- a/app/cdash/public/api/v1/buildgroup.php +++ b/app/cdash/public/api/v1/buildgroup.php @@ -16,7 +16,6 @@ namespace CDash\Api\v1\BuildGroup; - require_once 'include/api_common.php'; require_once 'include/version.php'; diff --git a/app/cdash/public/api/v1/deleteSubmissionFile.php b/app/cdash/public/api/v1/deleteSubmissionFile.php index 1550ea76bd..aee4c54af9 100644 --- a/app/cdash/public/api/v1/deleteSubmissionFile.php +++ b/app/cdash/public/api/v1/deleteSubmissionFile.php @@ -16,7 +16,6 @@ namespace CDash\Api\v1\DeleteSubmissionFile; - require_once 'include/ctestparser.php'; use Illuminate\Support\Facades\Storage; diff --git a/app/cdash/public/api/v1/expectedbuild.php b/app/cdash/public/api/v1/expectedbuild.php index 156d0477ea..21c9b238f3 100644 --- a/app/cdash/public/api/v1/expectedbuild.php +++ b/app/cdash/public/api/v1/expectedbuild.php @@ -16,7 +16,6 @@ namespace CDash\Api\v1\ExpectedBuild; - require_once 'include/api_common.php'; use App\Models\User; diff --git a/app/cdash/public/api/v1/getSubmissionFile.php b/app/cdash/public/api/v1/getSubmissionFile.php index 6d20d3eca2..f2815d136b 100644 --- a/app/cdash/public/api/v1/getSubmissionFile.php +++ b/app/cdash/public/api/v1/getSubmissionFile.php @@ -16,8 +16,6 @@ namespace CDash\Api\v1\GetSubmissionFile; - - use Illuminate\Support\Facades\Storage; use Symfony\Component\HttpFoundation\Response; diff --git a/app/cdash/public/api/v1/getbuildid.php b/app/cdash/public/api/v1/getbuildid.php index 463caa2057..97642663fa 100644 --- a/app/cdash/public/api/v1/getbuildid.php +++ b/app/cdash/public/api/v1/getbuildid.php @@ -16,7 +16,6 @@ namespace CDash\Api\v1\GetBuildID; - require_once 'include/api_common.php'; diff --git a/app/cdash/public/api/v1/getuserid.php b/app/cdash/public/api/v1/getuserid.php index fbe971c1e7..cb7ba03c24 100644 --- a/app/cdash/public/api/v1/getuserid.php +++ b/app/cdash/public/api/v1/getuserid.php @@ -16,7 +16,6 @@ namespace CDash\Api\v1\GetUserID; - require_once 'include/api_common.php'; diff --git a/app/cdash/public/api/v1/hasfile.php b/app/cdash/public/api/v1/hasfile.php index b9f4124d87..7fc5a6154f 100644 --- a/app/cdash/public/api/v1/hasfile.php +++ b/app/cdash/public/api/v1/hasfile.php @@ -16,9 +16,6 @@ namespace CDash\Api\v1\HasFile; - - - use CDash\Database; $md5sums_get = isset($_GET['md5sums']) ? htmlspecialchars($_GET['md5sums']) : ''; diff --git a/app/cdash/public/api/v1/index.php b/app/cdash/public/api/v1/index.php index 834ef1b8c6..983ae82c85 100644 --- a/app/cdash/public/api/v1/index.php +++ b/app/cdash/public/api/v1/index.php @@ -16,7 +16,6 @@ namespace CDash\Api\v1\Index; - require_once 'include/api_common.php'; require_once 'include/filterdataFunctions.php'; diff --git a/app/cdash/public/api/v1/manageBuildGroup.php b/app/cdash/public/api/v1/manageBuildGroup.php index f728234a7b..fad8725097 100644 --- a/app/cdash/public/api/v1/manageBuildGroup.php +++ b/app/cdash/public/api/v1/manageBuildGroup.php @@ -16,9 +16,6 @@ namespace CDash\Api\v1\ManageBuildGroup; - - - use App\Services\PageTimer; use CDash\Database; use CDash\Model\BuildGroup; diff --git a/app/cdash/public/api/v1/manageMeasurements.php b/app/cdash/public/api/v1/manageMeasurements.php index b8e065179f..41a969c7a6 100644 --- a/app/cdash/public/api/v1/manageMeasurements.php +++ b/app/cdash/public/api/v1/manageMeasurements.php @@ -15,8 +15,6 @@ namespace CDash\Api\v1\ManageMeasurements; - - require_once 'include/api_common.php'; use App\Models\Measurement; diff --git a/app/cdash/public/api/v1/manageOverview.php b/app/cdash/public/api/v1/manageOverview.php index e33f37a17b..b15cc77d82 100644 --- a/app/cdash/public/api/v1/manageOverview.php +++ b/app/cdash/public/api/v1/manageOverview.php @@ -16,7 +16,6 @@ namespace CDash\Api\v1\ManageOverview; - include_once 'include/api_common.php'; use App\Services\PageTimer; diff --git a/app/cdash/public/api/v1/overview.php b/app/cdash/public/api/v1/overview.php index dae37f5b70..47477f3d02 100644 --- a/app/cdash/public/api/v1/overview.php +++ b/app/cdash/public/api/v1/overview.php @@ -10,7 +10,6 @@ namespace CDash\Api\v1\Overview; - require_once 'include/api_common.php'; require_once 'include/memcache_functions.php'; diff --git a/app/cdash/public/api/v1/project.php b/app/cdash/public/api/v1/project.php index 9719b72c43..e51386459a 100644 --- a/app/cdash/public/api/v1/project.php +++ b/app/cdash/public/api/v1/project.php @@ -16,7 +16,6 @@ namespace CDash\Api\v1\Project; - require_once 'include/api_common.php'; diff --git a/app/cdash/public/api/v1/subproject.php b/app/cdash/public/api/v1/subproject.php index 353b567fa3..64882585b7 100644 --- a/app/cdash/public/api/v1/subproject.php +++ b/app/cdash/public/api/v1/subproject.php @@ -16,8 +16,6 @@ namespace CDash\Api\v1\SubProject; - - use App\Services\PageTimer; use CDash\Database; diff --git a/phpstan-baseline.neon b/phpstan-baseline.neon index 048552f808..f1d299932d 100644 --- a/phpstan-baseline.neon +++ b/phpstan-baseline.neon @@ -20602,22 +20602,22 @@ parameters: path: app/cdash/tests/kwtest/kw_web_tester.php - - message: "#^Method class@anonymous/app/cdash/tests/kwtest/kw_web_tester\\.php\\:874\\:\\:__construct\\(\\) has parameter \\$response with no type specified\\.$#" + message: "#^Method class@anonymous/app/cdash/tests/kwtest/kw_web_tester\\.php\\:872\\:\\:__construct\\(\\) has parameter \\$response with no type specified\\.$#" count: 1 path: app/cdash/tests/kwtest/kw_web_tester.php - - message: "#^Method class@anonymous/app/cdash/tests/kwtest/kw_web_tester\\.php\\:874\\:\\:getSent\\(\\) has no return type specified\\.$#" + message: "#^Method class@anonymous/app/cdash/tests/kwtest/kw_web_tester\\.php\\:872\\:\\:getSent\\(\\) has no return type specified\\.$#" count: 1 path: app/cdash/tests/kwtest/kw_web_tester.php - - message: "#^Method class@anonymous/app/cdash/tests/kwtest/kw_web_tester\\.php\\:874\\:\\:isError\\(\\) has no return type specified\\.$#" + message: "#^Method class@anonymous/app/cdash/tests/kwtest/kw_web_tester\\.php\\:872\\:\\:isError\\(\\) has no return type specified\\.$#" count: 1 path: app/cdash/tests/kwtest/kw_web_tester.php - - message: "#^Method class@anonymous/app/cdash/tests/kwtest/kw_web_tester\\.php\\:874\\:\\:read\\(\\) has no return type specified\\.$#" + message: "#^Method class@anonymous/app/cdash/tests/kwtest/kw_web_tester\\.php\\:872\\:\\:read\\(\\) has no return type specified\\.$#" count: 1 path: app/cdash/tests/kwtest/kw_web_tester.php @@ -20717,12 +20717,12 @@ parameters: path: app/cdash/tests/kwtest/kw_web_tester.php - - message: "#^Property class@anonymous/app/cdash/tests/kwtest/kw_web_tester\\.php\\:874\\:\\:\\$read has no type specified\\.$#" + message: "#^Property class@anonymous/app/cdash/tests/kwtest/kw_web_tester\\.php\\:872\\:\\:\\$read has no type specified\\.$#" count: 1 path: app/cdash/tests/kwtest/kw_web_tester.php - - message: "#^Property class@anonymous/app/cdash/tests/kwtest/kw_web_tester\\.php\\:874\\:\\:\\$response has no type specified\\.$#" + message: "#^Property class@anonymous/app/cdash/tests/kwtest/kw_web_tester\\.php\\:872\\:\\:\\$response has no type specified\\.$#" count: 1 path: app/cdash/tests/kwtest/kw_web_tester.php