@@ -28,6 +28,14 @@ class FinderHelper
2828 */
2929 public static $ extension = 'com_finder ' ;
3030
31+ /**
32+ * The finder plugin id.
33+ *
34+ * @var integer
35+ * @since __DEPLOY_VERSION__
36+ */
37+ protected static $ pluginId ;
38+
3139 /**
3240 * Gets the finder system plugin extension id.
3341 *
@@ -37,23 +45,26 @@ class FinderHelper
3745 */
3846 public static function getFinderPluginId ()
3947 {
40- $ db = Factory::getDbo ();
41- $ query = $ db ->getQuery (true )
42- ->select ($ db ->quoteName ('extension_id ' ))
43- ->from ($ db ->quoteName ('#__extensions ' ))
44- ->where ($ db ->quoteName ('folder ' ) . ' = ' . $ db ->quote ('content ' ))
45- ->where ($ db ->quoteName ('element ' ) . ' = ' . $ db ->quote ('finder ' ));
46- $ db ->setQuery ($ query );
47-
48- try
48+ if (self ::$ pluginId === null )
4949 {
50- $ result = (int ) $ db ->loadResult ();
51- }
52- catch (\RuntimeException $ e )
53- {
54- Factory::getApplication ()->enqueueMessage ($ e ->getMessage (), 'error ' );
50+ $ db = Factory::getDbo ();
51+ $ query = $ db ->getQuery (true )
52+ ->select ($ db ->quoteName ('extension_id ' ))
53+ ->from ($ db ->quoteName ('#__extensions ' ))
54+ ->where ($ db ->quoteName ('folder ' ) . ' = ' . $ db ->quote ('content ' ))
55+ ->where ($ db ->quoteName ('element ' ) . ' = ' . $ db ->quote ('finder ' ));
56+ $ db ->setQuery ($ query );
57+
58+ try
59+ {
60+ self ::$ pluginId = (int ) $ db ->loadResult ();
61+ }
62+ catch (\RuntimeException $ e )
63+ {
64+ Factory::getApplication ()->enqueueMessage ($ e ->getMessage (), 'error ' );
65+ }
5566 }
5667
57- return $ result ;
68+ return self :: $ pluginId ;
5869 }
5970}
0 commit comments