summaryrefslogtreecommitdiff
path: root/lib/util.php
diff options
context:
space:
mode:
authorEvan Prodromou <evan@prodromou.name>2008-07-04 01:04:25 -0400
committerEvan Prodromou <evan@prodromou.name>2008-07-04 01:04:25 -0400
commit73a0271960a5e7e2bc6e040595d3071d7b689a99 (patch)
tree569be28a814427c5b0005e4b96ef536ba14ddc60 /lib/util.php
parent784299c25778fccb3292b4f339446f37c11d2bf9 (diff)
enqueue notices for offline broadcast
darcs-hash:20080704050425-84dde-d0106845c7b16b80be8e0d5ee9ac93a457334df7.gz
Diffstat (limited to 'lib/util.php')
-rw-r--r--lib/util.php21
1 files changed, 20 insertions, 1 deletions
diff --git a/lib/util.php b/lib/util.php
index 4d1abe51a..03d549334 100644
--- a/lib/util.php
+++ b/lib/util.php
@@ -808,6 +808,25 @@ function common_redirect($url, $code=307) {
}
function common_broadcast_notice($notice, $remote=false) {
+ if (common_config('queue', 'enabled')) {
+ # Do it later!
+ common_enqueue_notice($notice);
+ } else {
+ common_real_broadcast($notice, $remote);
+ }
+}
+
+# Stick the notice on the queue
+
+function common_enqueue_notice($notice) {
+ $qi = new Queue_item();
+ $qi->notice_id = $notice->id;
+ $qi->created = DB_DataObject_Cast::dateTime();
+ $result = $qi->insert();
+ return $result;
+}
+
+function common_real_broadcast($notice, $remote=false) {
// XXX: optionally use a queue system like http://code.google.com/p/microapps/wiki/NQDQ
if (!$remote) {
# Make sure we have the OMB stuff
@@ -939,7 +958,7 @@ function common_ensure_syslog() {
function common_log($priority, $msg, $filename=NULL) {
common_ensure_syslog();
-# syslog($priority, $msg);
+ syslog($priority, $msg);
}
function common_debug($msg, $filename=NULL) {