From 6c06d9fb6a5e2d2a5cdf770b7a29ffdfe2a59b1b Mon Sep 17 00:00:00 2001 From: hxsf Date: Fri, 24 Jul 2020 13:36:33 +0800 Subject: [PATCH 1/2] add new DockerFile and docker-compose example --- .dockerignore | 95 ++++++++++++++++++++++++++++++++++++++ docker/Dockerfile | 17 +++++-- docker/docker-compose.yaml | 11 +++++ docker/entrypoint.sh | 10 ++++ 4 files changed, 130 insertions(+), 3 deletions(-) create mode 100644 .dockerignore create mode 100644 docker/docker-compose.yaml create mode 100755 docker/entrypoint.sh diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..2f1a185 --- /dev/null +++ b/.dockerignore @@ -0,0 +1,95 @@ +/docker +!/docker/entrypoint.sh +# Created by https://www.toptal.com/developers/gitignore/api/osx,linux,windows,visualstudiocode,composer +# Edit at https://www.toptal.com/developers/gitignore?templates=osx,linux,windows,visualstudiocode,composer + +### Composer ### +composer.phar +/vendor/ + +# Commit your application's lock file https://getcomposer.org/doc/01-basic-usage.md#commit-your-composer-lock-file-to-version-control +# You may choose to ignore a library lock file http://getcomposer.org/doc/02-libraries.md#lock-file +# composer.lock + +### Linux ### +*~ + +# temporary files which can be created if a process still has a handle open of a deleted file +.fuse_hidden* + +# KDE directory preferences +.directory + +# Linux trash folder which might appear on any partition or disk +.Trash-* + +# .nfs files are created when an open file is removed but is still being accessed +.nfs* + +### OSX ### +# General +.DS_Store +.AppleDouble +.LSOverride + +# Icon must end with two \r +Icon + +# Thumbnails +._* + +# Files that might appear in the root of a volume +.DocumentRevisions-V100 +.fseventsd +.Spotlight-V100 +.TemporaryItems +.Trashes +.VolumeIcon.icns +.com.apple.timemachine.donotpresent + +# Directories potentially created on remote AFP share +.AppleDB +.AppleDesktop +Network Trash Folder +Temporary Items +.apdisk + +### VisualStudioCode ### +.vscode/* +!.vscode/settings.json +!.vscode/tasks.json +!.vscode/launch.json +!.vscode/extensions.json +*.code-workspace + +### VisualStudioCode Patch ### +# Ignore all local history of files +.history + +### Windows ### +# Windows thumbnail cache files +Thumbs.db +Thumbs.db:encryptable +ehthumbs.db +ehthumbs_vista.db + +# Dump file +*.stackdump + +# Folder config file +[Dd]esktop.ini + +# Recycle Bin used on file shares +$RECYCLE.BIN/ + +# Windows Installer files +*.cab +*.msi +*.msix +*.msm +*.msp + +# Windows shortcuts +*.lnk + +# End of https://www.toptal.com/developers/gitignore/api/osx,linux,windows,visualstudiocode,composer diff --git a/docker/Dockerfile b/docker/Dockerfile index 9775c86..becf86e 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -1,3 +1,14 @@ -FROM php:7.4-fpm -EXPOSE 9000 -WORKDIR /var/www \ No newline at end of file +FROM composer:1.10.9 + +ENV TZ Asia/Shanghai +ENV cron="0 */1 * * *" + +COPY . /IYUU +COPY ./docker/entrypoint.sh /entrypoint.sh + +WORKDIR /IYUU + +RUN apk add --no-cache bash tzdata \ + && composer i + +ENTRYPOINT [ "/entrypoint.sh" ] diff --git a/docker/docker-compose.yaml b/docker/docker-compose.yaml new file mode 100644 index 0000000..0bd7ff5 --- /dev/null +++ b/docker/docker-compose.yaml @@ -0,0 +1,11 @@ +version: "2.3" +services: + app: + image: hxsf/iyuuautoreseed + network_mode: host + environment: + - cron=0 * * * * + volumes: + - ./config:/IYUU/config + - ./torrent:/IYUU/torrent + restart: always diff --git a/docker/entrypoint.sh b/docker/entrypoint.sh new file mode 100755 index 0000000..9c87da8 --- /dev/null +++ b/docker/entrypoint.sh @@ -0,0 +1,10 @@ +#!/bin/bash +DEFAULT_CRON="0 */1 * * *" +cron=${cron:-$DEFAULT_CRON} +set -e + +echo "$cron /usr/local/bin/php /IYUU/iyuu.php" | crontab - + +/usr/local/bin/php /IYUU/iyuu.php + +/usr/sbin/crond -f From c5c2feb9d303a5e3824a0189c5551c0fec23e8ec Mon Sep 17 00:00:00 2001 From: hxsf Date: Fri, 24 Jul 2020 13:39:22 +0800 Subject: [PATCH 2/2] add notify_on_change feature --- .gitignore | 93 ++++++++++++++++++++++++++++++++++++++++ app/AutoReseed.php | 4 ++ config/config.sample.php | 2 + 3 files changed, 99 insertions(+) create mode 100644 .gitignore diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..90b253e --- /dev/null +++ b/.gitignore @@ -0,0 +1,93 @@ +/config/config.php +# Created by https://www.toptal.com/developers/gitignore/api/osx,linux,windows,visualstudiocode,composer +# Edit at https://www.toptal.com/developers/gitignore?templates=osx,linux,windows,visualstudiocode,composer + +### Composer ### +composer.phar + +# Commit your application's lock file https://getcomposer.org/doc/01-basic-usage.md#commit-your-composer-lock-file-to-version-control +# You may choose to ignore a library lock file http://getcomposer.org/doc/02-libraries.md#lock-file +# composer.lock + +### Linux ### +*~ + +# temporary files which can be created if a process still has a handle open of a deleted file +.fuse_hidden* + +# KDE directory preferences +.directory + +# Linux trash folder which might appear on any partition or disk +.Trash-* + +# .nfs files are created when an open file is removed but is still being accessed +.nfs* + +### OSX ### +# General +.DS_Store +.AppleDouble +.LSOverride + +# Icon must end with two \r +Icon + +# Thumbnails +._* + +# Files that might appear in the root of a volume +.DocumentRevisions-V100 +.fseventsd +.Spotlight-V100 +.TemporaryItems +.Trashes +.VolumeIcon.icns +.com.apple.timemachine.donotpresent + +# Directories potentially created on remote AFP share +.AppleDB +.AppleDesktop +Network Trash Folder +Temporary Items +.apdisk + +### VisualStudioCode ### +.vscode/* +!.vscode/settings.json +!.vscode/tasks.json +!.vscode/launch.json +!.vscode/extensions.json +*.code-workspace + +### VisualStudioCode Patch ### +# Ignore all local history of files +.history + +### Windows ### +# Windows thumbnail cache files +Thumbs.db +Thumbs.db:encryptable +ehthumbs.db +ehthumbs_vista.db + +# Dump file +*.stackdump + +# Folder config file +[Dd]esktop.ini + +# Recycle Bin used on file shares +$RECYCLE.BIN/ + +# Windows Installer files +*.cab +*.msi +*.msix +*.msm +*.msp + +# Windows shortcuts +*.lnk + +# End of https://www.toptal.com/developers/gitignore/api/osx,linux,windows,visualstudiocode,composer diff --git a/app/AutoReseed.php b/app/AutoReseed.php index b9d8e2b..f08920d 100644 --- a/app/AutoReseed.php +++ b/app/AutoReseed.php @@ -851,6 +851,10 @@ class AutoReseed */ private static function wechatMessage() { + global $configALL; + if ($configALL['notify_on_change'] && self::$wechatMsg['reseedSuccess'] == 0 && self::$wechatMsg['reseedError'] == 0) { + return; + } $br = PHP_EOL; $text = 'IYUU自动辅种-统计报表'; $desp = '### 版本号:'. self::VER . $br; diff --git a/config/config.sample.php b/config/config.sample.php index f3352ca..7188eec 100644 --- a/config/config.sample.php +++ b/config/config.sample.php @@ -17,6 +17,8 @@ php ./iyuu.php */ return array( + // 有变化才发送通知(辅种成功 + 失败 > 0) + 'notify_on_change' => false, // 1.【必须配置】爱语飞飞 微信通知,请访问https://iyuu.cn 用微信扫码申请 'iyuu.cn' => 'IYUU', // 2.全局默认配置