Example #1
0
 public function render($runData)
 {
     $site = $runData->getTemp("site");
     $pl = $runData->getParameterList();
     $categoryName = $pl->getParameterValue("category");
     $parmHash = md5(serialize($pl->asArray()));
     $key = 'listpagesfeed_v..' . $site->getUnixName() . '..' . $categoryName . '..' . $parmHash;
     $valid = true;
     $mc = OZONE::$memcache;
     $struct = $mc->get($key);
     if (!$struct) {
         $valid = false;
     }
     $cacheTimestamp = $struct['timestamp'];
     $now = time();
     // now check lc for ALL categories involved
     $cats = preg_split('/[,;\\s]+?/', $categoryName);
     foreach ($cats as $cat) {
         $tkey = 'pagecategory_lc..' . $site->getUnixName() . '..' . $cat;
         // last change timestamp
         $changeTimestamp = $mc->get($tkey);
         if ($changeTimestamp && $cacheTimestamp && $changeTimestamp <= $cacheTimestamp) {
             //cache valid
         } else {
             $valid = false;
             if (!$changeTimestamp) {
                 // 	put timestamp
                 $mc->set($tkey, $now, 0, 864000);
                 $valid = false;
             }
         }
     }
     if (count($cats) == 0) {
         $akey = 'pageall_lc..' . $site->getUnixName();
         $allPagesTimestamp = $mc->get($akey);
         if ($allPagesTimestamp && $cacheTimestamp && $allPagesTimestamp <= $cacheTimestamp) {
             //cache valid
         } else {
             $valid = false;
             if (!$allPagesTimestamp) {
                 // 	put timestamp
                 $mc->set($akey, $now, 0, 864000);
                 $valid = false;
             }
         }
     }
     if ($valid) {
         $this->vars = $struct['vars'];
         return $struct['content'];
     }
     $out = parent::render($runData);
     // and store the data now
     $struct = array();
     $now = time();
     $struct['timestamp'] = $now;
     $struct['content'] = $out;
     $struct['vars'] = $this->vars;
     $mc->set($key, $struct, 0, 864000);
     return $out;
 }
 public function render($runData)
 {
     $user = $runData->getTemp("user");
     $key = "notificationsfeed.." . $user->getUserId();
     $mc = OZONE::$memcache;
     $out = $mc->get($key);
     if ($out) {
         return $out;
     }
     $out = parent::render($runData);
     $mc->set($key, $out, 0, 3600);
     return $out;
 }
 public function render($runData)
 {
     $user = $runData->getTemp("user");
     $key = "watchedpagechanges.." . $user->getUserId();
     $mc = OZONE::$memcache;
     $out = $mc->get($key);
     if ($out) {
         return $out;
     }
     $out = parent::render($runData);
     $mc->set($key, $out, 0, 600);
     return $out;
 }
Example #4
0
 public function render($runData)
 {
     $site = $runData->getTemp("site");
     $key = "sitechangesfeed.." . $site->getSiteId();
     $mc = OZONE::$memcache;
     $out = $mc->get($key);
     if ($out) {
         return $out;
     }
     $out = parent::render($runData);
     $mc->set($key, $out, 0, 3600);
     return $out;
 }
Example #5
0
 public function render($runData)
 {
     $site = $runData->getTemp("site");
     $pl = $runData->getParameterList();
     $pageId = $pl->getParameterValue("p");
     $parmHash = md5(serialize($pl->asArray()));
     $key = 'pagecommentsfeed_f..' . $site->getUnixName() . '..' . $pageId . '..' . $parmHash;
     $akey = 'forumall_lc..' . $site->getUnixName();
     $mc = OZONE::$memcache;
     $struct = $mc->get($key);
     $allForumTimestamp = $mc->get($akey);
     if ($struct) {
         // check the times
         $cacheTimestamp = $struct['timestamp'];
         $threadId = $struct['threadId'];
         $tkey = 'forumthread_lc..' . $site->getUnixName() . '..' . $threadId;
         // last change timestamp
         $changeTimestamp = $mc->get($tkey);
         if ($changeTimestamp && $changeTimestamp <= $cacheTimestamp && $allForumTimestamp && $allForumTimestamp <= $cacheTimestamp) {
             $runData->ajaxResponseAdd("threadId", $threadId);
             return $struct['content'];
         }
     }
     $out = parent::render($runData);
     // and store the data now
     $struct = array();
     $now = time();
     $struct['timestamp'] = $now;
     $struct['content'] = $out;
     $struct['threadId'] = $this->threadId;
     if (!$changeTimestamp) {
         $tkey = 'forumthread_lc..' . $site->getUnixName() . '..' . $this->threadId;
         // last change timestamp
         $changeTimestamp = $mc->get($tkey);
     }
     $mc->set($key, $struct, 0, 1000);
     if (!$changeTimestamp) {
         $tkey = 'forumthread_lc..' . $site->getUnixName() . '..' . $this->threadId;
         $changeTimestamp = $now;
         $mc->set($tkey, $changeTimestamp, 0, 1000);
     }
     if (!$allForumTimestamp) {
         $allForumTimestamp = $now;
         $mc->set($akey, $allForumTimestamp, 0, 10000);
     }
     return $out;
 }
 public function render($runData)
 {
     $user = $runData->getTemp("user");
     $site = $runData->getTemp("site");
     // check if site admin
     $c = new Criteria();
     $c->add("site_id", $site->getSiteId());
     $c->add("user_id", $user->getUserId());
     $admin = DB_AdminPeer::instance()->selectOne($c);
     if ($admin == null) {
         return _("Sorry, you are not allowed to view this feed.");
     }
     $key = "adminnotificationsfeed.." . $site->getSiteId();
     $mc = OZONE::$memcache;
     $out = $mc->get($key);
     if ($out) {
         return $out;
     }
     $out = parent::render($runData);
     $mc->set($key, $out, 0, 3600);
     return $out;
 }
 public function render($runData)
 {
     $site = $runData->getTemp("site");
     $pl = $runData->getParameterList();
     $categoryId = $pl->getParameterValue("c");
     $parmHash = md5(serialize($pl->asArray()));
     $key = 'forumcategoryposts_f..' . $site->getUnixName() . '..' . $categoryId . '..' . $parmHash;
     $tkey = 'forumcategory_lc..' . $site->getUnixName() . '..' . $categoryId;
     // last change timestamp
     $akey = 'forumall_lc..' . $site->getUnixName();
     $mc = OZONE::$memcache;
     $struct = $mc->get($key);
     $cacheTimestamp = $struct['timestamp'];
     $changeTimestamp = $mc->get($tkey);
     $allForumTimestamp = $mc->get($akey);
     if ($struct) {
         // check the times
         if ($changeTimestamp && $changeTimestamp <= $cacheTimestamp && $allForumTimestamp && $allForumTimestamp <= $cacheTimestamp) {
             return $struct['content'];
         }
     }
     $out = parent::render($runData);
     // and store the data now
     $struct = array();
     $now = time();
     $struct['timestamp'] = $now;
     $struct['content'] = $out;
     $mc->set($key, $struct, 0, 1000);
     if (!$changeTimestamp) {
         $changeTimestamp = $now;
         $mc->set($tkey, $changeTimestamp, 0, 1000);
     }
     if (!$allForumTimestamp) {
         $allForumTimestamp = $now;
         $mc->set($akey, $allForumTimestamp, 0, 10000);
     }
     return $out;
 }
Example #8
0
 public function render($runData)
 {
     $site = $runData->getTemp("site");
     $pl = $runData->getParameterList();
     $pageName = $pl->getParameterValue("page");
     $label = $pl->getParameterValue("label");
     $key = 'frontforumfeed..' . $site->getUnixName() . '..' . $pageName . '..' . $label;
     $valid = true;
     $mc = OZONE::$memcache;
     $struct = $mc->get($key);
     if (!$struct) {
         $valid = false;
     }
     $cacheTimestamp = $struct['timestamp'];
     $fkey = "frontforumfeedobject.." . $site->getUnixName() . '..' . $pageName . '..' . $label;
     $feed = $mc->get($fkey);
     if (!$feed) {
         $page = DB_PagePeer::instance()->selectByName($site->getSiteId(), $pageName);
         // 	get the feed object
         $c = new Criteria();
         $c->add("page_id", $page->getPageId());
         $c->add("label", $label);
         $feed = DB_FrontForumFeedPeer::instance()->selectOne($c);
         $mc->set($fkey, $feed, 0, 3600);
     }
     $now = time();
     $categoryIds = $feed->getCategories();
     // now check lc for ALL categories involved
     $cats = preg_split('/[,;] ?/', $categoryIds);
     foreach ($cats as $cat) {
         $tkey = 'forumcategory_lc..' . $site->getUnixName() . '..' . $cat;
         // last change timestamp
         $changeTimestamp = $mc->get($tkey);
         if ($changeTimestamp && $cacheTimestamp && $changeTimestamp <= $cacheTimestamp) {
             //cache valid
         } else {
             $valid = false;
             if (!$changeTimestamp) {
                 // 	put timestamp
                 $mc->set($tkey, $now, 0, 10000);
                 $valid = false;
             }
         }
     }
     $akey = 'forumall_lc..' . $site->getUnixName();
     $allForumTimestamp = $mc->get($akey);
     if ($allForumTimestamp && $cacheTimestamp && $changeTimestamp <= $cacheTimestamp) {
         //cache valid
     } else {
         if (!$allForumTimestamp) {
             $mc->set($akey, $now, 0, 10000);
         }
     }
     if ($valid) {
         return $struct['content'];
     }
     $out = parent::render($runData);
     // and store the data now
     $struct = array();
     $now = time();
     $struct['timestamp'] = $now;
     $struct['content'] = $out;
     $mc->set($key, $struct, 0, 1000);
     return $out;
 }