// XXX: Before we were blowing the casche only if the notice id
// was not the root of the conversation. What to do now?
- $this->blowStream('notice:conversation_ids:%d', $this->conversation);
+ self::blow('notice:conversation_ids:%d', $this->conversation);
+ self::blow('conversation::notice_count:%d', $this->conversation);
if (!empty($this->repeat_of)) {
- self::blow('notice:repeats:%d', $this->repeat_of);
+ $this->blowStream('notice:repeats:%d', $this->repeat_of);
}
$original = Notice::staticGet('id', $this->repeat_of);
if ($this->isPublic()) {
self::blow('public;last');
}
+
+ self::blow('fave:by_notice', $this->id);
+
+ if ($this->conversation) {
+ // In case we're the first, will need to calc a new root.
+ self::blow('notice:conversation_root:%d', $this->conversation);
+ }
+
+ $ptags = $this->getProfileTags();
+ foreach ($ptags as $ptag) {
+ $ptag->blowNoticeStreamCache(true);
+ }
}
+ function blowStream()
+ {
+ $c = self::memcache();
+
+ if (empty($c)) {
+ return false;
+ }
+
+ $args = func_get_args();
+
+ $format = array_shift($args);
+
+ $keyPart = vsprintf($format, $args);
+
+ $cacheKey = Cache::key($keyPart);
+
+ $c->delete($cacheKey);
+
+ // delete the "last" stream, too, if this notice is
+ // older than the top of that stream
+
+ $lastKey = $cacheKey.';last';
+
+ $lastStr = $c->get($lastKey);
+
+ if ($lastStr !== false) {
+ $window = explode(',', $lastStr);
+ $lastID = $window[0];
+ $lastNotice = Notice::staticGet('id', $lastID);
+ if (empty($lastNotice) // just weird
+ || strtotime($lastNotice->created) >= strtotime($this->created)) {
+ $c->delete($lastKey);
+ }
+ }
+ }
+
/** save all urls in the notice to the db
*
* follow redirects and save all available file information
}
if (Event::handle('StartShowStatusNetScripts', array($this)) &&
Event::handle('StartShowLaconicaScripts', array($this))) {
- $this->script('util.min.js');
+ if (common_config('site', 'minify')) {
+ $this->script('util.min.js');
+ } else {
+ $this->script('util.js');
+ $this->script('xbImportNode.js');
+ $this->script('geometa.js');
+ }
+ $this->inlineScript('var _peopletagAC = "' .
+ common_local_url('peopletagautocomplete') . '";');
$this->showScriptMessages();
// Frame-busting code to avoid clickjacking attacks.
- $this->inlineScript('if (window.top !== window.self) { window.top.location.href = window.self.location.href; }');
+ if (common_config('javascript', 'bustframes')) {
+ $this->inlineScript('if (window.top !== window.self) { window.top.location.href = window.self.location.href; }');
+ }
Event::handle('EndShowStatusNetScripts', array($this));
Event::handle('EndShowLaconicaScripts', array($this));
}