From 9924a1e3759b055d246c2bee04f7a0f7883cd6e4 Mon Sep 17 00:00:00 2001 From: sakamocchi Date: Sun, 20 May 2012 23:15:00 +0900 Subject: [PATCH] =?utf8?q?ADD:=20listplug=5Ftable=5Fpluginlist()=E3=81=AB?= =?utf8?q?=E9=96=A2=E6=95=B0=E5=86=85=E3=82=AD=E3=83=A3=E3=83=83=E3=82=B7?= =?utf8?q?=E3=83=A5=E3=82=92=E8=BF=BD=E5=8A=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit インストールされているすべてのプラグインを、HEAD/BODY/FOOTの3回取得していた。情報としては同じなので、関数内キャッシュを実装してクエリ発行回数を削減した。 --- nucleus/libs/showlist.php | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/nucleus/libs/showlist.php b/nucleus/libs/showlist.php index 201284c..98f2392 100644 --- a/nucleus/libs/showlist.php +++ b/nucleus/libs/showlist.php @@ -392,6 +392,7 @@ function listplug_table_teamlist($vars, $type, $templateName = '') function listplug_table_pluginlist($vars, $type, $templateName = '') { + static $plugins = array(); global $manager; $templates = array(); @@ -536,11 +537,13 @@ function listplug_table_pluginlist($vars, $type, $templateName = '') $data['dependlist'] = ''; } /* check dependency */ - $req = array(); - $res = DB::getResult('SELECT pfile FROM ' . sql_table('plugin')); - foreach ( $res as $row ) + if ( empty($plugins) ) { - $preq =& $manager->getPlugin($row['pfile']); + $plugins = DB::getResult('SELECT pfile FROM ' . sql_table('plugin')); + } + foreach ( $plugins as $plugin ) + { + $preq =& $manager->getPlugin($plugin['pfile']); if ( $preq ) { $depList = $preq->getPluginDep(); @@ -548,7 +551,7 @@ function listplug_table_pluginlist($vars, $type, $templateName = '') { if ( $current->pfile == $depName ) { - $req[] = $row['pfile']; + $req[] = $plugin['pfile']; } } } -- 2.11.0