@ -384,19 +384,34 @@ class MySQL {
public function getHostPagesByLimit(int $hostId, int $limit) {
public function getHostPagesByLimit(int $hostId, int $limit) {
$query = $this->_db->prepare('SELECT * FROM `hostPage` WHERE `hostId` = ? ORDER BY hostPageId DESC LIMIT ' . (int) $limit);
$query = $this->_db->prepare('SELECT * FROM `hostPage` WHERE `hostId` = ? ORDER BY ` hostPageId` DESC LIMIT ' . (int) $limit);
$query->execute([$hostId]);
$query->execute([$hostId]);
return $query->fetchAll();
return $query->fetchAll();
}
}
public function getHostPageDescription(int $hostPageId, int $crc32data) {
$query = $this->_db->prepare('SELECT * FROM `hostPageDescription` WHERE `hostPageId` = ? AND `crc32data` = ? LIMIT 1');
$query->execute([$hostPageId, $crc32data]);
return $query->fetch();
}
public function getLastPageDescription(int $hostPageId) {
$query = $this->_db->prepare('SELECT * FROM `hostPageDescription` WHERE `hostPageId` = ? ORDER BY `timeAdded` DESC LIMIT 1');
$query->execute([$hostPageId]);
return $query->fetch();
}
public function getFoundHostPage(int $hostPageId) {
public function getFoundHostPage(int $hostPageId) {
$query = $this->_db->prepare('SELECT `hostPage`.`metaTitle`,
$query = $this->_db->prepare('SELECT `hostPage`.`uri`,
`hostPage`.`metaDescription`,
`hostPage`.`data`,
`hostPage`.`uri`,
`hostPage`.`rank`,
`hostPage`.`rank`,
`host`.`scheme`,
`host`.`scheme`,
`host`.`name`,
`host`.`name`,
@ -449,11 +464,7 @@ class MySQL {
mixed $timeBanned = null,
mixed $timeBanned = null,
mixed $httpCode = null,
mixed $httpCode = null,
mixed $mime = null,
mixed $mime = null,
mixed $rank = null,
mixed $rank = null) {
mixed $metaTitle = null,
mixed $metaDescription = null,
mixed $metaKeywords = null,
mixed $data = null) {
$query = $this->_db->prepare('INSERT INTO `hostPage` (`hostId`,
$query = $this->_db->prepare('INSERT INTO `hostPage` (`hostId`,
`crc32uri`,
`crc32uri`,
@ -463,35 +474,18 @@ class MySQL {
`timeBanned`,
`timeBanned`,
`httpCode`,
`httpCode`,
`mime`,
`mime`,
`rank`,
`rank`) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?)');
`metaTitle`,
`metaDescription`,
`metaKeywords`,
`data`) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)');
$query->execute([$hostId, $crc32uri, $uri, $timeAdded, $timeUpdated, $timeBanned, $httpCode, $mime, $rank, $metaTitle, $metaDescription, $metaKeywords, $data ]);
$query->execute([$hostId, $crc32uri, $uri, $timeAdded, $timeUpdated, $timeBanned, $httpCode, $mime, $rank]);
return $this->_db->lastInsertId();
return $this->_db->lastInsertId();
}
}
public function updateHostPage( int $hostPageId,
public function updateHostPage(int $hostPageId, string $mime, int $timeUpdated) {
mixed $metaTitle,
mixed $metaDescription,
mixed $metaKeywords,
string $mime,
mixed $data,
int $timeUpdated,
mixed $timeBanned = null) {
$query = $this->_db->prepare('UPDATE `hostPage` SET `metaTitle` = ?,
$query = $this->_db->prepare('UPDATE `hostPage` SET `timeUpdated` = ?, `mime` = ? WHERE `hostPageId` = ? LIMIT 1');
`metaDescription` = ?,
`metaKeywords` = ?,
`mime` = ?,
`data` = ?,
`timeUpdated` = ?,
`timeBanned` = ? WHERE `hostPageId` = ? LIMIT 1');
$query->execute([$metaTitle, $metaDescription, $metaKeywords, $mime, $data, $timeUpdated, $timeBanned , $hostPageId]);
$query->execute([$timeUpdated, $mime, $hostPageId]);
return $query->rowCount();
return $query->rowCount();
}
}
@ -548,6 +542,15 @@ class MySQL {
return $query->rowCount();
return $query->rowCount();
}
}
public function deleteHostPageDescriptions(int $hostPageId) {
$query = $this->_db->prepare('DELETE FROM `hostPageDescription` WHERE `hostPageId` = ?');
$query->execute([$hostPageId]);
return $query->rowCount();
}
public function deleteHostPageToHostImage(int $hostPageId) {
public function deleteHostPageToHostImage(int $hostPageId) {
$query = $this->_db->prepare('DELETE FROM `hostImageToHostPage` WHERE `hostPageId` = ?');
$query = $this->_db->prepare('DELETE FROM `hostImageToHostPage` WHERE `hostPageId` = ?');
@ -557,6 +560,36 @@ class MySQL {
return $query->rowCount();
return $query->rowCount();
}
}
public function addHostPageDescription(int $hostPageId,
int $crc32data,
mixed $metaTitle,
mixed $metaDescription,
mixed $metaKeywords,
mixed $data,
int $timeAdded) {
$query = $this->_db->prepare('INSERT INTO `hostPageDescription` ( `hostPageId`,
`crc32data`,
`metaTitle`,
`metaDescription`,
`metaKeywords`,
`data`,
`timeAdded`
) VALUES (?, ?, ?, ?, ?, ?, ?)');
$query->execute([
$hostPageId,
$crc32data,
$metaTitle,
$metaDescription,
$metaKeywords,
$data,
$timeAdded
]);
return $query->rowCount();
}
// Cleaner tools
// Cleaner tools
public function getCleanerQueue(int $limit, int $timeFrom) {
public function getCleanerQueue(int $limit, int $timeFrom) {