本文整理匯總了PHP中Subscription::query方法的典型用法代碼示例。如果您正苦於以下問題:PHP Subscription::query方法的具體用法?PHP Subscription::query怎麽用?PHP Subscription::query使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Subscription
的用法示例。
在下文中一共展示了Subscription::query方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: destroy
function destroy($args, $apidata)
{
parent::handle($args);
if (!in_array($_SERVER['REQUEST_METHOD'], array('POST', 'DELETE'))) {
$this->clientError(_('This method requires a POST or DELETE.'), 400, $apidata['content-type']);
return;
}
$id = $apidata['api_arg'];
# We can't subscribe to a remote person, but we can unsub
$other = $this->get_profile($id);
$user = $apidata['user'];
$sub = new Subscription();
$sub->subscriber = $user->id;
$sub->subscribed = $other->id;
if ($sub->find(true)) {
$sub->query('BEGIN');
$sub->delete();
$sub->query('COMMIT');
} else {
$this->clientError(_('You are not friends with the specified user.'), 403, $apidata['content-type']);
return;
}
$type = $apidata['content-type'];
$this->init_document($type);
$this->show_profile($other, $type);
$this->end_document($type);
}
示例2: get_blocked_subs
/**
* Fetch subscriptions that should be disallowed by a block
*/
function get_blocked_subs()
{
$query = "SELECT subscription.* " . "FROM subscription " . "INNER JOIN profile_block " . "ON blocker=subscribed " . "AND blocked=subscriber";
$subscription = new Subscription();
$subscription->query($query);
return $subscription;
}
示例3: initSubscriptionURI
function initSubscriptionURI()
{
printfnq("Ensuring all subscriptions have a URI...");
$sub = new Subscription();
$sub->whereAdd('uri IS NULL');
if ($sub->find()) {
while ($sub->fetch()) {
try {
$sub->decache();
$sub->query(sprintf('update subscription ' . 'set uri = "%s" ' . 'where subscriber = %d ' . 'and subscribed = %d', Subscription::newURI($sub->subscriber, $sub->subscribed, $sub->created), $sub->subscriber, $sub->subscribed));
} catch (Exception $e) {
common_log(LOG_ERR, "Error updated subscription URI: " . $e->getMessage());
}
}
}
printfnq("DONE.\n");
}