diff --git a/02.php/config/bin.php b/02.php/config/bin.php new file mode 100644 index 0000000..ceeaef4 --- /dev/null +++ b/02.php/config/bin.php @@ -0,0 +1,20 @@ + '/usr/bin/svn', + 'svnadmin' => '/usr/bin/svnadmin', + 'svnlook' => '/usr/bin/svnlook', + 'svnserve' => '/usr/bin/svnserve', + 'svnversion' => '/usr/bin/svnversion', + 'svnsync' => '/usr/bin/svnsync', + 'svnrdump' => '/usr/bin/svnrdump', + 'svndumpfilter' => '/usr/bin/svndumpfilter', + 'svnmucc' => '/usr/bin/svnmucc' +]; diff --git a/02.php/server/install.php b/02.php/server/install.php index e603b4e..3f8fd1c 100644 --- a/02.php/server/install.php +++ b/02.php/server/install.php @@ -3,7 +3,7 @@ * @Author: witersen * @Date: 2022-05-08 13:31:07 * @LastEditors: witersen - * @LastEditTime: 2022-05-09 13:06:47 + * @LastEditTime: 2022-05-09 16:28:17 * @Description: QQ:1801168257 */ @@ -79,6 +79,7 @@ class Install if ($json == null) { echo '节点 ' . $value1['nodeName'] . ' 访问超时,切换下一节点' . PHP_EOL; + echo '===============================================' . PHP_EOL; continue; } @@ -88,7 +89,9 @@ class Install $last = $array['version']; if ($this->config_version['version'] == $last) { - exit('当前为最新版:' . $last . PHP_EOL); + echo '当前为最新版:' . $last . PHP_EOL; + echo '===============================================' . PHP_EOL; + exit(); } if ($this->config_version['version'] < $last) { echo '有新版本:' . $last . PHP_EOL; @@ -113,11 +116,15 @@ class Install $answer = strtolower(trim(fgets(STDIN))); if (!in_array($answer, ['y', 'n'])) { - exit('不正确的选项!' . PHP_EOL); + echo '不正确的选项!' . PHP_EOL; + echo '===============================================' . PHP_EOL; + exit(); } if ($answer == 'n') { - exit('已取消!' . PHP_EOL); + echo '已取消!' . PHP_EOL; + echo '===============================================' . PHP_EOL; + exit(); } //下载并执行升级脚本 @@ -128,19 +135,24 @@ class Install 'dest' => $last ]; if (!in_array($current, $forList)) { - exit('没有合适的升级包,请尝试直接手动安装最新版!' . PHP_EOL); + echo '没有合适的升级包,请尝试直接手动安装最新版!' . PHP_EOL; + echo '===============================================' . PHP_EOL; + exit(); } $index = array_search($current, $forList); $update_download_url = $packages[$index]['url']; $update_zip = FunCurlRequest($update_download_url); if ($update_zip == null) { echo '从节点 ' . $value1['nodeName'] . ' 下载升级包超时,切换下一节点' . PHP_EOL; + echo '===============================================' . PHP_EOL; continue; } file_put_contents(BASE_PATH . '/update.zip', $update_zip); shell_exec('unzip ' . BASE_PATH . '/update.zip'); if (!is_dir(BASE_PATH . '/update')) { - exit('解压升级包出错,请尝试手动解压并执行升级程序!' . PHP_EOL); + echo '解压升级包出错,请尝试手动解压并执行升级程序!' . PHP_EOL; + echo '===============================================' . PHP_EOL; + exit(); } echo '正在执行升级程序' . PHP_EOL; @@ -149,7 +161,9 @@ class Install shell_exec(sprintf("cd '%s' && rm -rf ./update && rm -f update.zip", BASE_PATH)); - exit('升级成功!请重启守护进程文件使部分配置文件生效' . PHP_EOL); + echo '升级成功!请重启守护进程文件使部分配置文件生效' . PHP_EOL; + echo '===============================================' . PHP_EOL; + exit(); } } } @@ -184,54 +198,96 @@ class Install * 1、检测Subversion的安装情况 */ //检测是否有正在运行的进程 - $isRun = shell_exec('ps auxf|grep -v "grep"|grep svnserve') == '' ? false : true; - - //检测安装程序是否存在于环境变量 - $installPath = shell_exec('which svnserve'); - $isInstall = shell_exec('whereis svnserve') == 'svnserve:' ? false : true; - - //正在运行中但是没有安装或者subversion的相关程序没有被加入环境变量 - if ($isRun && !$isInstall) { - exit('需要将Subversion相关程序加入到环境变量后重试!' . PHP_EOL); - } - - //正在运行中并且subversion的相关程序已经被加入环境变量 - if ($isRun && $isInstall) { - //停止svnserve - exit('请先手动停止正在运行的svnserve程序后重试' . PHP_EOL); + if (shell_exec('ps auxf|grep -v "grep"|grep svnserve') != '') { + echo '请先手动停止正在运行的 svnserve 程序后重试!' . PHP_EOL; + echo '===============================================' . PHP_EOL; + exit(); } - //不在运行中并且没有安装或者subversion的相关程序没有被加入环境变量 - if (!$isRun && !$isInstall) { - exit('需要安装Subversion或者需要将已安装的Subversion相关程序加入到环境变量后重试!' . PHP_EOL); + /** + * 2、令用户手动选择配置程序的路径 + */ + $needBin = [ + 'svn' => '', + 'svnadmin' => '', + 'svnlook' => '', + 'svnserve' => '', + 'svnversion' => '', + 'svnsync' => '', + 'svnrdump' => '', + 'svndumpfilter' => '', + 'svnmucc' => '' + ]; + + foreach ($needBin as $key => $value) { + echo "请输入 $key 程序位置:" . PHP_EOL; + echo '自动检测到以下程序路径:' . PHP_EOL; + passthru("which $key 2>/dev/null"); + echo '请输入回车使用默认检测路径或手动输入:'; + $binPath = fgets(STDIN); + if ($binPath == '') { + echo '输入不能为空!' . PHP_EOL; + echo '===============================================' . PHP_EOL; + exit(); + } + if ($binPath == "\n") { + $binPath = trim(shell_exec("which $key 2>/dev/null")); + if ($binPath == '') { + echo "未检测到 $key ,请手动输入程序路径!" . PHP_EOL; + echo '===============================================' . PHP_EOL; + exit(); + } + } else { + $binPath = trim($binPath); + } + echo "$key 程序位置:$binPath" . PHP_EOL; + echo '===============================================' . PHP_EOL; + $needBin[$key] = $binPath; } - //不在运行中并且subversion的相关程序已经被加入环境变量 - if (!$isRun && $isInstall) { - //相关文件配置 - } + $binCon = << '{$needBin['svn']}', + 'svnadmin' => '{$needBin['svnadmin']}', + 'svnlook' => '{$needBin['svnlook']}', + 'svnserve' => '{$needBin['svnserve']}', + 'svnversion' => '{$needBin['svnversion']}', + 'svnsync' => '{$needBin['svnsync']}', + 'svnrdump' => '{$needBin['svnrdump']}', + 'svndumpfilter' => '{$needBin['svndumpfilter']}', + 'svnmucc' => '{$needBin['svnmucc']}' + ]; +CON; + + file_put_contents(BASE_PATH . '/../config/bin.php', $binCon); /** * 相关文件配置 */ - $templete_path = BASE_PATH . '../templete/'; + $templete_path = BASE_PATH . '/../templete/'; echo '创建相关目录' . PHP_EOL; + clearstatcache(); + //创建SVNAdmin软件配置信息的主目录 - mkdir($this->config_svn['home_path'], 0700, true); + is_dir($this->config_svn['home_path']) ? '' : mkdir($this->config_svn['home_path'], 0700, true); //创建SVN仓库父目录 - mkdir($this->config_svn['rep_base_path'], 0700, true); + is_dir($this->config_svn['rep_base_path']) ? '' : mkdir($this->config_svn['rep_base_path'], 0700, true); //创建备份目录 - mkdir($this->config_svn['home_path'], 0700, true); + is_dir($this->config_svn['backup_base_path']) ? '' : mkdir($this->config_svn['backup_base_path'], 0700, true); //创建日志目录 - mkdir($this->config_svn['home_path'], 0700, true); + is_dir($this->config_svn['log_base_path']) ? '' : mkdir($this->config_svn['log_base_path'], 0700, true); //创建临时数据目录 - mkdir($this->config_svn['home_path'], 0700, true); + is_dir($this->config_svn['temp_base_path']) ? '' : mkdir($this->config_svn['temp_base_path'], 0700, true); + + echo '===============================================' . PHP_EOL; echo '创建相关文件' . PHP_EOL; @@ -241,7 +297,7 @@ class Install file_put_contents($this->config_svn['svnserve_env_file'], $con_svnserve_env_file); //写入SVN仓库权限配置文件 - $con_svn_conf_file = file_get_contents($templete_path . 'svnserve/svnserve.confg'); + $con_svn_conf_file = file_get_contents($templete_path . 'svnserve/svnserve.conf'); file_put_contents($this->config_svn['svn_conf_file'], $con_svn_conf_file); //写入authz文件 @@ -258,6 +314,8 @@ class Install //创建pid文件 file_put_contents($this->config_svn['svnserve_pid_file'], ''); + echo '===============================================' . PHP_EOL; + /** * 将svnserve注册为系统服务 */ @@ -266,24 +324,36 @@ class Install shell_exec('systemctl stop svnserve.service'); shell_exec('systemctl disable svnserve.service'); + echo '===============================================' . PHP_EOL; + + echo '注册新的svnserve服务' . PHP_EOL; + $con_svnserve_service_file = file_get_contents($templete_path . 'svnserve/svnserve.service'); - $con_svnserve_service_file = sprintf($con_svnserve_service_file, $this->config_svn['svnserve_env_file'], trim($installPath), $this->config_svn['svnserve_pid_file']); + $con_svnserve_service_file = sprintf($con_svnserve_service_file, $this->config_svn['svnserve_env_file'], $needBin['svnserve'], $this->config_svn['svnserve_pid_file']); file_put_contents($this->config_svn['svnserve_service_file'], $con_svnserve_service_file); + echo '===============================================' . PHP_EOL; + //启动 echo '开始启动svnserve服务' . PHP_EOL; passthru('systemctl start svnserve'); + echo '===============================================' . PHP_EOL; + //开机自启动 echo '将svnserve服务加入到开机自启动' . PHP_EOL; passthru('systemctl enable svnserve'); + echo '===============================================' . PHP_EOL; + //查看状态 echo 'svnserve安装成功,打印运行状态:' . PHP_EOL; passthru('systemctl status svnserve'); + + echo '===============================================' . PHP_EOL; } /** @@ -294,7 +364,7 @@ class Install echo '===============SVNAdmin==================' . PHP_EOL; foreach ($this->scripts as $value) { - echo '(' . $value['index'] . ')' . $value['note'] . PHP_EOL; + echo '[' . $value['index'] . '] ' . $value['note'] . PHP_EOL; } echo '===============================================' . PHP_EOL; @@ -339,6 +409,8 @@ class Install echo '请注意SVNAdmin支持管理的Subversion版本为1.8+!' . PHP_EOL; + echo '===============================================' . PHP_EOL; + echo '请输入要安装的Subversion版本(推荐Subversion-1.10):'; $answer = trim(fgets(STDIN)); diff --git a/02.php/templete/database/mysql/svnadmin.sql b/02.php/templete/database/mysql/svnadmin.sql new file mode 100644 index 0000000..680ff08 --- /dev/null +++ b/02.php/templete/database/mysql/svnadmin.sql @@ -0,0 +1,273 @@ +-- MySQL dump 10.13 Distrib 5.6.50, for Linux (x86_64) +-- +-- Host: localhost Database: svnadmin +-- ------------------------------------------------------ +-- Server version 5.6.50-log + +/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; +/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; +/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */; +/*!40101 SET NAMES utf8 */; +/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */; +/*!40103 SET TIME_ZONE='+00:00' */; +/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */; +/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */; +/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */; +/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */; + +-- +-- Table structure for table `admin_users` +-- + +DROP TABLE IF EXISTS `admin_users`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `admin_users` ( + `admin_user_id` int(11) NOT NULL AUTO_INCREMENT COMMENT '用户id', + `admin_user_name` varchar(45) NOT NULL COMMENT '用户名', + `admin_user_password` varchar(45) NOT NULL COMMENT '用户密码', + `admin_user_phone` char(11) DEFAULT NULL COMMENT '用户手机号', + `admin_user_email` varchar(45) DEFAULT NULL COMMENT '用户邮箱', + PRIMARY KEY (`admin_user_id`) +) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8 COMMENT='管理系统用户'; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `admin_users` +-- + +LOCK TABLES `admin_users` WRITE; +/*!40000 ALTER TABLE `admin_users` DISABLE KEYS */; +INSERT INTO `admin_users` VALUES (1,'admin','admin',NULL,NULL); +/*!40000 ALTER TABLE `admin_users` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `black_token` +-- + +DROP TABLE IF EXISTS `black_token`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `black_token` ( + `token_id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'tokenid', + `token` varchar(200) NOT NULL COMMENT 'token内容', + `start_time` varchar(45) NOT NULL COMMENT 'token的生效时间', + `end_time` varchar(45) NOT NULL COMMENT 'token的失效时间', + `insert_time` varchar(45) NOT NULL COMMENT '注销时间', + PRIMARY KEY (`token_id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='黑名单token 意思为用户注销后尚未达到过期时间的token将会被加入此黑名单 通过定时的主动扫描来去除过期的token 达到注销即安全的目的'; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `black_token` +-- + +LOCK TABLES `black_token` WRITE; +/*!40000 ALTER TABLE `black_token` DISABLE KEYS */; +/*!40000 ALTER TABLE `black_token` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `logs` +-- + +DROP TABLE IF EXISTS `logs`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `logs` ( + `log_id` int(11) NOT NULL AUTO_INCREMENT COMMENT '日志id', + `log_type_name` varchar(200) NOT NULL COMMENT '日志类型', + `log_content` varchar(5000) NOT NULL COMMENT '日志内容', + `log_add_user_name` varchar(200) NOT NULL COMMENT '操作人', + `log_add_time` varchar(45) NOT NULL COMMENT '操作时间', + PRIMARY KEY (`log_id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='日志表'; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `logs` +-- + +LOCK TABLES `logs` WRITE; +/*!40000 ALTER TABLE `logs` DISABLE KEYS */; +/*!40000 ALTER TABLE `logs` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `options` +-- + +DROP TABLE IF EXISTS `options`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `options` ( + `option_id` int(11) NOT NULL AUTO_INCREMENT, + `option_name` varchar(191) NOT NULL, + `option_value` longtext NOT NULL, + `option_description` varchar(200) DEFAULT NULL, + PRIMARY KEY (`option_id`), + UNIQUE KEY `option_name_UNIQUE` (`option_name`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='全局配置项'; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `options` +-- + +LOCK TABLES `options` WRITE; +/*!40000 ALTER TABLE `options` DISABLE KEYS */; +/*!40000 ALTER TABLE `options` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `svn_groups` +-- + +DROP TABLE IF EXISTS `svn_groups`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `svn_groups` ( + `svn_group_id` int(11) NOT NULL AUTO_INCREMENT COMMENT '分组id', + `svn_group_name` varchar(200) NOT NULL COMMENT '分组名称', + `include_user_count` int(11) NOT NULL, + `include_group_count` int(11) NOT NULL, + `svn_group_note` varchar(1000) DEFAULT NULL COMMENT '分组备注信息', + PRIMARY KEY (`svn_group_id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='SVN分组表'; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `svn_groups` +-- + +LOCK TABLES `svn_groups` WRITE; +/*!40000 ALTER TABLE `svn_groups` DISABLE KEYS */; +/*!40000 ALTER TABLE `svn_groups` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `svn_reps` +-- + +DROP TABLE IF EXISTS `svn_reps`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `svn_reps` ( + `rep_id` int(11) NOT NULL AUTO_INCREMENT COMMENT '仓库id', + `rep_name` varchar(1000) NOT NULL COMMENT '仓库名称', + `rep_size` double DEFAULT NULL COMMENT '仓库体积', + `rep_note` varchar(1000) DEFAULT NULL COMMENT '仓库备注', + `rep_rev` int(11) DEFAULT NULL COMMENT '仓库修订版本', + `rep_uuid` varchar(45) DEFAULT NULL COMMENT '仓库UUID', + PRIMARY KEY (`rep_id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='仓库表'; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `svn_reps` +-- + +LOCK TABLES `svn_reps` WRITE; +/*!40000 ALTER TABLE `svn_reps` DISABLE KEYS */; +/*!40000 ALTER TABLE `svn_reps` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `svn_user_pri_paths` +-- + +DROP TABLE IF EXISTS `svn_user_pri_paths`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `svn_user_pri_paths` ( + `svnn_user_pri_path_id` int(11) NOT NULL AUTO_INCREMENT, + `rep_name` varchar(1000) NOT NULL COMMENT '仓库名称', + `pri_path` mediumtext NOT NULL COMMENT '仓库路径', + `rep_pri` varchar(45) DEFAULT NULL COMMENT '该用户所拥有的权限', + `svn_user_name` varchar(200) NOT NULL COMMENT '该路径的权限的拥有人', + `unique` varchar(20000) NOT NULL COMMENT '使用仓库名和路径和权限拼接的唯一值', + PRIMARY KEY (`svnn_user_pri_path_id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='SVN用户有权限的仓库路径'; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `svn_user_pri_paths` +-- + +LOCK TABLES `svn_user_pri_paths` WRITE; +/*!40000 ALTER TABLE `svn_user_pri_paths` DISABLE KEYS */; +/*!40000 ALTER TABLE `svn_user_pri_paths` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `svn_users` +-- + +DROP TABLE IF EXISTS `svn_users`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `svn_users` ( + `svn_user_id` int(11) NOT NULL AUTO_INCREMENT COMMENT '用户id', + `svn_user_name` varchar(200) NOT NULL COMMENT '用户名', + `svn_user_pass` varchar(200) NOT NULL COMMENT '用户密码', + `svn_user_status` int(1) NOT NULL COMMENT '用户启用状态\n0 禁用\n1 启用', + `svn_user_note` varchar(1000) DEFAULT NULL COMMENT '用户备注信息', + PRIMARY KEY (`svn_user_id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='svn用户表'; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `svn_users` +-- + +LOCK TABLES `svn_users` WRITE; +/*!40000 ALTER TABLE `svn_users` DISABLE KEYS */; +/*!40000 ALTER TABLE `svn_users` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `verification_code` +-- + +DROP TABLE IF EXISTS `verification_code`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `verification_code` ( + `code_id` int(11) NOT NULL AUTO_INCREMENT, + `uuid` varchar(45) NOT NULL COMMENT '每次验证码请求的唯一标识', + `code` varchar(45) NOT NULL COMMENT '验证码', + `start_time` varchar(45) NOT NULL COMMENT '有效开始时间', + `end_time` varchar(45) NOT NULL COMMENT '失效时间', + `insert_time` varchar(45) NOT NULL COMMENT '插入时间', + PRIMARY KEY (`code_id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='验证码'; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `verification_code` +-- + +LOCK TABLES `verification_code` WRITE; +/*!40000 ALTER TABLE `verification_code` DISABLE KEYS */; +/*!40000 ALTER TABLE `verification_code` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Dumping events for database 'svnadmin' +-- + +-- +-- Dumping routines for database 'svnadmin' +-- +/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */; + +/*!40101 SET SQL_MODE=@OLD_SQL_MODE */; +/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */; +/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */; +/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */; +/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */; +/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; +/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; + +-- Dump completed on 2022-05-09 14:22:54 diff --git a/02.php/templete/database/sqlite/svnadmin.db b/02.php/templete/database/sqlite/svnadmin.db new file mode 100644 index 0000000..0e79b26 Binary files /dev/null and b/02.php/templete/database/sqlite/svnadmin.db differ diff --git a/02.php/templete/database/sqlite/svnadmin.sql b/02.php/templete/database/sqlite/svnadmin.sql new file mode 100644 index 0000000..95ebfba --- /dev/null +++ b/02.php/templete/database/sqlite/svnadmin.sql @@ -0,0 +1,185 @@ +/* + Navicat Premium Data Transfer + + Source Server : svnadmin.sqlite.struct + Source Server Type : SQLite + Source Server Version : 3030001 + Source Schema : main + + Target Server Type : SQLite + Target Server Version : 3030001 + File Encoding : 65001 + + Date: 09/05/2022 14:15:16 +*/ + +PRAGMA foreign_keys = false; + +-- ---------------------------- +-- Table structure for admin_users +-- ---------------------------- +DROP TABLE IF EXISTS "admin_users"; +CREATE TABLE "admin_users" ( + "admin_user_id" INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT, + "admin_user_name" TEXT(45) NOT NULL, + "admin_user_password" TEXT(45) NOT NULL, + "admin_user_phone" TEXT(11), + "admin_user_email" TEXT +); + +-- ---------------------------- +-- Records of admin_users +-- ---------------------------- +INSERT INTO "admin_users" VALUES (1, 'admin', 'admin', NULL, NULL); + +-- ---------------------------- +-- Table structure for black_token +-- ---------------------------- +DROP TABLE IF EXISTS "black_token"; +CREATE TABLE "black_token" ( + "token_id" INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT, + "token" TEXT(200) NOT NULL, + "start_time" TEXT(45) NOT NULL, + "end_time" TEXT(45) NOT NULL, + "insert_time" TEXT(45) NOT NULL +); + +-- ---------------------------- +-- Records of black_token +-- ---------------------------- + +-- ---------------------------- +-- Table structure for logs +-- ---------------------------- +DROP TABLE IF EXISTS "logs"; +CREATE TABLE "logs" ( + "log_id" INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT, + "log_type_name" TEXT(200) NOT NULL, + "log_content" TEXT(5000), + "log_add_user_name" TEXT(200) NOT NULL, + "log_add_time" TEXT(45) NOT NULL +); + +-- ---------------------------- +-- Records of logs +-- ---------------------------- + +-- ---------------------------- +-- Table structure for options +-- ---------------------------- +DROP TABLE IF EXISTS "options"; +CREATE TABLE "options" ( + "option_id" INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT, + "option_name" text NOT NULL, + "option_value" text NOT NULL, + "option_description" TEXT +); + +-- ---------------------------- +-- Records of options +-- ---------------------------- + +-- ---------------------------- +-- Table structure for svn_groups +-- ---------------------------- +DROP TABLE IF EXISTS "svn_groups"; +CREATE TABLE "svn_groups" ( + "svn_group_id" INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT, + "svn_group_name" TEXT(200) NOT NULL, + "include_user_count" integer NOT NULL, + "include_group_count" integer NOT NULL, + "svn_group_note" TEXT(1000) +); + +-- ---------------------------- +-- Records of svn_groups +-- ---------------------------- + +-- ---------------------------- +-- Table structure for svn_reps +-- ---------------------------- +DROP TABLE IF EXISTS "svn_reps"; +CREATE TABLE "svn_reps" ( + "rep_id" INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT, + "rep_name" TEXT(1000) NOT NULL, + "rep_size" integer, + "rep_rev" integer, + "rep_uuid" text, + "rep_note" TEXT(1000) +); + +-- ---------------------------- +-- Records of svn_reps +-- ---------------------------- + +-- ---------------------------- +-- Table structure for svn_user_pri_paths +-- ---------------------------- +DROP TABLE IF EXISTS "svn_user_pri_paths"; +CREATE TABLE "svn_user_pri_paths" ( + "svnn_user_pri_path_id" INTEGER NOT NULL, + "rep_name" TEXT NOT NULL, + "pri_path" TEXT NOT NULL, + "rep_pri" TEXT, + "svn_user_name" TEXT NOT NULL, + "unique" TEXT NOT NULL, + PRIMARY KEY ("svnn_user_pri_path_id") +); + +-- ---------------------------- +-- Records of svn_user_pri_paths +-- ---------------------------- + +-- ---------------------------- +-- Table structure for svn_users +-- ---------------------------- +DROP TABLE IF EXISTS "svn_users"; +CREATE TABLE "svn_users" ( + "svn_user_id" INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT, + "svn_user_name" TEXT(200) NOT NULL, + "svn_user_pass" TEXT(200) NOT NULL, + "svn_user_status" integer(1) NOT NULL, + "svn_user_note" TEXT(1000) +); + +-- ---------------------------- +-- Records of svn_users +-- ---------------------------- + +-- ---------------------------- +-- Table structure for verification_code +-- ---------------------------- +DROP TABLE IF EXISTS "verification_code"; +CREATE TABLE "verification_code" ( + "code_id" INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT, + "uuid" text(45) NOT NULL, + "code" TEXT(45) NOT NULL, + "start_time" TEXT(45) NOT NULL, + "end_time" TEXT(45) NOT NULL, + "insert_time" TEXT(45) NOT NULL +); + +-- ---------------------------- +-- Records of verification_code +-- ---------------------------- + +-- ---------------------------- +-- Table structure for sqlite_sequence +-- ---------------------------- +DROP TABLE IF EXISTS "sqlite_sequence"; +CREATE TABLE "sqlite_sequence" ( + "name", + "seq" +); + +-- ---------------------------- +-- Records of sqlite_sequence +-- ---------------------------- +INSERT INTO "sqlite_sequence" VALUES ('admin_users', 1); + +-- ---------------------------- +-- Auto increment value for admin_users +-- ---------------------------- +UPDATE "sqlite_sequence" SET seq = 1 WHERE name = 'admin_users'; + +PRAGMA foreign_keys = true;