mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-01-04 01:01:41 +09:00
Cache module config in point triggers
This commit is contained in:
parent
d4136f9081
commit
0b71f425ed
2 changed files with 34 additions and 8 deletions
|
|
@ -7,6 +7,23 @@
|
|||
*/
|
||||
class point extends ModuleObject
|
||||
{
|
||||
/**
|
||||
* @brief Configuration cache
|
||||
*/
|
||||
protected static $_config = null;
|
||||
|
||||
/**
|
||||
* @brief Shortcut to getting module configuration
|
||||
*/
|
||||
public function getConfig()
|
||||
{
|
||||
if (self::$_config === null)
|
||||
{
|
||||
self::$_config = getModel('module')->getModuleConfig('point');
|
||||
}
|
||||
return self::$_config;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Additional tasks required to accomplish during the installation
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -7,6 +7,11 @@
|
|||
*/
|
||||
class pointController extends point
|
||||
{
|
||||
/**
|
||||
* @brief Cache module point config
|
||||
*/
|
||||
protected static $_module_point_config = array();
|
||||
|
||||
/**
|
||||
* @brief Initialization
|
||||
*/
|
||||
|
|
@ -25,7 +30,7 @@ class pointController extends point
|
|||
return new Object();
|
||||
}
|
||||
|
||||
$config = getModel('module')->getModuleConfig('point');
|
||||
$config = $this->getConfig();
|
||||
$point = intval($config->signup_point);
|
||||
if (!$point)
|
||||
{
|
||||
|
|
@ -55,7 +60,7 @@ class pointController extends point
|
|||
return new Object();
|
||||
}
|
||||
|
||||
$config = getModel('module')->getModuleConfig('point');
|
||||
$config = $this->getConfig();
|
||||
$point = intval($config->login_point);
|
||||
if (!$point)
|
||||
{
|
||||
|
|
@ -74,7 +79,7 @@ class pointController extends point
|
|||
public function triggerDeleteGroup($obj)
|
||||
{
|
||||
$group_srl = $obj->group_srl;
|
||||
$config = getModel('module')->getModuleConfig('point');
|
||||
$config = $this->getConfig();
|
||||
|
||||
// Exclude deleted group from point/level/group integration
|
||||
if($config->point_group && isset($config->point_group[$group_srl]))
|
||||
|
|
@ -381,7 +386,7 @@ class pointController extends point
|
|||
$cur_point = $member_srl ? getModel('point')->getPoint($member_srl, true) : 0;
|
||||
|
||||
// If the user (member or guest) does not have enough points, deny access.
|
||||
$config = getModel('module')->getModuleConfig('point');
|
||||
$config = $this->getConfig();
|
||||
if ($config->disable_download == 'Y' && $cur_point + $point < 0)
|
||||
{
|
||||
return new Object(-1, 'msg_cannot_download');
|
||||
|
|
@ -455,7 +460,7 @@ class pointController extends point
|
|||
$cur_point = $member_srl ? getModel('point')->getPoint($member_srl, true) : 0;
|
||||
|
||||
// If the user (member or guest) does not have enough points, deny access.
|
||||
$config = getModel('module')->getModuleConfig('point');
|
||||
$config = $this->getConfig();
|
||||
if($config->disable_read_document == 'Y' && $cur_point + $point < 0)
|
||||
{
|
||||
$message = sprintf(lang('msg_disallow_by_point'), abs($point), $cur_point);
|
||||
|
|
@ -737,11 +742,15 @@ class pointController extends point
|
|||
|
||||
if ($module_srl)
|
||||
{
|
||||
$module_config = $oModuleModel->getModulePartConfig('point', $module_srl);
|
||||
if (!isset(self::$_module_point_config[$module_srl]))
|
||||
{
|
||||
self::$_module_point_config[$module_srl] = $oModuleModel->getModulePartConfig('point', $module_srl);
|
||||
}
|
||||
$module_config = self::$_module_point_config[$module_srl];
|
||||
}
|
||||
else
|
||||
{
|
||||
$module_config = null;
|
||||
$module_config = array();
|
||||
}
|
||||
|
||||
if (isset($module_config[$config_key]) && $module_config[$config_key] !== '')
|
||||
|
|
@ -750,7 +759,7 @@ class pointController extends point
|
|||
}
|
||||
else
|
||||
{
|
||||
$default_config = $oModuleModel->getModuleConfig('point');
|
||||
$default_config = $this->getConfig();
|
||||
$point = $default_config->{$config_key};
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue