aboutsummaryrefslogtreecommitdiff
path: root/src/phinde
diff options
context:
space:
mode:
authorChristian Weiske <cweiske@cweiske.de>2020-03-06 18:33:42 +0100
committerChristian Weiske <cweiske@cweiske.de>2020-03-06 18:33:42 +0100
commit973ef8c4f8c15848dfc135e11053e5eb6f5dcdb7 (patch)
tree5cb1ad71cfd0512522bcea2db656c6703de4092b /src/phinde
parent54fbef1610d1c2ecb48fb149602e3b88f80747df (diff)
downloadphinde-973ef8c4f8c15848dfc135e11053e5eb6f5dcdb7.tar.gz
phinde-973ef8c4f8c15848dfc135e11053e5eb6f5dcdb7.zip
Store the hub that was used for Websub subscription
Diffstat (limited to 'src/phinde')
-rw-r--r--src/phinde/Subscriptions.php8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/phinde/Subscriptions.php b/src/phinde/Subscriptions.php
index e49e817..454d191 100644
--- a/src/phinde/Subscriptions.php
+++ b/src/phinde/Subscriptions.php
@@ -110,19 +110,20 @@ class Subscriptions
* - send subscription requests to the hub
*
* @param string $topic URL to subscribe to
+ * @param string $hub URL of the hub subscribing to
*
* @return void
*/
- public function create($topic)
+ public function create($topic, $hub)
{
$stmt = $this->db->prepare(
'INSERT INTO subscriptions'
. ' (sub_topic, sub_status, sub_lease_seconds, sub_expires'
- . ', sub_secret, sub_capkey, sub_created, sub_updated'
+ . ', sub_secret, sub_capkey, sub_hub, sub_created, sub_updated'
. ', sub_pings, sub_lastping, sub_statusmessage)'
. ' VALUES '
. ' (:topic, "subscribing", :lease_seconds, "0000-00-00 00:00:00"'
- . ', :secret, :capkey, NOW(), NOW()'
+ . ', :secret, :capkey, :hub, NOW(), NOW()'
. ', 0, "0000-00-00 00:00:00", "")'
);
$stmt->execute(
@@ -131,6 +132,7 @@ class Subscriptions
':lease_seconds' => 86400 * 30,
':secret' => bin2hex(openssl_random_pseudo_bytes(16)),
':capkey' => bin2hex(openssl_random_pseudo_bytes(16)),
+ ':hub' => $hub,
]
);
}