IMPORTANT - fixed HubSub to properly fetch primary keys

In commit e95f77d34c HubSub lost the
'staticGet' function in a consolidation into the Managed_DataObject class.
This was done carelessly by me as HubSub::staticGet was actually taking
two arguments, none of which was a key and merging them in HubSub::hashkey()
(staticGet was renamed getKV 2a4dc77a63).

NOTE: This complements commit 7e4718a4eb which
fixed a similar issue for the Magicsig class.
This commit is contained in:
Mikael Nordfeldth
2013-08-21 11:25:08 +02:00
parent 66997f2bec
commit 0bbcfa7bdf
3 changed files with 10 additions and 5 deletions

View File

@@ -45,6 +45,11 @@ class HubSub extends Managed_DataObject
return sha1($topic . '|' . $callback);
}
public static function getByHashkey($topic, $callback)
{
return self::getKV('hashkey', self::hashkey($topic, $callback));
}
public static function schemaDef()
{
return array(
@@ -158,7 +163,7 @@ class HubSub extends Managed_DataObject
throw new ClientException(sprintf(_m('Hub subscriber verification returned HTTP %s.'),$status));
}
$old = HubSub::getKV($this->topic, $this->callback);
$old = HubSub::getByHashkey($this->topic, $this->callback);
if ($mode == 'subscribe') {
if ($old) {
$this->update($old);
@@ -244,7 +249,7 @@ class HubSub extends Managed_DataObject
// destroy the result data for the parent query.
// @fixme use clone() again when it's safe to copy an
// individual item from a multi-item query again.
$sub = HubSub::getKV($this->topic, $this->callback);
$sub = HubSub::getByHashkey($this->topic, $this->callback);
$data = array('sub' => $sub,
'atom' => $atom,
'retries' => $retries);