Merge branch 'sprint/pailei2_tianshujie_upgrade' into 'pailei2'
* Delete encrypt module folder when upgrading. See merge request easycorp/zentaopms!2348
This commit is contained in:
+17
-19
@@ -711,8 +711,19 @@ class upgrade extends control
|
||||
return print($this->display('upgrade', 'consistency'));
|
||||
}
|
||||
|
||||
$EXTfiles = $this->upgrade->getEXTFiles();
|
||||
if(!empty($EXTfiles) and $skipMoveFile == 'no') $this->locate(inlink('moveEXTFiles', "fromVersion=$fromVersion"));
|
||||
$extFiles = $this->upgrade->getExtFiles();
|
||||
if(!empty($extFiles) and $skipMoveFile == 'no') return $this->locate(inlink('moveExtFiles', "fromVersion=$fromVersion"));
|
||||
|
||||
$response = $this->upgrade->removeEncryptedDir();
|
||||
if($response['result'] == 'fail')
|
||||
{
|
||||
$this->view->title = $this->lang->upgrade->common;
|
||||
$this->view->errors = $response['command'];
|
||||
$this->view->result = 'fail';
|
||||
|
||||
return $this->display('upgrade', 'execute');
|
||||
}
|
||||
|
||||
unset($_SESSION['user']);
|
||||
|
||||
if($processed == 'no')
|
||||
@@ -869,38 +880,25 @@ class upgrade extends control
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function moveEXTFiles($fromVersion)
|
||||
public function moveExtFiles($fromVersion)
|
||||
{
|
||||
$errorMessage = '';
|
||||
$command = '';
|
||||
$result = 'success';
|
||||
if(strtolower($this->server->request_method) == 'post')
|
||||
{
|
||||
if(!empty($_POST['files']))
|
||||
{
|
||||
$response = $this->upgrade->moveEXTFiles();
|
||||
$response = $this->upgrade->moveExtFiles();
|
||||
$result = $response['result'];
|
||||
|
||||
if($result == 'success')
|
||||
{
|
||||
$response = $this->upgrade->removeEncryptedDir();
|
||||
$result = $response['result'];
|
||||
}
|
||||
}
|
||||
|
||||
if($result == 'fail')
|
||||
{
|
||||
$errorMessage = $response['message'];
|
||||
$command = $response['command'];
|
||||
if($result == 'fail') $command = $response['command'];
|
||||
}
|
||||
|
||||
if($result == 'success') $this->locate($this->inlink('afterExec', "fromVersion=$fromVersion&processed=no&skipMoveFile=yes"));
|
||||
}
|
||||
|
||||
$this->view->title = $this->lang->upgrade->common;
|
||||
$this->view->files = $this->upgrade->getEXTFiles();
|
||||
$this->view->files = $this->upgrade->getExtFiles();
|
||||
$this->view->result = $result;
|
||||
$this->view->errorMessage = $errorMessage;
|
||||
$this->view->command = $command;
|
||||
$this->view->fromVersion = $fromVersion;
|
||||
|
||||
|
||||
@@ -5722,7 +5722,7 @@ class upgradeModel extends model
|
||||
* @access public
|
||||
* @return array
|
||||
*/
|
||||
public function getEXTFiles()
|
||||
public function getExtFiles()
|
||||
{
|
||||
$files = array();
|
||||
$allModules = glob($this->app->moduleRoot . '*');
|
||||
@@ -5836,7 +5836,7 @@ class upgradeModel extends model
|
||||
{
|
||||
$systemFiles = file_get_contents('systemfiles.txt');
|
||||
$systemFiles = str_replace('/', DS, $systemFiles);
|
||||
if(strpos($systemFiles, $fileName) !== false) continue;
|
||||
if(strpos($systemFiles, ",$fileName,") !== false) continue;
|
||||
|
||||
$pluginFiles[$fileName] = $fileName;
|
||||
}
|
||||
@@ -5852,7 +5852,7 @@ class upgradeModel extends model
|
||||
* @access public
|
||||
* @return array
|
||||
*/
|
||||
public function moveEXTFiles()
|
||||
public function moveExtFiles()
|
||||
{
|
||||
$data = fixer::input('post')->get();
|
||||
$customRoot = $this->app->appRoot . 'extension' . DS . 'custom';
|
||||
@@ -5869,7 +5869,6 @@ class upgradeModel extends model
|
||||
if(!mkdir($dirRoot, 0777, true))
|
||||
{
|
||||
$response['result'] = 'fail';
|
||||
$response['message'] = $this->lang->upgrade->moveEXTFileFail;;
|
||||
$response['command'] = 'chmod o=rwx -R '. $this->app->appRoot . 'extension/custom';
|
||||
|
||||
return $response;
|
||||
@@ -5906,7 +5905,6 @@ class upgradeModel extends model
|
||||
if(!empty($command))
|
||||
{
|
||||
$response['result'] = 'fail';
|
||||
$response['message'] = $this->lang->upgrade->afterDeleted;
|
||||
$response['command'] = $command;
|
||||
}
|
||||
|
||||
|
||||
+6341
-6341
File diff suppressed because it is too large
Load Diff
@@ -17,8 +17,6 @@
|
||||
<strong><?php echo $lang->upgrade->compatibleEXT;?></strong>
|
||||
<?php if($result == 'success'):?>
|
||||
<div class='alert alert-info no-margin'><?php echo $lang->upgrade->moveExtFileTip?></div>
|
||||
<?php elseif($result == 'fail' and is_array($command)):?>
|
||||
<div class='alert alert-info no-margin'><?php echo $lang->upgrade->deleteDirTip?></div>
|
||||
<?php endif;?>
|
||||
</div>
|
||||
<div class='modal-body'>
|
||||
@@ -29,22 +27,13 @@
|
||||
</div>
|
||||
<?php echo html::checkbox('files', $files, '', 'checked');?>
|
||||
<?php else:?>
|
||||
<?php
|
||||
if(is_array($command))
|
||||
{
|
||||
echo html::textarea('errors', join("\n", $command), "rows='19' class='form-control' readonly");
|
||||
}
|
||||
else
|
||||
{
|
||||
echo "<div><code>$command</code></div>";
|
||||
}
|
||||
?>
|
||||
<?php echo "<div><code>$command</code></div>";?>
|
||||
<?php endif;?>
|
||||
</div>
|
||||
</div>
|
||||
<div class='modal-footer text-center'>
|
||||
<?php if($result == 'success') echo html::submitButton($lang->upgrade->next);?>
|
||||
<?php if($result == 'fail') echo $errorMessage . ' ' . html::a('#', $this->lang->refresh, '', "class='btn btn-sm' onclick='refreshPage()'");?></div>
|
||||
<?php if($result == 'fail') echo $lang->upgrade->moveEXTFileFail . ' ' . html::a('#', $this->lang->refresh, '', "class='btn btn-sm' onclick='refreshPage()'");?></div>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
Reference in New Issue
Block a user