Beispiel #1
0
 public function markExpiredForDelete()
 {
     $expirationPeriod = 3600 * 24 * 31 * 3;
     // Once in three month
     $expiredActionIds = $this->actionDao->findExpiredIdList($expirationPeriod);
     $this->markForDelete($expiredActionIds);
 }
 /**
  * Returns an instance of class (singleton pattern implementation).
  *
  * @return NEWSFEED_BOL_ActionDao
  */
 public static function getInstance()
 {
     if (self::$classInstance === null) {
         self::$classInstance = new self();
     }
     return self::$classInstance;
 }
Beispiel #3
0
 private function copyFeed()
 {
     if (OW::getPluginManager()->isPluginActive('newsfeed')) {
         $tbl = NEWSFEED_BOL_ActionDao::getInstance()->getTableName();
         $query = 'UPDATE ' . $tbl . ' SET pluginKey="equestions" WHERE pluginKey="questions"';
         OW::getDbo()->query($query);
     }
 }
Beispiel #4
0
 public function isDuplicateFeed($groupId, $content)
 {
     $actionDao = NEWSFEED_BOL_ActionDao::getInstance();
     $groupUrl = OW::getRouter()->urlForRoute('groups-view', array('groupId' => $groupId));
     $query = "SELECT data FROM " . $actionDao->getTableName() . "\n                  WHERE data LIKE '%" . $groupId . "\"}}'             \n                    AND entityType = 'groups-status'\n                    AND pluginKey = 'newsfeed'";
     $datas = $this->dbo->queryForList($query);
     foreach ($datas as $data) {
         if ($content == json_decode($data['data'])->string) {
             return true;
         }
     }
     return false;
 }
Beispiel #5
0
 public function getAction($entityType, $entityId)
 {
     $actionKey = $entityType . ':' . $entityId;
     if (empty($this->actionIdList[$actionKey])) {
         $action = NEWSFEED_BOL_ActionDao::getInstance()->findAction($entityType, $entityId);
         if ($action === null) {
             return null;
         }
         $activityList = $this->findActivityList($this->params, array($action->id));
         $action = $this->makeAction($action, $activityList);
         if ($action === null) {
             return null;
         }
         $this->actionList[$action->getId()] = $action;
         $this->actionIdList[$actionKey] = $action->getId();
     }
     return $this->actionList[$this->actionIdList[$actionKey]];
 }
Beispiel #6
0
 protected function findActionCount($params)
 {
     return NEWSFEED_BOL_ActionDao::getInstance()->findCountByFeed($params['feedType'], $params['feedId'], $params['startTime'], $params['formats']);
 }
Beispiel #7
0
 private function getQueryParts($conts)
 {
     $actionDao = NEWSFEED_BOL_ActionDao::getInstance();
     $or = array();
     $join = '';
     foreach ($conts as $cond) {
         $action = array_filter($cond['action']);
         $activity = array_filter($cond['activity']);
         $where = array();
         if (empty($activity['id'])) {
             if (!empty($action['id'])) {
                 $activity['actionId'] = $action['id'];
             } else {
                 if (!empty($action)) {
                     $join = 'INNER JOIN ' . $actionDao->getTableName() . ' action ON activity.actionId=action.id';
                     foreach ($action as $k => $v) {
                         $where[] = 'action.' . $k . "='" . $this->dbo->escapeString($v) . "'";
                     }
                 }
             }
         }
         foreach ($activity as $k => $v) {
             $where[] = 'activity.' . $k . "='" . $this->dbo->escapeString($v) . "'";
         }
         $or[] = implode(' AND ', $where);
     }
     return array('join' => $join, 'where' => empty($or) ? '1' : '( ' . implode(' ) OR ( ', $or) . ' )');
 }