diff --git a/conf/info.xml b/conf/info.xml index ba73442..a3df235 100644 --- a/conf/info.xml +++ b/conf/info.xml @@ -6,7 +6,7 @@ - 1.0 + 1.0.1 2014-12-11 NAVER diff --git a/conf/module.xml b/conf/module.xml index b52ad02..9ee9890 100644 --- a/conf/module.xml +++ b/conf/module.xml @@ -17,8 +17,9 @@ - + + diff --git a/lang/lang.xml b/lang/lang.xml index 08a6cda..851aeab 100644 --- a/lang/lang.xml +++ b/lang/lang.xml @@ -76,6 +76,11 @@ + + + + + @@ -132,7 +137,6 @@ - @@ -168,6 +172,28 @@ + + + + 슬로우로그 파일 삭제 + + + 슬로우 로그으로 만들어졌던 파일들을 삭제 하게됩니다. + XE설치경로에서 files 폴더 안에 다음 파일을 삭제 합니다. + + + _slowlog_addon.php + _slowlog_trigger.php + _slowlog_widget.php + _slowlog_query.php + + 그 외 files 풀더 안의 다른 파일들을 건드리지 않습니다. + + + ]]> + + @@ -198,4 +224,9 @@ + + + + + diff --git a/package.json b/package.json index 11aeb40..c403b99 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "XE-Profiler", - "version": "1.0", + "version": "1.0.1", "author": "NAVER", "keywords": [ "XpressEngine", diff --git a/profiler.admin.controller.php b/profiler.admin.controller.php index cb29c93..039728b 100644 --- a/profiler.admin.controller.php +++ b/profiler.admin.controller.php @@ -19,7 +19,6 @@ function procProfilerAdminInsertConfig() $oProfilerModel = getModel('profiler'); $vars = Context::getRequestVars(); - $section = $vars->_config_section; $config = $oProfilerModel->getConfig(); if(!$config->slowlog) @@ -33,19 +32,13 @@ function procProfilerAdminInsertConfig() $oModuleController->updateModuleConfig('profiler', $config); - $oInstallController = getController('install'); - if(!$oInstallController->makeConfigFile()) - { - return new Object(-1, 'msg_invalid_request'); - } - $this->setMessage('success_updated'); $this->setRedirectUrl(Context::get('success_return_url') ? Context::get('success_return_url') : getNotEncodedUrl('', 'module', 'admin', 'act', 'dispProfilerAdminConfig')); } function procProfilerAdminTruncateSlowlog() { - $output = executeQuery('profiler.truncateSlowlog'); + executeQuery('profiler.truncateSlowlog'); $this->setMessage('msg_profiler_arranged'); $this->setRedirectUrl(Context::get('success_return_url') ? Context::get('success_return_url') : getNotEncodedUrl('', 'module', 'admin', 'act', 'dispProfilerAdminSlowlog')); @@ -61,10 +54,9 @@ function procProfilerAdminDeleteTrigger() $invalid_trigger_list = $oProfilerAdminModel->getTriggersToBeDeleted($advanced); // 트리거 삭제 - $oModuleController = getController('module'); foreach($invalid_trigger_list as $trigger) { - $output = $oModuleController->deleteTrigger($trigger->trigger_name, $trigger->module, $trigger->type, $trigger->called_method, $trigger->called_position); + $output = $this->deleteTrigger($trigger->trigger_name, $trigger->module, $trigger->type, $trigger->called_method, $trigger->called_position); if(!$output->toBool()) { return $output; @@ -144,6 +136,40 @@ function procProfilerAdminDeleteTable() $this->setRedirectUrl($success_return_url ? $success_return_url : getNotEncodedUrl('', 'module', 'admin', 'act', 'dispProfilerAdminTable', 'page', Context::get('page'))); } + function procProfilerAdminDeleteTablePiece() + { + $table_name = Context::get('table_name'); + $oDB = DB::getInstance(); + $oDB->dropTable(substr($table_name, strlen($oDB->prefix))); + + $this->setMessage('msg_profiler_arranged'); + $success_return_url = Context::get('success_return_url'); + $this->setRedirectUrl($success_return_url ? $success_return_url : getNotEncodedUrl('', 'module', 'admin', 'act', 'dispProfilerAdminTable', 'page', Context::get('page'))); + } + + function procProfilerAdminDeleteLogFile() + { + $slowlog_files = array( + _XE_PATH_.'files/_slowlog_addon.php', + _XE_PATH_.'files/_slowlog_trigger.php', + _XE_PATH_.'files/_slowlog_widget.php', + _XE_PATH_.'files/_slowlog_query.php' + ); + + foreach($slowlog_files as $file) + { + $slowlog_file = FileHandler::exists($file); + if($slowlog_file === false) + { + continue; + } + FileHandler::removeFile($file); + } + + $this->setMessage('msg_profiler_slowlog_file_arranged'); + $this->setRedirectUrl(Context::get('success_return_url') ? Context::get('success_return_url') : getNotEncodedUrl('', 'module', 'admin', 'act', 'dispProfilerAdminConfig')); + } + /** * @brief 테이블 복구 * @param string $table_name @@ -183,6 +209,32 @@ function repairTable($table_name) return new Object(); } + + /** + * @brief 트리거 삭제명령 + * @param string $table_name + * @return $output + */ + function deleteTrigger($trigger_name, $module, $type, $called_method, $called_position) + { + $args = new stdClass(); + $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); + //캐시파일도 함께 삭제. + $oCacheHandler = CacheHandler::getInstance('object', NULL, TRUE); + if($oCacheHandler->isSupport()) + { + $oCacheHandler->invalidateGroupKey('triggers'); + } + // 캐시파일 함께 삭제 + FileHandler::removeFilesInDir('./files/cache/triggers'); + + return $output; + } } /* End of file profiler.admin.controller.php */ diff --git a/profiler.admin.model.php b/profiler.admin.model.php index 23d600f..6536cf1 100644 --- a/profiler.admin.model.php +++ b/profiler.admin.model.php @@ -121,6 +121,38 @@ function getStaticsSlowlogCount($type, $count, $args = NULL) return $output; } + /** + * @brief DB의 기록된 트리거 목록을 가져옴 + * @return array + */ + function getTriggers($trigger_name, $called_position) + { + $triggers = false; + $oCacheHandler = CacheHandler::getInstance('object', NULL, TRUE); + + if($oCacheHandler->isSupport()) + { + $object_key = $trigger_name.'_'.$called_position; + $cache_key = $oCacheHandler->getGroupKey('triggers', $object_key); + $triggers = $oCacheHandler->get($cache_key); + } + + if($triggers === false) + { + $args = new stdClass(); + $args->trigger_name = $trigger_name; + $args->called_position = $called_position; + $output = executeQueryArray('module.getTriggers', $args); + $triggers = $output->data; + if($output->toBool() && $oCacheHandler->isSupport()) + { + $oCacheHandler->put($cache_key, $triggers); + } + } + + return $triggers; + } + /** * @brief 설치된 모듈 이름 목록 반환 * @return array @@ -183,10 +215,8 @@ function getTableList() */ function getTriggersToBeDeleted($advanced = FALSE) { - $oModuleModel = getModel('module'); - // DB 상의 트리거 목록 - $trigger_list = $oModuleModel->getTriggers(); + $trigger_list = $this->getTriggers(); // 설치되어 있는 모듈 목록 $module_list = $this->getModuleList(); @@ -222,6 +252,7 @@ function getTriggersToBeDeleted($advanced = FALSE) */ function getModuleConfigToBeDeleted($advanced = FALSE) { + $oModuleModel = getModel('module'); // DB 상의 모듈 설정 목록 $output = executeQueryArray('profiler.getModuleConfig'); $module_config = $output->data; @@ -271,6 +302,7 @@ function getAddonConfigToBeDeleted($advanced = FALSE) $module_list = $this->getModuleList(); + $invalid_addon_config = array(); foreach($addon_config as $config) { $addons_j_list[] = $config->addon; diff --git a/profiler.admin.view.php b/profiler.admin.view.php index f8b2c4c..b7b1018 100644 --- a/profiler.admin.view.php +++ b/profiler.admin.view.php @@ -85,7 +85,6 @@ function dispProfilerAdminWidgetList() Context::set('widget_slowlog', $paging->data); Context::set('page_navigation', $paging->page_navigation); - Context::set('w_slowlog', $w_slowlog2); } diff --git a/tpl/config.html b/tpl/config.html index 4a71789..8bcc2a4 100644 --- a/tpl/config.html +++ b/tpl/config.html @@ -12,7 +12,6 @@ {$lang->cmd_profiler_slowlog} - {$lang->cmd_profiler_enable_slowlog} @@ -59,4 +58,17 @@ {$lang->cmd_profiler_slowlog} + + + + + + + + {$lang->about_profiler_slowlog_file_deleted} + + {$lang->profiler_unit->delete} + + + \ No newline at end of file diff --git a/tpl/css/profiler.admin.css b/tpl/css/profiler.admin.css index 8a4e115..deb7925 100644 --- a/tpl/css/profiler.admin.css +++ b/tpl/css/profiler.admin.css @@ -35,4 +35,27 @@ text-decoration : none; } +.file .file-item { + overflow-x: hidden; + overflow-y: auto; + margin: 0 !important; + padding: 20px; + color: rgb(34, 34, 34); + font-size: 15px; + font-family: 'Roboto Condensed', Tauri, 'Hiragino Sans GB', 'Microsoft YaHei', STHeiti, SimSun, 'Lucida Grande', 'Lucida Sans Unicode', 'Lucida Sans', 'Segoe UI', AppleSDGothicNeo-Medium, 'Malgun Gothic', Verdana, Tahoma, sans-serif; + line-height: 1.6; + -webkit-font-smoothing: antialiased; + background: rgb(255, 255, 255); +} + +.file .file-item p { + margin: 1em 0; + word-wrap: break-word; +} +.file .file-item p br { + clear: both; +} +.file .file-item li { + display: list-item; line-height: 1.4em; +} /* End of file */ diff --git a/tpl/table.html b/tpl/table.html index 46debcd..ac26ac1 100644 --- a/tpl/table.html +++ b/tpl/table.html @@ -28,6 +28,13 @@ {@$enable_delete = TRUE} {$lang->notuse} + + + + + + {$lang->profiler_unit->delete} + {$table_info->name} {$table_info->type}
+ 슬로우 로그으로 만들어졌던 파일들을 삭제 하게됩니다. + XE설치경로에서 files 폴더 안에 다음 파일을 삭제 합니다. +
그 외 files 풀더 안의 다른 파일들을 건드리지 않습니다.