Project

General

Profile

Actions

Enhancement(機能追加・改善) #2578

open

コミュニティ数が著しく多い場合にインフォメーションボックスを表示しやすくする

Added by Yuya Watanabe about 13 years ago. Updated almost 13 years ago.

Status:
Pending Review(レビュー待ち)
Priority:
Normal(通常)
Assignee:
Target version:
Start date:
2011-11-01
Due date:
% Done:

50%

Estimated time:

Description

概要

コミュニティ数が著しく多い場合にインフォメーションボックスを表示しやすくする.
例えばコミュニティ数が10000ほどあった場合にphp.iniのmax_execution_timeで設定されている時間を超えて表示できない場合がある.
これをOpenPNE側で対応する.

修正案

下記部分でコミュニティIDのみを取得するようにする.

diff --git a/lib/model/doctrine/CommunityMemberTable.class.php b/lib/model/doctrine/CommunityMemberTable.class.php
index 28e378b..067ed94 100644
--- a/lib/model/doctrine/CommunityMemberTable.class.php
+++ b/lib/model/doctrine/CommunityMemberTable.class.php
@@ -105,12 +105,16 @@ class CommunityMemberTable extends opAccessControlDoctrineTable

   public function getCommunityIdsOfAdminByMemberId($memberId)
   {
-    $objects = Doctrine::getTable('CommunityMemberPosition')->findByMemberIdAndName($memberId, 'admin');
+    $objects = Doctrine::getTable('CommunityMemberPosition')->createQuery()
+      ->select('community_id')
+      ->where('member_id = ?', $memberId)
+      ->andWhere('name = ?', 'admin')
+      ->execute(array(), Doctrine_Core::HYDRATE_NONE);

     $results = array();
     foreach ($objects as $obj)
     {
-      $results[] = $obj->getCommunityId();
+      $results[] = $obj[0];
     }
     return $results;
   }
Actions #1

Updated by Yuya Watanabe about 13 years ago

コード追跡

インフォメーションボックスを表示する部分.
apps/pc_frontend/modules/member/config/view.yml

  9     cautionAboutCommunityMemberPre:
 10       template    : [community, cautionAboutCommunityMemberPre]
 11       parts       : [information]
 12       target      : [bodyBottom]
 13       is_component: true

lib/action/opCommunityComponents.class.php

 21   public function executeCautionAboutCommunityMemberPre()
 22   {
 23     $memberId = sfContext::getInstance()->getUser()->getMemberId();
 24 
 25     $this->communityMembersCount = Doctrine::getTable('CommunityMember')->countCommunityMembersPre($memberId);
 26   }

lib/model/doctrine/CommunityMemberTable.class.php

146   public function countCommunityMembersPre($memberId)
147   {
148     $q = $this->getCommunityMembersPreQuery($memberId);
149     if (!$q)
150     {
151       return 0;
152     }
153 
154     return $q->count();
155   }

lib/model/doctrine/CommunityMemberTable.class.php

120   public function getCommunityMembersPreQuery($memberId)
121   {
122     $adminCommunityIds = $this->getCommunityIdsOfAdminByMemberId($memberId);
123 
124     if (count($adminCommunityIds))
125     {
126       return Doctrine::getTable('CommunityMember')->createQuery()
127         ->whereIn('community_id', $adminCommunityIds)
128         ->andWhere('is_pre = ?', true);
129     }
130 
131     return false;
132   }

lib/model/doctrine/CommunityMemberTable.class.php

106   public function getCommunityIdsOfAdminByMemberId($memberId)
107   {
108     $objects = Doctrine::getTable('CommunityMemberPosition')->findByMemberIdAndName($memberId, 'admin');
109 
110     $results = array();
111     foreach ($objects as $obj)
112     {
113       $results[] = $obj->getCommunityId();
114     }
115     return $results;
116   }

Actions #2

Updated by Yuya Watanabe about 13 years ago

  • Description updated (diff)
Actions #3

Updated by wa ta about 13 years ago

  • Status changed from Accepted(着手) to Pending Review(レビュー待ち)
  • % Done changed from 0 to 50

更新履歴 380427ffa343998aaff1970d085f7658bd3f4a74 で適用されました。

Actions #4

Updated by Shouta Kashiwagi almost 13 years ago

  • Target version changed from OpenPNE 3.7.0 to 252
Actions #5

Updated by Shouta Kashiwagi almost 13 years ago

  • Target version changed from 252 to OpenPNE 3.8.x
Actions

Also available in: Atom PDF