Browse Source

show available snaps only

main
ghost 2 years ago
parent
commit
ed240d53b0
  1. 12
      library/mysql.php

12
library/mysql.php

@ -406,20 +406,20 @@ class MySQL { @@ -406,20 +406,20 @@ class MySQL {
return $query->rowCount();
}
public function getTotalHostPageSnaps(int $hostPageId) {
public function getTotalHostPageSnaps(int $hostPageId, bool $storageLocal = true, bool $storageMega = true) {
$query = $this->_db->prepare('SELECT COUNT(*) AS `total` FROM `hostPageSnap` WHERE `hostPageId` = ?');
$query = $this->_db->prepare('SELECT COUNT(*) AS `total` FROM `hostPageSnap` WHERE `hostPageId` = ? AND (`storageLocal` = ? OR `storageMega` = ?)');
$query->execute([$hostPageId]);
$query->execute([$hostPageId, $storageLocal, $storageMega]);
return $query->fetch()->total;
}
public function getHostPageSnaps(int $hostPageId) {
public function getHostPageSnaps(int $hostPageId, bool $storageLocal = true, bool $storageMega = true) {
$query = $this->_db->prepare('SELECT * FROM `hostPageSnap` WHERE `hostPageId` = ? ORDER BY `timeAdded` DESC');
$query = $this->_db->prepare('SELECT * FROM `hostPageSnap` WHERE `hostPageId` = ? AND (`storageLocal` = ? OR `storageMega` = ?) ORDER BY `timeAdded` DESC');
$query->execute([$hostPageId]);
$query->execute([$hostPageId, $storageLocal, $storageMega]);
return $query->fetchAll();
}

Loading…
Cancel
Save