diff --git a/module/upgrade/config.php b/module/upgrade/config.php index 0086b916b3..70f7bb6543 100644 --- a/module/upgrade/config.php +++ b/module/upgrade/config.php @@ -16,3 +16,5 @@ $config->upgrade->lowerTables[$config->db->prefix . 'userContact'] = $config- $config->upgrade->lowerTables[$config->db->prefix . 'userGroup'] = $config->db->prefix . 'usergroup'; $config->upgrade->lowerTables[$config->db->prefix . 'userQuery'] = $config->db->prefix . 'userquery'; $config->upgrade->lowerTables[$config->db->prefix . 'userTPL'] = $config->db->prefix . 'usertpl'; + +$config->delete['10.6'][] = 'module/chat/ext/control/extensions.php'; diff --git a/module/upgrade/control.php b/module/upgrade/control.php index 3c9ac880d6..f85ff42378 100644 --- a/module/upgrade/control.php +++ b/module/upgrade/control.php @@ -106,12 +106,24 @@ class upgrade extends control public function execute($fromVersion = '') { $this->session->set('step', ''); - $fromVersion = isset($_POST['fromVersion']) ? $this->post->fromVersion : $fromVersion; - $this->upgrade->execute($fromVersion); $this->view->title = $this->lang->upgrade->result; $this->view->position[] = $this->lang->upgrade->common; + $result = $this->upgrade->deleteFiles(); + if($result) + { + $result[] = $this->lang->upgrade->afterDeleted; + + $this->view->result = 'fail'; + $this->view->errors = $result; + + die($this->display()); + } + + $fromVersion = isset($_POST['fromVersion']) ? $this->post->fromVersion : $fromVersion; + $this->upgrade->execute($fromVersion); + if(!$this->upgrade->isError()) $this->locate(inlink('afterExec', "fromVersion=$fromVersion")); $this->view->result = 'fail'; diff --git a/module/upgrade/lang/en.php b/module/upgrade/lang/en.php index baced88afc..a8f61ee22a 100644 --- a/module/upgrade/lang/en.php +++ b/module/upgrade/lang/en.php @@ -46,5 +46,6 @@ $lang->upgrade->sureExecute = 'Execute'; $lang->upgrade->forbiddenExt = 'Extension is not compatible with the version. It has been deactivated:'; $lang->upgrade->updateFile = 'File information has to be updated.'; $lang->upgrade->noticeSQL = 'Check that your database is inconsistent with the standard and try to fix failure. Please perform the following SQL and refresh.'; +$lang->upgrade->afterDeleted = 'File is not deleted. Please refresh after you delete it.'; include dirname(__FILE__) . '/version.php'; diff --git a/module/upgrade/lang/zh-cn.php b/module/upgrade/lang/zh-cn.php index 731b0e3187..d70be49449 100644 --- a/module/upgrade/lang/zh-cn.php +++ b/module/upgrade/lang/zh-cn.php @@ -46,5 +46,6 @@ $lang->upgrade->sureExecute = '确认执行'; $lang->upgrade->forbiddenExt = '以下插件与新版本不兼容,已经自动禁用:'; $lang->upgrade->updateFile = '需要更新附件信息。'; $lang->upgrade->noticeSQL = '检查到你的数据库跟标准不一致,尝试修复失败。请执行以下SQL语句,再刷新页面检查。'; +$lang->upgrade->afterDeleted = '以上文件未能删除, 删除后刷新!'; include dirname(__FILE__) . '/version.php'; diff --git a/module/upgrade/model.php b/module/upgrade/model.php index 80b7638b34..17163a0240 100644 --- a/module/upgrade/model.php +++ b/module/upgrade/model.php @@ -472,6 +472,28 @@ class upgradeModel extends model return $alterSQL; } + /** + * Delete Useless Files + * + * @access public + * @return array + */ + public function deleteFiles() + { + $result = array(); + foreach($this->config->delete as $deleteFiles) + { + $basePath = $this->app->getBasePath(); + foreach($deleteFiles as $file) + { + $fullPath = $basePath . str_replace('/', DIRECTORY_SEPARATOR, $file); + if(file_exists($fullPath) and !unlink($fullPath)) $result[] = $fullPath; + } + } + return $result; + } + + /** * Update ubb code in bug table and user Templates table to html.