summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEvan Prodromou <evan@prodromou.name>2008-09-05 21:55:01 -0400
committerEvan Prodromou <evan@prodromou.name>2008-09-05 21:55:01 -0400
commit0c71340c9fecfad17d2619dfa44cb669023f8179 (patch)
tree1c936b6ffb2361a15a4e71fba2ffed5ce1226b73
parent9e8ae6a1e79c51baeca1063810ad96dadeab714d (diff)
free and unset DB_DataObjects after we're done with them
darcs-hash:20080906015501-84dde-e787962b9805759224389dd42a211dfa21da3473.gz
-rw-r--r--lib/jabber.php9
-rw-r--r--lib/omb.php6
-rw-r--r--lib/queuehandler.php6
-rwxr-xr-xscripts/xmppconfirmhandler.php6
-rwxr-xr-xscripts/xmppdaemon.php7
5 files changed, 34 insertions, 0 deletions
diff --git a/lib/jabber.php b/lib/jabber.php
index a9643f4a6..bd7d6b707 100644
--- a/lib/jabber.php
+++ b/lib/jabber.php
@@ -92,6 +92,7 @@ function jabber_send_notice($to, $notice) {
$msg = jabber_format_notice($profile, $notice);
$entry = jabber_format_entry($profile, $notice);
$conn->message($to, $msg, 'chat', NULL, $entry);
+ $profile->free();
return true;
}
@@ -204,6 +205,9 @@ function jabber_broadcast_notice($notice) {
$msg = jabber_format_notice($profile, $notice);
$entry = jabber_format_entry($profile, $notice);
+ $profile->free();
+ unset($profile);
+
$sent_to = array();
$conn = jabber_connect();
@@ -225,6 +229,8 @@ function jabber_broadcast_notice($notice) {
$sent_to[$user->id] = 1;
}
+ $user->free();
+
# Now, get users subscribed to this profile
$user = new User();
@@ -245,6 +251,8 @@ function jabber_broadcast_notice($notice) {
}
}
+ $user->free();
+
return true;
}
@@ -280,6 +288,7 @@ function jabber_public_notice($notice) {
$conn->message($address, $msg, 'chat', NULL, $entry);
$conn->processTime(0);
}
+ $profile->free();
}
return true;
diff --git a/lib/omb.php b/lib/omb.php
index b1e8ab181..d4f53c332 100644
--- a/lib/omb.php
+++ b/lib/omb.php
@@ -132,6 +132,9 @@ function omb_broadcast_remote_subscribers($notice) {
}
}
+ $rp->free();
+ unset($rp);
+
return true;
}
@@ -160,6 +163,9 @@ function omb_post_notice_keys($notice, $postnoticeurl, $tk, $secret) {
$notice->id)));
$req->set_parameter('omb_notice_license', common_config('license', 'url'));
+ $user->free();
+ unset($user);
+
$req->sign_request(omb_hmac_sha1(), $con, $token);
# We re-use this tool's fetcher, since it's pretty good
diff --git a/lib/queuehandler.php b/lib/queuehandler.php
index d673f7f94..237df9a7b 100644
--- a/lib/queuehandler.php
+++ b/lib/queuehandler.php
@@ -87,11 +87,15 @@ class QueueHandler extends Daemon {
continue;
}
$this->log(LOG_INFO, 'finished broadcasting notice ID = ' . $notice->id);
+ $notice->free();
+ unset($notice);
$notice = NULL;
} else {
$this->log(LOG_WARNING, 'queue item for notice that does not exist');
}
$qi->delete();
+ $qi->free();
+ unset($qi);
$this->idle(0);
} else {
$this->clear_old_claims();
@@ -115,6 +119,8 @@ class QueueHandler extends Daemon {
$qi->transport = $this->transport();
$qi->whereAdd('now() - claimed > '.CLAIM_TIMEOUT);
$qi->update(DB_DATAOBJECT_WHEREADD_ONLY);
+ $qi->free();
+ unset($qi);
}
function log($level, $msg) {
diff --git a/scripts/xmppconfirmhandler.php b/scripts/xmppconfirmhandler.php
index d3b8ac85a..d1735d8d2 100755
--- a/scripts/xmppconfirmhandler.php
+++ b/scripts/xmppconfirmhandler.php
@@ -76,6 +76,10 @@ class XmppConfirmHandler extends XmppQueueHandler {
continue;
}
}
+ $user->free();
+ unset($user);
+ $confirm->free();
+ unset($confirm);
$this->idle(0);
} else {
# $this->clear_old_confirm_claims();
@@ -119,6 +123,8 @@ class XmppConfirmHandler extends XmppQueueHandler {
$confirm->claimed = NULL;
$confirm->whereAdd('now() - claimed > '.CLAIM_TIMEOUT);
$confirm->update(DB_DATAOBJECT_WHEREADD_ONLY);
+ $confirm->free();
+ unset($confirm);
}
}
diff --git a/scripts/xmppdaemon.php b/scripts/xmppdaemon.php
index c5a53e457..e067fdcdb 100755
--- a/scripts/xmppdaemon.php
+++ b/scripts/xmppdaemon.php
@@ -145,6 +145,9 @@ class XMPPDaemon extends Daemon {
}
$this->add_notice($user, $pl);
}
+
+ $user->free();
+ unset($user);
}
function is_self($from) {
@@ -281,6 +284,8 @@ class XMPPDaemon extends Daemon {
common_broadcast_notice($notice);
$this->log(LOG_INFO,
'Added notice ' . $notice->id . ' from user ' . $user->nickname);
+ $notice->free();
+ unset($notice);
}
function handle_presence(&$pl) {
@@ -310,6 +315,8 @@ class XMPPDaemon extends Daemon {
' status from presence.');
$this->add_notice($user, $pl);
}
+ $user->free();
+ unset($user);
}
break;
}