* delete useless file when upgrade.
This commit is contained in:
@@ -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';
|
||||
|
||||
@@ -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';
|
||||
|
||||
@@ -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';
|
||||
|
||||
@@ -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';
|
||||
|
||||
@@ -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.
|
||||
|
||||
Reference in New Issue
Block a user