|
|
@ -3,7 +3,7 @@ |
|
|
|
* @Author: witersen |
|
|
|
* @Author: witersen |
|
|
|
* @Date: 2022-04-24 23:37:05 |
|
|
|
* @Date: 2022-04-24 23:37:05 |
|
|
|
* @LastEditors: witersen |
|
|
|
* @LastEditors: witersen |
|
|
|
* @LastEditTime: 2022-05-12 17:27:57 |
|
|
|
* @LastEditTime: 2022-05-20 16:31:32 |
|
|
|
* @Description: QQ:1801168257 |
|
|
|
* @Description: QQ:1801168257 |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
|
|
|
|
|
|
|
@ -79,8 +79,6 @@ class Svnrep extends Base |
|
|
|
//向authz写入仓库信息 |
|
|
|
//向authz写入仓库信息 |
|
|
|
$status = $this->SVNAdminRep->SetRepAuthz($this->authzContent, $this->payload['rep_name'], '/'); |
|
|
|
$status = $this->SVNAdminRep->SetRepAuthz($this->authzContent, $this->payload['rep_name'], '/'); |
|
|
|
if ($status != '1') { |
|
|
|
if ($status != '1') { |
|
|
|
// FunShellExec('echo \'' . $status . '\' > ' . $this->config_svn['svn_authz_file']); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
FunFilePutContents($this->config_svn['svn_authz_file'], $status); |
|
|
|
FunFilePutContents($this->config_svn['svn_authz_file'], $status); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -179,8 +177,6 @@ class Svnrep extends Base |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if ($authzContet != $this->authzContent) { |
|
|
|
if ($authzContet != $this->authzContent) { |
|
|
|
// FunShellExec('echo \'' . $authzContet . '\' > ' . $this->config_svn['svn_authz_file']); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
FunFilePutContents($this->config_svn['svn_authz_file'], $authzContet); |
|
|
|
FunFilePutContents($this->config_svn['svn_authz_file'], $authzContet); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
@ -241,8 +237,6 @@ class Svnrep extends Base |
|
|
|
|
|
|
|
|
|
|
|
//写入配置文件 |
|
|
|
//写入配置文件 |
|
|
|
if ($authzContent != $this->authzContent) { |
|
|
|
if ($authzContent != $this->authzContent) { |
|
|
|
// FunShellExec('echo \'' . $authzContent . '\' > ' . $this->config_svn['svn_authz_file']); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
FunFilePutContents($this->config_svn['svn_authz_file'], $authzContent); |
|
|
|
FunFilePutContents($this->config_svn['svn_authz_file'], $authzContent); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
@ -922,8 +916,6 @@ class Svnrep extends Base |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
//写入 |
|
|
|
//写入 |
|
|
|
// FunShellExec('echo \'' . $result . '\' > ' . $this->config_svn['svn_authz_file']); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
FunFilePutContents($this->config_svn['svn_authz_file'], $result); |
|
|
|
FunFilePutContents($this->config_svn['svn_authz_file'], $result); |
|
|
|
|
|
|
|
|
|
|
|
//返回 |
|
|
|
//返回 |
|
|
@ -947,8 +939,6 @@ class Svnrep extends Base |
|
|
|
return message(200, 0, '已被删除'); |
|
|
|
return message(200, 0, '已被删除'); |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
//写入 |
|
|
|
//写入 |
|
|
|
// FunShellExec('echo \'' . $result . '\' > ' . $this->config_svn['svn_authz_file']); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
FunFilePutContents($this->config_svn['svn_authz_file'], $result); |
|
|
|
FunFilePutContents($this->config_svn['svn_authz_file'], $result); |
|
|
|
|
|
|
|
|
|
|
|
//返回 |
|
|
|
//返回 |
|
|
@ -978,8 +968,6 @@ class Svnrep extends Base |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
//写入 |
|
|
|
//写入 |
|
|
|
// FunShellExec('echo \'' . $result . '\' > ' . $this->config_svn['svn_authz_file']); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
FunFilePutContents($this->config_svn['svn_authz_file'], $result); |
|
|
|
FunFilePutContents($this->config_svn['svn_authz_file'], $result); |
|
|
|
|
|
|
|
|
|
|
|
//返回 |
|
|
|
//返回 |
|
|
@ -1033,8 +1021,6 @@ class Svnrep extends Base |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
//写入 |
|
|
|
//写入 |
|
|
|
// FunShellExec('echo \'' . $result . '\' > ' . $this->config_svn['svn_authz_file']); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
FunFilePutContents($this->config_svn['svn_authz_file'], $result); |
|
|
|
FunFilePutContents($this->config_svn['svn_authz_file'], $result); |
|
|
|
|
|
|
|
|
|
|
|
//返回 |
|
|
|
//返回 |
|
|
@ -1058,8 +1044,6 @@ class Svnrep extends Base |
|
|
|
return message(200, 0, '已被删除'); |
|
|
|
return message(200, 0, '已被删除'); |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
//写入 |
|
|
|
//写入 |
|
|
|
// FunShellExec('echo \'' . $result . '\' > ' . $this->config_svn['svn_authz_file']); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
FunFilePutContents($this->config_svn['svn_authz_file'], $result); |
|
|
|
FunFilePutContents($this->config_svn['svn_authz_file'], $result); |
|
|
|
|
|
|
|
|
|
|
|
//返回 |
|
|
|
//返回 |
|
|
@ -1091,8 +1075,6 @@ class Svnrep extends Base |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
//写入 |
|
|
|
//写入 |
|
|
|
// FunShellExec('echo \'' . $result . '\' > ' . $this->config_svn['svn_authz_file']); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
FunFilePutContents($this->config_svn['svn_authz_file'], $result); |
|
|
|
FunFilePutContents($this->config_svn['svn_authz_file'], $result); |
|
|
|
|
|
|
|
|
|
|
|
//返回 |
|
|
|
//返回 |
|
|
@ -1164,8 +1146,6 @@ class Svnrep extends Base |
|
|
|
//从配置文件删除指定仓库的所有路径 |
|
|
|
//从配置文件删除指定仓库的所有路径 |
|
|
|
$result = $this->SVNAdminRep->DelRepAuthz($this->authzContent, $this->payload['rep_name']); |
|
|
|
$result = $this->SVNAdminRep->DelRepAuthz($this->authzContent, $this->payload['rep_name']); |
|
|
|
if ($result != '1') { |
|
|
|
if ($result != '1') { |
|
|
|
// FunShellExec('echo \'' . $result . '\' > ' . $this->config_svn['svn_authz_file']); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
FunFilePutContents($this->config_svn['svn_authz_file'], $result); |
|
|
|
FunFilePutContents($this->config_svn['svn_authz_file'], $result); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -1501,14 +1481,23 @@ class Svnrep extends Base |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
foreach ($repHooks as $key => $value) { |
|
|
|
foreach ($repHooks as $key => $value) { |
|
|
|
if (file_exists($hooksPath . $value['fileName'])) { |
|
|
|
$hookFile = $hooksPath . $value['fileName']; |
|
|
|
|
|
|
|
$hookTmpleFile = $hookFile . '.tmpl'; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (file_exists($hookFile)) { |
|
|
|
$repHooks[$key]['hasFile'] = true; |
|
|
|
$repHooks[$key]['hasFile'] = true; |
|
|
|
$temp = FunShellExec(sprintf("cat '%s'", $hooksPath . $value['fileName'])); |
|
|
|
|
|
|
|
$repHooks[$key]['con'] = $temp['result']; |
|
|
|
if (!is_readable($hookFile)) { |
|
|
|
|
|
|
|
return message(200, 0, '文件' . $hookFile . '不可读'); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
$repHooks[$key]['con'] = file_get_contents($hookFile); |
|
|
|
} |
|
|
|
} |
|
|
|
if (file_exists($hooksPath . $value['fileName'] . '.tmpl')) { |
|
|
|
if (file_exists($hookTmpleFile)) { |
|
|
|
$temp = FunShellExec(sprintf("cat '%s'", $hooksPath . $value['fileName'] . '.tmpl')); |
|
|
|
|
|
|
|
$repHooks[$key]['tmpl'] = $temp['result']; |
|
|
|
if (!is_readable($hookTmpleFile)) { |
|
|
|
|
|
|
|
return message(200, 0, '文件' . $hookTmpleFile . '不可读'); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
$repHooks[$key]['tmpl'] = file_get_contents($hookTmpleFile); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -1566,6 +1555,9 @@ class Svnrep extends Base |
|
|
|
return message(200, 0, '未创建自定义钩子目录'); |
|
|
|
return message(200, 0, '未创建自定义钩子目录'); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (!is_readable($recommend_hook_path)) { |
|
|
|
|
|
|
|
return message(200, 0, '目录' . $recommend_hook_path . '不可读'); |
|
|
|
|
|
|
|
} |
|
|
|
$dirs = scandir($recommend_hook_path); |
|
|
|
$dirs = scandir($recommend_hook_path); |
|
|
|
|
|
|
|
|
|
|
|
foreach ($dirs as $dir) { |
|
|
|
foreach ($dirs as $dir) { |
|
|
@ -1577,24 +1569,34 @@ class Svnrep extends Base |
|
|
|
continue; |
|
|
|
continue; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (!is_readable($recommend_hook_path . $dir)) { |
|
|
|
|
|
|
|
return message(200, 0, '目录' . $recommend_hook_path . $dir . '不可读'); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
$dirFiles = scandir($recommend_hook_path . $dir); |
|
|
|
$dirFiles = scandir($recommend_hook_path . $dir); |
|
|
|
|
|
|
|
|
|
|
|
if (!in_array('hookDescription', $dirFiles) || !in_array('hookName', $dirFiles)) { |
|
|
|
if (!in_array('hookDescription', $dirFiles) || !in_array('hookName', $dirFiles)) { |
|
|
|
continue; |
|
|
|
continue; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
$hookName = FunShellExec(sprintf("cat '%s'", $recommend_hook_path . $dir . '/hookName')); |
|
|
|
if (!is_readable($recommend_hook_path . $dir . '/hookName')) { |
|
|
|
$hookName = $hookName['result']; |
|
|
|
return message(200, 0, '文件' . $recommend_hook_path . $dir . '/hookName' . '不可读'); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
$hookName = file_get_contents($recommend_hook_path . $dir . '/hookName'); |
|
|
|
|
|
|
|
|
|
|
|
if (!file_exists($recommend_hook_path . $dir . '/' . trim($hookName))) { |
|
|
|
if (!file_exists($recommend_hook_path . $dir . '/' . trim($hookName))) { |
|
|
|
continue; |
|
|
|
continue; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
$hookContent = FunShellExec(sprintf("cat '%s'", $recommend_hook_path . $dir . '/' . $hookName)); |
|
|
|
if (!is_readable($recommend_hook_path . $dir . '/' . $hookName)) { |
|
|
|
$hookContent = $hookContent['result']; |
|
|
|
return message(200, 0, '文件' . $recommend_hook_path . $dir . '/' . $hookName . '不可读'); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
$hookContent = file_get_contents($recommend_hook_path . $dir . '/' . $hookName); |
|
|
|
|
|
|
|
|
|
|
|
$hookDescription = FunShellExec(sprintf("cat '%s'", $recommend_hook_path . $dir . '/hookDescription')); |
|
|
|
if (!is_readable($recommend_hook_path . $dir . '/hookDescription')) { |
|
|
|
$hookDescription = $hookDescription['result']; |
|
|
|
return message(200, 0, '文件' . $recommend_hook_path . $dir . '/hookDescription' . '不可读'); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
$hookDescription = file_get_contents($recommend_hook_path . $dir . '/hookDescription'); |
|
|
|
|
|
|
|
|
|
|
|
array_push($list, [ |
|
|
|
array_push($list, [ |
|
|
|
'hookName' => $hookName, |
|
|
|
'hookName' => $hookName, |
|
|
|