From 19ec606bce2791d796d48847f12eb69edccb392b Mon Sep 17 00:00:00 2001 From: qiyu-xie Date: Wed, 30 Sep 2020 14:35:42 +0800 Subject: [PATCH] * Finish task#8052. --- lib/scm/scm.class.php | 5 ++--- module/repo/lang/de.php | 1 + module/repo/lang/en.php | 1 + module/repo/lang/fr.php | 1 + module/repo/lang/vi.php | 1 + module/repo/lang/zh-cn.php | 1 + module/repo/lang/zh-tw.php | 1 + module/repo/model.php | 9 ++++++++- 8 files changed, 16 insertions(+), 4 deletions(-) diff --git a/lib/scm/scm.class.php b/lib/scm/scm.class.php index 966e32057a..93a2e322ee 100644 --- a/lib/scm/scm.class.php +++ b/lib/scm/scm.class.php @@ -12,11 +12,10 @@ class scm */ public function setEngine($repo) { - $className = $repo->SCM; + $className = $repo->SCM; if($className == 'Git') $className = 'GitRepo'; - $client = strpos($repo->client, ' ') ? str_replace(' ', '" "', $repo->client) : $repo->client; if(!class_exists($className)) require(strtolower($className) . '.class.php'); - $this->engine = new $className($client, $repo->path, $repo->account, $repo->password, $repo->encoding); + $this->engine = new $className($repo->client, $repo->path, $repo->account, $repo->password, $repo->encoding); } /** diff --git a/module/repo/lang/de.php b/module/repo/lang/de.php index c0356a17ec..bb4a86b93b 100644 --- a/module/repo/lang/de.php +++ b/module/repo/lang/de.php @@ -160,6 +160,7 @@ $lang->repo->error->output = "The command is: %s\nThe error is(%s): %s\n" $lang->repo->error->clientVersion = "Client version is too low, please upgrade or change SVN client"; $lang->repo->error->encoding = "The encoding maybe wrong. Please change the encoding and try again."; $lang->repo->error->deleted = "Deletion of the repository failed. The current repository has a commit record associated with the design."; +$lang->repo->error->clientPath = "The client installation directory cannot have spaces!"; $lang->repo->syncTips = 'You may find the reference about how to set Git sync from here.'; $lang->repo->encodingsTips = "The encodings of commit comments, can be comma separated values,e.g. utf-8"; diff --git a/module/repo/lang/en.php b/module/repo/lang/en.php index f1905244c3..7d50af93ad 100644 --- a/module/repo/lang/en.php +++ b/module/repo/lang/en.php @@ -160,6 +160,7 @@ $lang->repo->error->output = "The command is: %s\nThe error is(%s): %s\n" $lang->repo->error->clientVersion = "Client version is too low, please upgrade or change SVN client"; $lang->repo->error->encoding = "The encoding might be wrong. Please change the encoding and try again."; $lang->repo->error->deleted = "Deletion of the repository failed. The current repository has a commit record associated with the design."; +$lang->repo->error->clientPath = "The client installation directory cannot have spaces!"; $lang->repo->syncTips = 'You may find the reference about how to set Git sync from here.'; $lang->repo->encodingsTips = "The encodings of comments can be comma separated values, e.g. utf-8."; diff --git a/module/repo/lang/fr.php b/module/repo/lang/fr.php index 1da4979113..4bf7a9d8b4 100644 --- a/module/repo/lang/fr.php +++ b/module/repo/lang/fr.php @@ -160,6 +160,7 @@ $lang->repo->error->output = "La commande est: %s\nL'erreur est (%s): %s\ $lang->repo->error->clientVersion = "La version du client est trop ancienne, veuillez mettre à niveau ou changer le client SVN"; $lang->repo->error->encoding = "L'encodage est peut-être erroné. Veuillez modifier l'encodage et réessayer."; $lang->repo->error->deleted = "Deletion of the repository failed. The current repository has a commit record associated with the design."; +$lang->repo->error->clientPath = "The client installation directory cannot have spaces!"; $lang->repo->syncTips = 'Vous pouvez trouver la référence sur la façon de définir la synchronisation Git à partir de la page se trouvant ici.'; $lang->repo->encodingsTips = "Les encodages des commentaires de validation peuvent être des valeurs séparées par des virgules,ex: utf-8"; diff --git a/module/repo/lang/vi.php b/module/repo/lang/vi.php index 5912f4de61..0213f1c526 100644 --- a/module/repo/lang/vi.php +++ b/module/repo/lang/vi.php @@ -160,6 +160,7 @@ $lang->repo->error->output = "The command is: %s\nThe error is(%s): %s\n" $lang->repo->error->clientVersion = "Client version is too low, please upgrade or change SVN client"; $lang->repo->error->encoding = "The encoding maybe wrong. Vui lòng change the encoding and try again."; $lang->repo->error->deleted = "Deletion of the repository failed. The current repository has a commit record associated with the design."; +$lang->repo->error->clientPath = "The client installation directory cannot have spaces!"; $lang->repo->syncTips = 'Bạn có thể tìm tham khảo làm sao thiết lập đồng bộ Git từ here.'; $lang->repo->encodingsTips = "The encodings of commit comments, can be comma separated values,ví dụ: utf-8"; diff --git a/module/repo/lang/zh-cn.php b/module/repo/lang/zh-cn.php index 49ec27fc11..10b807ee20 100644 --- a/module/repo/lang/zh-cn.php +++ b/module/repo/lang/zh-cn.php @@ -160,6 +160,7 @@ $lang->repo->error->output = "执行命令:%s\n错误结果(%s): %s\n $lang->repo->error->clientVersion = "客户端版本过低,请升级或更换SVN客户端"; $lang->repo->error->encoding = "编码可能错误,请更换编码重试。"; $lang->repo->error->deleted = "删除版本库失败,当前版本库有提交记录与设计关联"; +$lang->repo->error->clientPath = "客户端安装目录不能有空格!"; $lang->repo->syncTips = '请参照这里,设置版本库定时同步。'; $lang->repo->encodingsTips = "提交日志的编码,可以用逗号连接起来的多个,比如utf-8。"; diff --git a/module/repo/lang/zh-tw.php b/module/repo/lang/zh-tw.php index 82d8a6e0a2..3bfe5cd545 100644 --- a/module/repo/lang/zh-tw.php +++ b/module/repo/lang/zh-tw.php @@ -158,6 +158,7 @@ $lang->repo->error->noPriv = '程序沒有權限切換到目錄 %s'; $lang->repo->error->output = "執行命令:%s\n錯誤結果(%s): %s\n"; $lang->repo->error->clientVersion = "客戶端版本過低,請升級或更換SVN客戶端"; $lang->repo->error->encoding = "編碼可能錯誤,請更換編碼重試。"; +$lang->repo->error->clientPath = "客户端安裝目錄不能有空格!"; $lang->repo->syncTips = '請參照這裡,設置版本庫定時同步。'; $lang->repo->encodingsTips = "提交日誌的編碼,可以用逗號連接起來的多個,比如utf-8。"; diff --git a/module/repo/model.php b/module/repo/model.php index 17763071cf..22e6cb5bb7 100644 --- a/module/repo/model.php +++ b/module/repo/model.php @@ -930,8 +930,15 @@ class repoModel extends model public function checkConnection() { if(empty($_POST)) return false; + + if(strpos($this->post->client, ' ')) + { + dao::$errors['client'] = $this->lang->repo->error->clientPath; + return false; + } + $scm = $this->post->SCM; - $client = str_replace(' ', '" "', $this->post->client); + $client = $this->post->client; $account = $this->post->account; $password = $this->post->password; $encoding = strtoupper($this->post->encoding);