Index: branches/5.1.x/core/units/phrases/phrase_tp.php =================================================================== diff -u -N -r13151 -r13453 --- branches/5.1.x/core/units/phrases/phrase_tp.php (.../phrase_tp.php) (revision 13151) +++ branches/5.1.x/core/units/phrases/phrase_tp.php (.../phrase_tp.php) (revision 13453) @@ -1,6 +1,6 @@ Application->GetVar('simple_mode') && (int)$this->Application->ConfigValue('UsePopups'); } + + function PhraseCount($params) + { + static $cache = null; + + if (!isset($cache)) { + $sql = 'SELECT COUNT(*), Module + FROM ' . $this->Application->getUnitOption($this->Prefix, 'TableName') . ' + GROUP BY Module'; + $cache = $this->Conn->GetCol($sql, 'Module'); + } + + $module = $params['module']; + + return array_key_exists($module, $cache) ? $cache[$module] : 0; + } + + function EventCount($params) + { + static $cache = null; + + if (!isset($cache)) { + $sql = 'SELECT COUNT(*), IF(Module LIKE "Core:%", "Core", Module) AS Module + FROM ' . $this->Application->getUnitOption('emailevents', 'TableName') . ' + GROUP BY Module'; + $cache = $this->Conn->GetCol($sql, 'Module'); + } + + $module = $params['module']; + + return array_key_exists($module, $cache) ? $cache[$module] : 0; + } } \ No newline at end of file