プロジェクト

全般

プロフィール

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

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

Yuya Watanabe12年以上前に追加. ほぼ12年前に更新.

ステータス:
Pending Review(レビュー待ち)
優先度:
Normal(通常)
担当者:
対象バージョン:
開始日:
2011-11-01
期日:
進捗率:

50%


説明

概要

コミュニティ数が著しく多い場合にインフォメーションボックスを表示しやすくする.
例えばコミュニティ数が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;
   }

関係しているリビジョン

リビジョン 380427ff (差分)
Yuya Watanabe12年以上前に追加

(fixed #2578) modified the DQL not to get whole the CommunityMemberPosition data

履歴

#1 Yuya Watanabe12年以上前に更新

コード追跡

インフォメーションボックスを表示する部分.
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   }

#2 Yuya Watanabe12年以上前に更新

  • 説明 を更新 (diff)

#3 wa ta12年以上前に更新

  • ステータスAccepted(着手) から Pending Review(レビュー待ち) に変更
  • 進捗率0 から 50 に変更

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

#4 Shouta Kashiwagi約12年前に更新

  • 対象バージョンOpenPNE 3.7.0 から 252 に変更

#5 Shouta Kashiwagiほぼ12年前に更新

  • 対象バージョン252 から OpenPNE 3.8.x に変更

他の形式にエクスポート: Atom PDF