summaryrefslogtreecommitdiffstats
path: root/web
diff options
context:
space:
mode:
authorLukas Fleischer <lfleischer@archlinux.org>2015-11-10 19:26:57 +0100
committerLukas Fleischer <lfleischer@archlinux.org>2016-02-07 10:39:22 +0100
commit3412de21d32708b44d1fb3011649734e3cc67d9b (patch)
tree8124b4cad4d68a01a0d8aeff90c9e8584d173541 /web
parentdaee000604243b95e439167c97b3ee8cdc4f6ca3 (diff)
downloadaur-3412de21d32708b44d1fb3011649734e3cc67d9b.tar.gz
aur-3412de21d32708b44d1fb3011649734e3cc67d9b.tar.xz
Rename the CommentNotify table to PackageNotifications
As a preparatory step to adding support for package notifications on events other than comments, rename the database table accordingly. Signed-off-by: Lukas Fleischer <lfleischer@archlinux.org>
Diffstat (limited to 'web')
-rw-r--r--web/lib/acctfuncs.inc.php2
-rw-r--r--web/lib/pkgbasefuncs.inc.php14
-rw-r--r--web/lib/pkgfuncs.inc.php6
3 files changed, 11 insertions, 11 deletions
diff --git a/web/lib/acctfuncs.inc.php b/web/lib/acctfuncs.inc.php
index 6fb2b407..0c6388af 100644
--- a/web/lib/acctfuncs.inc.php
+++ b/web/lib/acctfuncs.inc.php
@@ -897,7 +897,7 @@ function user_delete($id) {
$fields_delete = array(
array("Sessions", "UsersID"),
array("PackageVotes", "UsersID"),
- array("CommentNotify", "UsersID")
+ array("PackageNotifications", "UsersID")
);
$fields_set_null = array(
diff --git a/web/lib/pkgbasefuncs.inc.php b/web/lib/pkgbasefuncs.inc.php
index 20f5bb49..c0e672ad 100644
--- a/web/lib/pkgbasefuncs.inc.php
+++ b/web/lib/pkgbasefuncs.inc.php
@@ -542,15 +542,15 @@ function pkgbase_delete ($base_ids, $merge_base_id, $via, $grant=false) {
$dbh->exec($q);
/* Merge notifications */
- $q = "SELECT DISTINCT UserID FROM CommentNotify cn ";
+ $q = "SELECT DISTINCT UserID FROM PackageNotifications cn ";
$q.= "WHERE PackageBaseID IN (" . implode(",", $base_ids) . ") ";
- $q.= "AND NOT EXISTS (SELECT * FROM CommentNotify cn2 ";
+ $q.= "AND NOT EXISTS (SELECT * FROM PackageNotifications cn2 ";
$q.= "WHERE cn2.PackageBaseID = " . intval($merge_base_id) . " ";
$q.= "AND cn2.UserID = cn.UserID)";
$result = $dbh->query($q);
while ($notify_uid = $result->fetch(PDO::FETCH_COLUMN, 0)) {
- $q = "INSERT INTO CommentNotify (UserID, PackageBaseID) ";
+ $q = "INSERT INTO PackageNotifications (UserID, PackageBaseID) ";
$q.= "VALUES (" . intval($notify_uid) . ", " . intval($merge_base_id) . ")";
$dbh->exec($q);
}
@@ -840,7 +840,7 @@ function pkgbase_user_voted($uid, $base_id) {
function pkgbase_user_notify($uid, $base_id) {
$dbh = DB::connect();
- $q = "SELECT * FROM CommentNotify WHERE UserID = " . $dbh->quote($uid);
+ $q = "SELECT * FROM PackageNotifications WHERE UserID = " . $dbh->quote($uid);
$q.= " AND PackageBaseID = " . $dbh->quote($base_id);
$result = $dbh->query($q);
@@ -898,20 +898,20 @@ function pkgbase_notify ($base_ids, $action=true) {
if ($action) {
- $q = "SELECT COUNT(*) FROM CommentNotify WHERE ";
+ $q = "SELECT COUNT(*) FROM PackageNotifications WHERE ";
$q .= "UserID = $uid AND PackageBaseID = $bid";
/* Notification already added. Don't add again. */
$result = $dbh->query($q);
if ($result->fetchColumn() == 0) {
- $q = "INSERT INTO CommentNotify (PackageBaseID, UserID) VALUES ($bid, $uid)";
+ $q = "INSERT INTO PackageNotifications (PackageBaseID, UserID) VALUES ($bid, $uid)";
$dbh->exec($q);
}
$output .= $basename;
}
else {
- $q = "DELETE FROM CommentNotify WHERE PackageBaseID = $bid ";
+ $q = "DELETE FROM PackageNotifications WHERE PackageBaseID = $bid ";
$q .= "AND UserID = $uid";
$dbh->exec($q);
diff --git a/web/lib/pkgfuncs.inc.php b/web/lib/pkgfuncs.inc.php
index c2bbe387..0e152ddc 100644
--- a/web/lib/pkgfuncs.inc.php
+++ b/web/lib/pkgfuncs.inc.php
@@ -716,7 +716,7 @@ function pkg_search_page($SID="") {
/* Build the package search query. */
$q_select = "SELECT ";
if ($SID) {
- $q_select .= "CommentNotify.UserID AS Notify,
+ $q_select .= "PackageNotifications.UserID AS Notify,
PackageVotes.UsersID AS Voted, ";
}
$q_select .= "Users.Username AS Maintainer,
@@ -731,8 +731,8 @@ function pkg_search_page($SID="") {
/* This is not needed for the total row count query. */
$q_from_extra = "LEFT JOIN PackageVotes
ON (PackageBases.ID = PackageVotes.PackageBaseID AND PackageVotes.UsersID = $myuid)
- LEFT JOIN CommentNotify
- ON (PackageBases.ID = CommentNotify.PackageBaseID AND CommentNotify.UserID = $myuid) ";
+ LEFT JOIN PackageNotifications
+ ON (PackageBases.ID = PackageNotifications.PackageBaseID AND PackageNotifications.UserID = $myuid) ";
} else {
$q_from_extra = "";
}