Add Composer version check

This commit is contained in:
BrettonYe
2023-06-17 00:08:04 +08:00
committed by BrettonYe
parent f8017370da
commit a62e3eccc0
4 changed files with 109 additions and 86 deletions

View File

@@ -49,11 +49,11 @@ class Helpers
* @param string $username 用户
* @param string $password 用户密码
* @param int $transfer_enable 可用流量
* @param int|null $date 可使用天数
* @param string|null $date 可使用天数
* @param int|null $inviter_id 邀请人
* @param string|null $nickname 昵称
*/
public static function addUser(string $username, string $password, int $transfer_enable, int $date = null, int $inviter_id = null, string $nickname = null): User
public static function addUser(string $username, string $password, int $transfer_enable, string $date = null, int $inviter_id = null, string $nickname = null): User
{
return User::create([
'nickname' => $nickname ?? $username,
@@ -66,7 +66,7 @@ class Helpers
'protocol' => self::getDefaultProtocol(),
'obfs' => self::getDefaultObfs(),
'transfer_enable' => $transfer_enable,
'expired_at' => date('Y-m-d', strtotime($date.' days')),
'expired_at' => date('Y-m-d', strtotime("$date days")),
'user_group_id' => null,
'reg_ip' => IP::getClientIp(),
'inviter_id' => $inviter_id,

View File

@@ -1,6 +1,6 @@
#!/usr/bin/env bash
#清理不需要的文件
clean_files(){
clean_files() {
if [ -f .user.ini ]; then
chattr -i .user.ini
fi
@@ -8,22 +8,22 @@ clean_files(){
}
#检查系统
check_sys(){
# shellcheck disable=SC2002
if [[ -f /etc/redhat-release ]]; then
release="centos"
elif cat /etc/issue | grep -q -E -i "debian"; then
release="debian"
elif cat /etc/issue | grep -q -E -i "ubuntu"; then
release="ubuntu"
elif cat /etc/issue | grep -q -E -i "centos|red hat|redhat"; then
release="centos"
elif cat /proc/version | grep -q -E -i "debian"; then
release="debian"
elif cat /proc/version | grep -q -E -i "ubuntu"; then
release="ubuntu"
elif cat /proc/version | grep -q -E -i "centos|red hat|redhat"; then
release="centos"
check_sys() {
# shellcheck disable=SC2002
if [[ -f /etc/redhat-release ]]; then
release="centos"
elif cat /etc/issue | grep -q -E -i "debian"; then
release="debian"
elif cat /etc/issue | grep -q -E -i "ubuntu"; then
release="ubuntu"
elif cat /etc/issue | grep -q -E -i "centos|red hat|redhat"; then
release="centos"
elif cat /proc/version | grep -q -E -i "debian"; then
release="debian"
elif cat /proc/version | grep -q -E -i "ubuntu"; then
release="ubuntu"
elif cat /proc/version | grep -q -E -i "centos|red hat|redhat"; then
release="centos"
fi
echo "========= Checking for Software dependency | 检查依赖软件是否安装/运行 ========="
@@ -53,36 +53,45 @@ check_sys(){
fi
}
#检查composer是否安装
check_composer(){
check_composer() {
if [ ! -f "/usr/bin/composer" ]; then
if [[ "${release}" == "centos" ]]; then
yum install -y composer
else
apt-get install -y composer
fi
if [[ "${release}" == "centos" ]]; then
yum install -y composer
else
apt-get install -y composer
fi
else
if [[ $(composer --version | cut -d" " -f3) < 2.2.0 ]]; then
composer self-update
fi
fi
}
# 设置权限
set_permissions(){
set_permissions() {
if [ ! -d "/home/www" ]; then
mkdir -p /home/www
chown www:www /home/www
fi
chown -R www:www ./
chmod -R 755 ./
chmod -R 777 storage/
chown -R www:www ./
chmod -R 755 ./
chmod -R 777 storage/
}
set_crontab(){
set_crontab() {
cmd="php $(dirname "$path")/artisan schedule:run >> /dev/null 2>&1"
cronjob="* * * * * $cmd"
( crontab -u www -l | grep -v -F "$cmd" ; echo "$cronjob" ) | crontab -u www -
(
crontab -u www -l | grep -v -F "$cmd"
echo "$cronjob"
) | crontab -u www -
cmd="bash $(dirname "$path")/queue.sh"
cronjob="*/10 * * * * $cmd"
( crontab -l | grep -v -F "$cmd" ; echo "$cronjob" ) | crontab -
(
crontab -l | grep -v -F "$cmd"
echo "$cronjob"
) | crontab -
}
clean_files

View File

@@ -12,16 +12,16 @@ Support but not limited to: Shadowsocks,ShadowsocksR,ShadowsocksRR,V2Ray,Trojan,
- 使用优惠码:`31F6PFTY4I5T` 可得 89%折扣 | Use `31F6PFTY4I5T` get 11% off
- [快车道Kuaichedao](https://kuaichedao.co/aff.php?aff=3)
- 节日有活动,能拿到优惠码;
- HKT 家宽不保证SLA但混到骨折码那是真便宜
- HKT 家宽不保证SLA但混到骨折码那是真实惠
- 也有不少CMI BGP 的产品,可以上。
- [V.PS](https://vps.hosting/?affid=1138)
- 背靠强者XTOM
- 适合大量入搞负载均衡的小VPS
- 东京 延迟还不错,带宽过得去,就是流量少了点
- 活动还不少最近2023-05-16被DDOS了 直接给受影响的地区送了1个月公关YYDS
- 推荐 月付, IP被墙更换要8欧元
## Project
- [Demo](https://demo.proxypanel.cf/) Demo will always on dev/latest code, rather than the stable version.
- [Demo](https://demo.proxypanel.cf/) will always on dev/latest code, rather than the stable version. For showcase purposes.
- Account: test@test.com
- Password: 123456
- [**WIKI**](https://proxypanel.gitbook.io/wiki/)
@@ -30,31 +30,36 @@ Support but not limited to: Shadowsocks,ShadowsocksR,ShadowsocksRR,V2Ray,Trojan,
- [Upcoming](https://github.com/ZBrettonYe/ProxyPanel/projects/2)
- [Telegram](https://t.me/+nW8AwsPPUsliYzg1)
## Funding
Buy me a Coffee?
- PayPal [paypal.me/brettonye](https://www.paypal.com/paypalme/brettonye)
- USDT-TRC20 TFMxq91oPCnoxDXBiEgRzab5N6GFnAbTT5
## Requirements
- Memory 1G +
- Disk 10G +
- Memory 1G+
- Disk 10G+
### This project is base on Laravel 10 Framwork
- PHP >= 8.1
- BCMath PHP Extension
- Ctype PHP Extension
- Fileinfo PHP extension
- JSON PHP Extension
- Mbstring PHP Extension
- OpenSSL PHP Extension
- PDO PHP Extension
- Tokenizer PHP Extension
- XML PHP Extension
- Redis PHP Extension
- Imagick PHP Extension
### Laravel 10
This project is base on Laravel 10 Framework This means anything Laravel 10 is required to install will also required by this project.
- PHP 8.1+
- Ctype PHP Extension
- cURL PHP Extension
- DOM PHP Extension
- Fileinfo PHP Extension
- Filter PHP Extension
- Hash PHP Extension
- Mbstring PHP Extension
- OpenSSL PHP Extension
- PCRE PHP Extension
- PDO PHP Extension
- Session PHP Extension
- Tokenizer PHP Extension
- XML PHP Extension
- Redis PHP Extension
- Composer 2.2.0+
### Database
- Mysql 5.5 + (Recommend 5.7+)
- One of the following
- MariaDB 10.3+ [Version Policy](https://mariadb.org/about/#maintenance-policy)
- MySQL 5.7+ [Version Policy](https://en.wikipedia.org/wiki/MySQL#Release_history)
- PostgreSQL 10.0+ [Version Policy](https://www.postgresql.org/support/versioning/)
- SQLite 3.8.8+
- SQL Server 2017+ [Version Policy](https://docs.microsoft.com/en-us/lifecycle/products/?products=sql-server)
- Redis
## Thanks
@@ -65,4 +70,9 @@ Buy me a Coffee?
## License
ProxyPanel is open-sourced software licensed under the GPL-3.0 license.
ProxyPanel is an open-sourced software licensed under the GPL-3.0 license.
## Funding
Buy me a Coffee ☕?
- PayPal [paypal.me/brettonye](https://www.paypal.com/paypalme/brettonye)
- USDT-TRC20 TFMxq91oPCnoxDXBiEgRzab5N6GFnAbTT5

View File

@@ -1,39 +1,43 @@
#!/usr/bin/env bash
#检查系统
check_sys(){
# shellcheck disable=SC2002
if [[ -f /etc/redhat-release ]]; then
release="centos"
elif cat /etc/issue | grep -q -E -i "debian"; then
release="debian"
elif cat /etc/issue | grep -q -E -i "ubuntu"; then
release="ubuntu"
elif cat /etc/issue | grep -q -E -i "centos|red hat|redhat"; then
release="centos"
elif cat /proc/version | grep -q -E -i "debian"; then
release="debian"
elif cat /proc/version | grep -q -E -i "ubuntu"; then
release="ubuntu"
elif cat /proc/version | grep -q -E -i "centos|red hat|redhat"; then
release="centos"
fi
check_sys() {
# shellcheck disable=SC2002
if [[ -f /etc/redhat-release ]]; then
release="centos"
elif cat /etc/issue | grep -q -E -i "debian"; then
release="debian"
elif cat /etc/issue | grep -q -E -i "ubuntu"; then
release="ubuntu"
elif cat /etc/issue | grep -q -E -i "centos|red hat|redhat"; then
release="centos"
elif cat /proc/version | grep -q -E -i "debian"; then
release="debian"
elif cat /proc/version | grep -q -E -i "ubuntu"; then
release="ubuntu"
elif cat /proc/version | grep -q -E -i "centos|red hat|redhat"; then
release="centos"
fi
}
#检查composer是否安装
check_composer(){
check_composer() {
if [ ! -f "/usr/bin/composer" ]; then
if [[ "${release}" == "centos" ]]; then
yum install -y composer
else
apt-get install -y composer
fi
if [[ "${release}" == "centos" ]]; then
yum install -y composer
else
apt-get install -y composer
fi
else
if [[ $(composer --version | cut -d" " -f3) < 2.2.0 ]]; then
composer self-update
fi
fi
}
# 设置权限
set_permissions(){
chown -R www:www ./
chmod -R 755 ./
chmod -R 777 storage/
set_permissions() {
chown -R www:www ./
chmod -R 755 ./
chmod -R 777 storage/
}
git fetch --all && git reset --hard origin/master && git pull