Extended data structure with branch field

This commit is contained in:
Steffen Lange 2020-03-30 01:42:46 +02:00
parent f0c7c5fae0
commit 2a83cbf9c1
3 changed files with 10 additions and 4 deletions

View file

@ -62,7 +62,7 @@ class Database {
array_push($this->data, $patch); array_push($this->data, $patch);
} }
private function cmp(PatchObject $a, PatchObject $b) : int { private function cmp(PatchObject $a, PatchObject $b) : int {
return strcasecmp($a->getProduct(), $b->getProduct()); return strcasecmp($a->getProduct() . $a->getBranch(), $b->getProduct() . $b->getBranch());
} }
} }

View file

@ -4,6 +4,7 @@ class PatchObject {
private $id = ''; private $id = '';
private $vendor = ''; private $vendor = '';
private $product = ''; private $product = '';
private $branch = '';
private $version = ''; private $version = '';
private $url = ''; private $url = '';
private $timestamp = 0; private $timestamp = 0;
@ -14,10 +15,10 @@ class PatchObject {
} }
} }
function __toString() : string { function __toString() : string {
return $this->vendor . ' ' . $this->product . ' ' . $this->version; return $this->vendor . ' ' . $this->product . ' ' . $this->branch . ' ' . $this->version;
} }
function toArray() : array { function toArray() : array {
return array('id' => $this->id, 'vendor' => $this->vendor, 'product' => $this->product, 'version' => $this->version, 'url' => $this->url, 'timestamp' => $this->timestamp); return array('id' => $this->id, 'vendor' => $this->vendor, 'product' => $this->product, 'branch' => $this->branch, 'version' => $this->version, 'url' => $this->url, 'timestamp' => $this->timestamp);
} }
function getId() : string { function getId() : string {
return $this->id; return $this->id;
@ -28,6 +29,9 @@ class PatchObject {
function getProduct() : string { function getProduct() : string {
return $this->product; return $this->product;
} }
function getBranch() : string {
return $this->branch;
}
function getVersion() : string { function getVersion() : string {
return $this->version; return $this->version;
} }

View file

@ -31,11 +31,12 @@ $db->sort();
<h2 class="mb-4">Patch Notification Robot</h2> <h2 class="mb-4">Patch Notification Robot</h2>
<p class="text-center"><a href="https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&amp;hosted_button_id=WYQZCVJPVSS5L&amp;source=url"><img src="btn_donateCC_LG.gif" alt="Donate" /></a></p> <p class="text-center"><a href="https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&amp;hosted_button_id=WYQZCVJPVSS5L&amp;source=url"><img src="btn_donateCC_LG.gif" alt="Donate" /></a></p>
<p><a href="https://twitter.com/Patchbot_de"><img src="twitter.png" height="32" alt="Follow me" /></a>&nbsp;Providing you the latest update notifications.</p> <p><a href="https://twitter.com/Patchbot_de"><img src="twitter.png" height="32" alt="Follow me" /></a>&nbsp;Providing you the latest update notifications.</p>
<table id="list" class="table table-bordered table-hover table-sm"> <table id="list" class="table table-bordered table-hover table-sm" data-order='[[ 4, "desc" ]]' data-page-length='25'>
<thead class="thead-dark"> <thead class="thead-dark">
<tr> <tr>
<th>Vendor</th> <th>Vendor</th>
<th>Product</th> <th>Product</th>
<th>Branch</th>
<th>Version</th> <th>Version</th>
<th title="*) or first discovery time">Release Date*</th> <th title="*) or first discovery time">Release Date*</th>
</tr> </tr>
@ -48,6 +49,7 @@ $db->sort();
echo '<tr>'; echo '<tr>';
echo '<td>' . $patch->getVendor() . '</td>'; echo '<td>' . $patch->getVendor() . '</td>';
echo '<td><a href="' . $patch->getURL() . '">' . $patch->getProduct() . '</a></td>'; echo '<td><a href="' . $patch->getURL() . '">' . $patch->getProduct() . '</a></td>';
echo '<td>' . $patch->getBranch() . '</td>';
echo '<td>' . $patch->getVersion() . '</td>'; echo '<td>' . $patch->getVersion() . '</td>';
echo '<td>' . date('Y-m-d', $patch->getTimestamp()) . '</td>'; echo '<td>' . date('Y-m-d', $patch->getTimestamp()) . '</td>';
echo '</tr>' . "\r\n"; echo '</tr>' . "\r\n";