Skip to content

Commit

Permalink
Work in progress for #453
Browse files Browse the repository at this point in the history
  • Loading branch information
dlangille committed Oct 12, 2023
1 parent 80e41a9 commit bb4a264
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 38 deletions.
12 changes: 0 additions & 12 deletions classes/commit_ports.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,14 +49,6 @@ class Commit_Ports {
var $path_to_repo;
var $repo_name;

# this comes from the commit_log_ports_element table - useful for non-port elements
# will equal $element_id for ports
var $clpe_element_id;

# full pathname of clpe_element_id
# will equal $element_pathname for ports
var $clpe_element_id_pathname;

function __construct($dbh) {
$this->dbh = $dbh;
}
Expand Down Expand Up @@ -106,10 +98,6 @@ function PopulateValues($myrow) {
$this->repo_hostname = $myrow["repo_hostname"] ?? null;
$this->path_to_repo = $myrow["path_to_repo"] ?? null;
$this->repo_name = $myrow["repo_name"] ?? null;

# for non-ports, these will differ from element_id and element_pathname
$this->clpe_element_id = $myrow['clpe_element_id'] ?? null;
$this->clpe_element_id_pathname = $myrow['clpe_element_id_pathname'] ?? null;
}

function FetchNth($N) {
Expand Down
18 changes: 8 additions & 10 deletions classes/commits.php
Original file line number Diff line number Diff line change
Expand Up @@ -213,9 +213,8 @@ function FetchLimit($UserID, $Limit) {
C.name AS category,
C.id AS category_id,
E.name AS port,
element_pathname(E.id) AS element_pathname,
clpe_element_id,
element_pathname(clpe_element_id) AS clpe_element_id_pathname,
element_pathname(clpe_element_id) AS element_pathname,
clpe_element_id AS element_id,
CASE when CLP.port_version IS NULL then P.version else CLP.port_version END AS version,
CASE when CLP.port_version is NULL then P.revision else CLP.port_revision END AS revision,
CASE when CLP.port_epoch is NULL then P.portepoch else CLP.port_epoch END AS epoch,
Expand All @@ -227,7 +226,6 @@ function FetchLimit($UserID, $Limit) {
P.ignore AS ignore,
P.expiration_date AS expiration_date,
date_part('epoch', P.date_added) AS date_added,
P.element_id AS element_id,
P.short_description AS short_description,
RC.svn_revision AS svn_revision,
R.repo_hostname AS repo_hostname,
Expand All @@ -253,14 +251,14 @@ function FetchLimit($UserID, $Limit) {
$sql .= "
FROM recent_commits RC
LEFT OUTER JOIN commit_log_branches CLB ON RC.id = CLB.commit_log_id
LEFT OUTER JOIN commit_log_ports CLP on CLB.commit_log_id = CLP.commit_log_id
LEFT OUTER JOIN repo R on RC.repo_id = R.id
LEFT OUTER JOIN sanity_test_failures STF ON STF.commit_log_id = RC.id
LEFT OUTER JOIN system_branch SB ON SB.id = CLB.branch_id
LEFT OUTER JOIN ports P ON CLP.port_id = P.id
LEFT OUTER JOIN ports_vulnerable PV ON P.id = PV.port_id
LEFT OUTER JOIN ports P ON P.element_id = clpe_element_id
LEFT OUTER JOIN commit_log_ports CLP ON P.id = CLP.port_id and CLP.commit_log_id = RC.id
LEFT OUTER JOIN element E ON E.id = P.element_id
LEFT OUTER JOIN categories C ON C.id = P.category_id
LEFT OUTER JOIN element E ON E.id = P.element_id";
LEFT OUTER JOIN repo R on RC.repo_id = R.id
LEFT OUTER JOIN sanity_test_failures STF ON STF.commit_log_id = RC.id
LEFT OUTER JOIN ports_vulnerable PV ON P.id = PV.port_id";

if ($UserID) {
$params[] = $UserID;
Expand Down
9 changes: 5 additions & 4 deletions classes/display_commit.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
// base class for displaying commits
class DisplayCommit {

var $Debug = 1;
var $Debug = 0;
var $dbh;

var $result;
Expand Down Expand Up @@ -262,7 +262,8 @@ function CreateHTML() {
}

$this->HTML .= '<span class="element-details">';
$this->HTML .= '<a href="/' . $mycommit->category . '/' . $mycommit->port . '/' . $URLBranchSuffix;
# $this->HTML .= '<a href="/' . $mycommit->category . '/' . $mycommit->port . '/' . $URLBranchSuffix;
$this->HTML .= '<a href="/' . $mycommit->category . '/' . $mycommit->port . '/';
if ($mycommit->branch && $mycommit->branch != BRANCH_HEAD) {
$this->HTML .= '?branch=' . $mycommit->branch;
}
Expand Down Expand Up @@ -347,7 +348,7 @@ function CreateHTML() {
# This is a non-port element...
$this->HTML .= $mycommit->revision . ' ';
$this->HTML .= '<span class="element-details">';
$PathName = preg_replace('|^/?ports/|', '', $mycommit->clpe_element_id_pathname);
$PathName = preg_replace('|^/?ports/|', '', $mycommit->element_pathname);
# echo "'$PathName' " . "'" . $mycommit->repo_name . "'";
switch ($mycommit->repo_name)
{
Expand All @@ -368,7 +369,7 @@ function CreateHTML() {
$QueryArgs = '';
}

if ($PathName != $mycommit->clpe_element_id_pathname) {
if ($PathName != $mycommit->element_pathname) {
$this->HTML .= '<a href="/' . str_replace('%2F', '/', urlencode($PathName)) . $QueryArgs . '">' . $PathName. '</a>';
$this->HTML .= "</span>\n";
} else {
Expand Down
12 changes: 0 additions & 12 deletions classes/ports.php
Original file line number Diff line number Diff line change
Expand Up @@ -116,14 +116,6 @@ class Port {
// version on current quarterly branch. see https://github.com/FreshPorts/freshports/issues/115
var $quarterly_revision;

# this comes from the commit_log_ports_element table - useful for non-port elements
# will equal $element_id for ports
var $clpe_element_id;

# full pathname of clpe_element_id
# will equal $element_pathname for ports
var $clpe_element_id_pathname;

private $Debug = 0;

function __construct($dbh) {
Expand Down Expand Up @@ -224,10 +216,6 @@ function _PopulateValues($myrow) {

$this->last_commit_date = isset($myrow['last_commit_date']) ? $myrow['last_commit_date'] : null;

# for non-ports, these will differ from element_id and element_pathname
$this->clpe_element_id = $myrow['$clpe_element_id'] ?? null;
$this->clpe_element_id_pathname = $myrow['$clpe_element_id_pathname'] ?? null;

$this->ConflictMatches();
}

Expand Down

0 comments on commit bb4a264

Please sign in to comment.