aboutsummaryrefslogtreecommitdiff
path: root/models/webpage.php
diff options
context:
space:
mode:
Diffstat (limited to 'models/webpage.php')
-rw-r--r--models/webpage.php18
1 files changed, 17 insertions, 1 deletions
diff --git a/models/webpage.php b/models/webpage.php
index 35bb3ce..9dcc5ae 100644
--- a/models/webpage.php
+++ b/models/webpage.php
@@ -20,7 +20,7 @@ class Webpage extends Table {
static function fromDB(string $URL) : Webpage {
return Table::_fromDB(
- "SELECT * FROM Webpages WHERE URL = \"$URL\"",
+ "SELECT * FROM Webpages WHERE URL = \"$URL\" ORDER BY Date DESC LIMIT 1",
"Database\Webpage"
);
}
@@ -32,4 +32,20 @@ class Webpage extends Table {
"GROUP BY URL ORDER BY Visits DESC, Date DESC LIMIT $count"
);
}
+
+ static function allArchives(string $URL) : array {
+ return Table::_get_all(
+ 'Webpages',
+ 'Database\Webpage',
+ "WHERE URL = \"$URL\" ORDER BY Date DESC"
+ );
+ }
+
+ function incrementVisits() {
+ Table::_update(
+ 'Webpages',
+ "Visits = \"" . ($this->Visits + 1) . "\"",
+ "WID = \"{$this->WID}\""
+ );
+ }
}