|
@@ -26,6 +26,9 @@ require_once 'Zend/Feed/Pubsubhubbub/Model/ModelAbstract.php';
|
|
|
/** @see Zend_Feed_Pubsubhubbub_Model_SubscriptionInterface */
|
|
/** @see Zend_Feed_Pubsubhubbub_Model_SubscriptionInterface */
|
|
|
require_once 'Zend/Feed/Pubsubhubbub/Model/SubscriptionInterface.php';
|
|
require_once 'Zend/Feed/Pubsubhubbub/Model/SubscriptionInterface.php';
|
|
|
|
|
|
|
|
|
|
+/** @see Zend_Date */
|
|
|
|
|
+require_once 'Zend/Date.php';
|
|
|
|
|
+
|
|
|
/**
|
|
/**
|
|
|
* @category Zend
|
|
* @category Zend
|
|
|
* @package Zend_Feed_Pubsubhubbub
|
|
* @package Zend_Feed_Pubsubhubbub
|
|
@@ -37,7 +40,7 @@ class Zend_Feed_Pubsubhubbub_Model_Subscription
|
|
|
extends Zend_Feed_Pubsubhubbub_Model_ModelAbstract
|
|
extends Zend_Feed_Pubsubhubbub_Model_ModelAbstract
|
|
|
implements Zend_Feed_Pubsubhubbub_Model_SubscriptionInterface
|
|
implements Zend_Feed_Pubsubhubbub_Model_SubscriptionInterface
|
|
|
{
|
|
{
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
/**
|
|
/**
|
|
|
* Save subscription to RDMBS
|
|
* Save subscription to RDMBS
|
|
|
*
|
|
*
|
|
@@ -53,10 +56,10 @@ class Zend_Feed_Pubsubhubbub_Model_Subscription
|
|
|
);
|
|
);
|
|
|
}
|
|
}
|
|
|
$result = $this->_db->find($data['id']);
|
|
$result = $this->_db->find($data['id']);
|
|
|
- if ($result) {
|
|
|
|
|
|
|
+ if (count($result)) {
|
|
|
$data['created_time'] = $result->current()->created_time;
|
|
$data['created_time'] = $result->current()->created_time;
|
|
|
$now = new Zend_Date;
|
|
$now = new Zend_Date;
|
|
|
- if ($data['lease_seconds']) {
|
|
|
|
|
|
|
+ if (isset($data['lease_seconds'])) {
|
|
|
$data['expiration_time'] = $now->add($data['lease_seconds'], Zend_Date::SECOND)
|
|
$data['expiration_time'] = $now->add($data['lease_seconds'], Zend_Date::SECOND)
|
|
|
->get('yyyy-MM-dd HH:mm:ss');
|
|
->get('yyyy-MM-dd HH:mm:ss');
|
|
|
}
|
|
}
|
|
@@ -70,11 +73,11 @@ class Zend_Feed_Pubsubhubbub_Model_Subscription
|
|
|
$this->_db->insert($data);
|
|
$this->_db->insert($data);
|
|
|
return true;
|
|
return true;
|
|
|
}
|
|
}
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
/**
|
|
/**
|
|
|
* Get subscription by ID/key
|
|
* Get subscription by ID/key
|
|
|
- *
|
|
|
|
|
- * @param string $key
|
|
|
|
|
|
|
+ *
|
|
|
|
|
+ * @param string $key
|
|
|
* @return array
|
|
* @return array
|
|
|
*/
|
|
*/
|
|
|
public function getSubscription($key)
|
|
public function getSubscription($key)
|
|
@@ -85,16 +88,16 @@ class Zend_Feed_Pubsubhubbub_Model_Subscription
|
|
|
.' of "' . $key . '" must be a non-empty string');
|
|
.' of "' . $key . '" must be a non-empty string');
|
|
|
}
|
|
}
|
|
|
$result = $this->_db->find($key);
|
|
$result = $this->_db->find($key);
|
|
|
- if ($result) {
|
|
|
|
|
- return (array) $result->current();
|
|
|
|
|
|
|
+ if (count($result)) {
|
|
|
|
|
+ return $result->current()->toArray();
|
|
|
}
|
|
}
|
|
|
return false;
|
|
return false;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
|
* Determine if a subscription matching the key exists
|
|
* Determine if a subscription matching the key exists
|
|
|
- *
|
|
|
|
|
- * @param string $key
|
|
|
|
|
|
|
+ *
|
|
|
|
|
+ * @param string $key
|
|
|
* @return bool
|
|
* @return bool
|
|
|
*/
|
|
*/
|
|
|
public function hasSubscription($key)
|
|
public function hasSubscription($key)
|
|
@@ -105,12 +108,12 @@ class Zend_Feed_Pubsubhubbub_Model_Subscription
|
|
|
.' of "' . $key . '" must be a non-empty string');
|
|
.' of "' . $key . '" must be a non-empty string');
|
|
|
}
|
|
}
|
|
|
$result = $this->_db->find($key);
|
|
$result = $this->_db->find($key);
|
|
|
- if ($result) {
|
|
|
|
|
|
|
+ if (count($result)) {
|
|
|
return true;
|
|
return true;
|
|
|
}
|
|
}
|
|
|
return false;
|
|
return false;
|
|
|
}
|
|
}
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
/**
|
|
/**
|
|
|
* Delete a subscription
|
|
* Delete a subscription
|
|
|
*
|
|
*
|
|
@@ -120,7 +123,7 @@ class Zend_Feed_Pubsubhubbub_Model_Subscription
|
|
|
public function deleteSubscription($key)
|
|
public function deleteSubscription($key)
|
|
|
{
|
|
{
|
|
|
$result = $this->_db->find($key);
|
|
$result = $this->_db->find($key);
|
|
|
- if ($result) {
|
|
|
|
|
|
|
+ if (count($result)) {
|
|
|
$this->_db->delete(
|
|
$this->_db->delete(
|
|
|
$this->_db->getAdapter()->quoteInto('id = ?', $key)
|
|
$this->_db->getAdapter()->quoteInto('id = ?', $key)
|
|
|
);
|
|
);
|
|
@@ -128,5 +131,5 @@ class Zend_Feed_Pubsubhubbub_Model_Subscription
|
|
|
}
|
|
}
|
|
|
return false;
|
|
return false;
|
|
|
}
|
|
}
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
}
|
|
}
|