<commit_before><?php
    /**
     * @class  moduleController
     * @author NHN (<EMAIL>)
     * @brief controller class of the module module
     **/

    class moduleController extends module {

        /**
         * @brief Initialization
         **/
        function init() {
        }

        /**
         * @brief Add action forward
         * Action forward finds and forwards if an action is not in the requested module
         * This is used when installing a module
         **/
        function insertActionForward($module, $type, $act) {
            $args->module = $module;
            $args->type = $type;
            $args->act = $act;

            $output = executeQuery('module.insertActionForward', $args);
            return $output;
        }

        /**
         * @brief Delete action forward
         **/
        function deleteActionForward($module, $type, $act) {
            $args->module = $module;
            $args->type = $type;
            $args->act = $act;

            $output = executeQuery('module.deleteActionForward', $args);
            return $output;
        }

        /**
         * @brief Add module trigger
         * module trigger is to call a trigger to a target module
         *
         **/
        function insertTrigger($trigger_name, $module, $type, $called_method, $called_position) {
            $args->trigger_name = $trigger_name;
            $args->module = $module;
            $args->type = $type;
            $args->called_method = $called_method;
            $args->called_position = $called_position;

            $output = executeQuery('module.insertTrigger', $args);

            //remove from cache
            $oCacheHandler = &CacheHandler::getInstance('object');
            if($oCacheHandler->isSupport())
            {
                $cache_key = 'object:'.$trigger_name.'_'.$called_position;
                $oCacheHandler->delete($cache_key);
            }

            // Delete all the files which contain trigger information
            FileHandler::removeFilesInDir("./files/cache/triggers");

            return $output;

        }

        /**
         * @brief Delete module trigger
         *
         **/
        function deleteTrigger($trigger_name, $module, $type, $called_method, $called_position) {
            $args->trigger_name = $trigger_name;
            $args->module = $module;
            $args->type = $type;
            $args->called_method = $called_method;
            $args->called_position = $called_position;

            $output = executeQuery('module.deleteTrigger', $args);

            //remove from cache
            $oCacheHandler = &CacheHandler::getInstance('object');
            if($oCacheHandler->isSupport())
            {
                $cache_key = 'object:'.$trigger_name.'_'.$called_position;
                $oCacheHandler->delete($cache_key);
            }

            // Remove the trigger cache
            FileHandler::removeFilesInDir('./files/cache/triggers');

            return $output;
        }

        /**
         * @brief Add module extend
         *
         **/
		function insertModuleExtend($parent_module, $extend_module, $type, $kind=''){
			if($kind != 'admin') $kind = '';
			if(!in_array($type,array('model','controller','view','api','mobile'))) return false;
			if(in_array($parent_module, array('module','addon','widget','layout'))) return false;

			$cache_file = './files/config/module_extend.php';
			FileHandler::removeFile($cache_file);

            $args->parent_module = $parent_module;
            $args->extend_module = $extend_module;
            $args->type = $type;
            $args->kind = $kind;

            $output = executeQuery('module.getModuleExtendCount', $args);
			if($output->data->count>0) return false;

            $output = executeQuery('module.insertModuleExtend', $args);
			return $output;
		}

        /**
         * @brief Delete module extend
         *
         **/
		function deleteModuleExtend($parent_module, $extend_module, $type, $kind=''){
			$cache_file = './files/config/module_extend.php';
			FileHandler::removeFile($cache_file);

            $args->parent_module = $parent_module;
            $args->extend_module = $extend_module;
            $args->type = $type;
            $args->kind = $kind;

            $output = executeQuery('module.deleteModuleExtend', $args);

			return $output;
		}


		function updateModuleConfig($module, $config, $site_srl = 0){
			$args->module = $module;
			$args->site_srl = $site_srl;

			$oModuleModel = &getModel('module');
			$origin_config = $oModuleModel->getModuleConfig($module, $site_srl);

			foreach($config as $key => $val){
				$origin_config->{$key} = $val;
			}

			return $this->insertModuleConfig($module, $origin_config, $site_srl);
                        //remove from cache
                        $oCacheHandler = &CacheHandler::getInstance('object');
                        if($oCacheHandler->isSupport())
                        {
                            $cache_key = 'object:module_config:module_'.$module.'_site_srl_'.$site_srl;
                            $oCacheHandler->delete($cache_key);
                        }
		}

        /**
         * @brief Enter a specific set of modules
         * In order to manage global configurations of modules such as board, member and so on
         **/
        function insertModuleConfig($module, $config, $site_srl = 0) {
            $args->module = $module;
            $args->config = serialize($config);
			$args->site_srl = $site_srl;

            $output = executeQuery('module.deleteModuleConfig', $args);
            if(!$output->toBool()) return $output;

            $output = executeQuery('module.insertModuleConfig', $args);
            return $output;
        }

        /**
         * @brief Save module configurations of the mid
         * Manage mid configurations depending on module
         **/
        function insertModulePartConfig($module, $module_srl, $config) {
            $args->module = $module;
            $args->module_srl = $module_srl;
            $args->config = serialize($config);

            $output = executeQuery('module.deleteModulePartConfig', $args);
            if(!$output->toBool()) return $output;

            //remove from cache
            $oCacheHandler = &CacheHandler::getInstance('object');
            if($oCacheHandler->isSupport())
            {
                $cache_key = 'object_module_part_config:'.$module.'_'.$module_srl;<commit_msg>Issue 1814: APC Cache doesn't updated, after to execute moduleController::updateModuleConfig()<commit_after><?php
    /**
     * @class  moduleController
     * @author NHN (<EMAIL>)
     * @brief controller class of the module module
     **/

    class moduleController extends module {

        /**
         * @brief Initialization
         **/
        function init() {
        }

        /**
         * @brief Add action forward
         * Action forward finds and forwards if an action is not in the requested module
         * This is used when installing a module
         **/
        function insertActionForward($module, $type, $act) {
            $args->module = $module;
            $args->type = $type;
            $args->act = $act;

            $output = executeQuery('module.insertActionForward', $args);
            return $output;
        }

        /**
         * @brief Delete action forward
         **/
        function deleteActionForward($module, $type, $act) {
            $args->module = $module;
            $args->type = $type;
            $args->act = $act;

            $output = executeQuery('module.deleteActionForward', $args);
            return $output;
        }

        /**
         * @brief Add module trigger
         * module trigger is to call a trigger to a target module
         *
         **/
        function insertTrigger($trigger_name, $module, $type, $called_method, $called_position) {
            $args->trigger_name = $trigger_name;
            $args->module = $module;
            $args->type = $type;
            $args->called_method = $called_method;
            $args->called_position = $called_position;

            $output = executeQuery('module.insertTrigger', $args);

            //remove from cache
            $oCacheHandler = &CacheHandler::getInstance('object');
            if($oCacheHandler->isSupport())
            {
                $cache_key = 'object:'.$trigger_name.'_'.$called_position;
                $oCacheHandler->delete($cache_key);
            }

            // Delete all the files which contain trigger information
            FileHandler::removeFilesInDir("./files/cache/triggers");

            return $output;

        }

        /**
         * @brief Delete module trigger
         *
         **/
        function deleteTrigger($trigger_name, $module, $type, $called_method, $called_position) {
            $args->trigger_name = $trigger_name;
            $args->module = $module;
            $args->type = $type;
            $args->called_method = $called_method;
            $args->called_position = $called_position;

            $output = executeQuery('module.deleteTrigger', $args);

            //remove from cache
            $oCacheHandler = &CacheHandler::getInstance('object');
            if($oCacheHandler->isSupport())
            {
                $cache_key = 'object:'.$trigger_name.'_'.$called_position;
                $oCacheHandler->delete($cache_key);
            }

            // Remove the trigger cache
            FileHandler::removeFilesInDir('./files/cache/triggers');

            return $output;
        }

        /**
         * @brief Add module extend
         *
         **/
		function insertModuleExtend($parent_module, $extend_module, $type, $kind=''){
			if($kind != 'admin') $kind = '';
			if(!in_array($type,array('model','controller','view','api','mobile'))) return false;
			if(in_array($parent_module, array('module','addon','widget','layout'))) return false;

			$cache_file = './files/config/module_extend.php';
			FileHandler::removeFile($cache_file);

            $args->parent_module = $parent_module;
            $args->extend_module = $extend_module;
            $args->type = $type;
            $args->kind = $kind;

            $output = executeQuery('module.getModuleExtendCount', $args);
			if($output->data->count>0) return false;

            $output = executeQuery('module.insertModuleExtend', $args);
			return $output;
		}

        /**
         * @brief Delete module extend
         *
         **/
		function deleteModuleExtend($parent_module, $extend_module, $type, $kind=''){
			$cache_file = './files/config/module_extend.php';
			FileHandler::removeFile($cache_file);

            $args->parent_module = $parent_module;
            $args->extend_module = $extend_module;
            $args->type = $type;
            $args->kind = $kind;

            $output = executeQuery('module.deleteModuleExtend', $args);

			return $output;
		}


		function updateModuleConfig($module, $config, $site_srl = 0){
			$args->module = $module;
			$args->site_srl = $site_srl;

			$oModuleModel = &getModel('module');
			$origin_config = $oModuleModel->getModuleConfig($module, $site_srl);

			foreach($config as $key => $val){
				$origin_config->{$key} = $val;
			}

			return $this->insertModuleConfig($module, $origin_config, $site_srl);
		}

        /**
         * @brief Enter a specific set of modules
         * In order to manage global configurations of modules such as board, member and so on
         **/
        function insertModuleConfig($module, $config, $site_srl = 0) {
            $args->module = $module;
            $args->config = serialize($config);
			$args->site_srl = $site_srl;

            $output = executeQuery('module.deleteModuleConfig', $args);
            if(!$output->toBool()) return $output;

            $output = executeQuery('module.insertModuleConfig', $args);
			
			//remove from cache
			$oCacheHandler = &CacheHandler::getInstance('object');
			if($oCacheHandler->isSupport())
			{
				$cache_key = 'object:module_config:module_'.$module.'_site_srl_'.$site_srl;
				$oCacheHandler->delete($cache_key);
			}			
            return $output;
        }

        /**
         * @brief Save module configurations of the mid
         * Manage mid configurations depending on module
         **/
        function insertModulePartConfig($module, $module_srl, $config) {
            $args->module = $module;
            $args->module_srl = $module_srl;
            $args->config = serialize($config);

            $output = executeQuery('module.deleteModulePartConfig', $args);
            if(!$output->toBool()) return $output;

            //remove from cache
            $oCacheHandler = &CacheHandler::getInstance('object');
            if($oCacheHandler->isSupport())
            {
                $cache_key = 'object_module_part_config:'.$module.'_'.$module_srl;
{'fraction_non_alphanumeric': 0.13437910516961596, 'fraction_numerical': 0.0007727378100610462, 'mean_word_length': 2.066824644549763, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 101, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4106790', 'n_tokens_mistral': 3644, 'n_tokens_neox': 3444, 'n_words': 714}