Remove unnecessary use of BaseObject

- 트리거 등 반환값이 필요하지 않은 곳에서 new BaseObject()를 반환하는 것 삭제
- 모듈 설치, 업데이트 후 무의미한 new BaseObject()를 반환하는 것 삭제
- 사용자에게 에러 메시지를 돌려주는 용도로 new BaseObject(-1, '에러메시지')를
  사용하는 경우는 대부분 $this->setError()로 변경함. 언어 변환과 sprintf()
  처리까지 한 번에 이루어지므로 이쪽이 더 편리함.
This commit is contained in:
Kijin Sung 2017-12-01 00:54:51 +09:00
parent 03d74a984f
commit 84e5542d77
103 changed files with 692 additions and 862 deletions

View file

@ -15,13 +15,13 @@ class installModel extends install
$connection = ssh2_connect($ftp_info->ftp_host, $ftp_info->ftp_port);
if(!ssh2_auth_password($connection, $ftp_info->ftp_user, $ftp_info->ftp_password))
{
return new BaseObject(-1,'msg_ftp_invalid_auth_info');
return $this->setError('msg_ftp_invalid_auth_info');
}
$sftp = ssh2_sftp($connection);
$curpwd = "ssh2.sftp://$sftp".$this->pwd;
$dh = @opendir($curpwd);
if(!$dh) return new BaseObject(-1, 'msg_ftp_invalid_path');
if(!$dh) return $this->setError('msg_ftp_invalid_path');
$list = array();
while(($file = readdir($dh)) !== false)
@ -37,7 +37,7 @@ class installModel extends install
{
if(!($ftp_info = Context::getRequestVars()) || !$ftp_info->ftp_user || !$ftp_info->ftp_password)
{
return new BaseObject(-1, 'msg_ftp_invalid_auth_info');
return $this->setError('msg_ftp_invalid_auth_info');
}
$this->pwd = $ftp_info->ftp_root_path;
if(!$ftp_info->ftp_host)
@ -54,11 +54,11 @@ class installModel extends install
if(function_exists('ftp_connect'))
{
$connection = ftp_connect($ftp_info->ftp_host, $ftp_info->ftp_port);
if(!$connection) return new BaseObject(-1, sprintf(lang('msg_ftp_not_connected'), 'host'));
if(!$connection) return $this->setError(sprintf(lang('msg_ftp_not_connected'), 'host'));
if(! @ftp_login($connection, $ftp_info->ftp_user, $ftp_info->ftp_password))
{
ftp_close($connection);
return new BaseObject(-1,'msg_ftp_invalid_auth_info');
return $this->setError('msg_ftp_invalid_auth_info');
}
if($ftp_info->ftp_pasv != "N")
@ -82,7 +82,7 @@ class installModel extends install
else
{
$oFtp->ftp_quit();
return new BaseObject(-1,'msg_ftp_invalid_auth_info');
return $this->setError('msg_ftp_invalid_auth_info');
}
}
}