merge .bin/ and scripts/ into a common bin/

This commit is contained in:
Spine
2023-07-16 20:58:50 +00:00
parent 2ba799174e
commit d9358fc0af
35 changed files with 28 additions and 42 deletions

View File

@@ -38,7 +38,7 @@ do
done
composer --version && composer install --no-progress
scripts/local-patch
bin/local-patch
echo "Create postgres database..."
#hostname:port:database:username:password
@@ -88,9 +88,9 @@ fi
if [ ! -d /var/lib/gazelle/torrent ]; then
echo "Generate file storage directories..."
time (
perl "${CI_PROJECT_DIR}/scripts/generate-storage-dirs" /var/lib/gazelle/torrent 2 100
perl "${CI_PROJECT_DIR}/scripts/generate-storage-dirs" /var/lib/gazelle/riplog 2 100
perl "${CI_PROJECT_DIR}/scripts/generate-storage-dirs" /var/lib/gazelle/riploghtml 2 100
perl "${CI_PROJECT_DIR}/bin/generate-storage-dirs" /var/lib/gazelle/torrent 2 100
perl "${CI_PROJECT_DIR}/bin/generate-storage-dirs" /var/lib/gazelle/riplog 2 100
perl "${CI_PROJECT_DIR}/bin/generate-storage-dirs" /var/lib/gazelle/riploghtml 2 100
)
chown -R gazelle /var/lib/gazelle
fi

View File

@@ -1,2 +1,2 @@
PATH=$PATH:/var/www/scripts
PATH=$PATH:/var/www/bin
*/15 * * * * scheduler >> /tmp/schedule.log

View File

@@ -52,9 +52,9 @@ fi
if [ ! -d /var/lib/gazelle/torrent ]; then
echo "Generate file storage directories..."
perl /var/www/scripts/generate-storage-dirs /var/lib/gazelle/torrent 2 100
perl /var/www/scripts/generate-storage-dirs /var/lib/gazelle/riplog 2 100
perl /var/www/scripts/generate-storage-dirs /var/lib/gazelle/riploghtml 2 100
perl /var/www/bin/generate-storage-dirs /var/lib/gazelle/torrent 2 100
perl /var/www/bin/generate-storage-dirs /var/lib/gazelle/riplog 2 100
perl /var/www/bin/generate-storage-dirs /var/lib/gazelle/riploghtml 2 100
chown -R gazelle /var/lib/gazelle
fi

View File

@@ -45,7 +45,7 @@ phpstan:
- .composer
script:
- composer install --no-progress
- /bin/sh scripts/local-patch
- /bin/sh bin/local-patch
- phpstan analyse --no-progress --configuration misc/phpstan.neon
e2e-tests:
@@ -102,7 +102,7 @@ e2e-tests:
coverage: /^\s*Lines:\s*\d+.\d+\%/
script:
- /bin/bash "${CI_PROJECT_DIR}/.docker/web/bootstrap-base.sh"
- su gazelle -c "scripts/twig-parse \$(find templates -type f)"
- su gazelle -c "bin/twig-parse \$(find templates -type f)"
- /bin/bash "${CI_PROJECT_DIR}/.docker/web/start-services.sh"
- su gazelle -c "composer exec -- phpunit --configuration misc/phpunit.xml --coverage-php /tmp/coverage/phpunit.cov --exclude-group no-ci"
- /bin/bash "${CI_PROJECT_DIR}/.docker/web/bootstrap-yarn.sh"

View File

@@ -1,9 +1,9 @@
.DEFAULT_GOAL := help
NOW := $(shell date +'%Y%m%d-%H%M%S')
STORAGE_PATH_RIPLOG := $(shell scripts/getconf STORAGE_PATH_RIPLOG)
STORAGE_PATH_RIPLOGHTML := $(shell scripts/getconf STORAGE_PATH_RIPLOGHTML)
STORAGE_PATH_TORRENT := $(shell scripts/getconf STORAGE_PATH_TORRENT)
STORAGE_PATH_RIPLOG := $(shell bin/getconf STORAGE_PATH_RIPLOG)
STORAGE_PATH_RIPLOGHTML := $(shell bin/getconf STORAGE_PATH_RIPLOGHTML)
STORAGE_PATH_TORRENT := $(shell bin/getconf STORAGE_PATH_TORRENT)
.SILENT: help
.PHONY: help
@@ -63,7 +63,7 @@ lint-php:
.PHONY: lint-twig
lint-twig:
scripts/twig-parse $(find templates -type f)
bin/twig-parse $(find templates -type f)
.PHONY: mysqldump
mysqldump:

View File

@@ -15,7 +15,7 @@ class SSLHost extends \Gazelle\Base {
}
$notBefore = null;
$notAfter = null;
$output = explode("\n", trim((string)shell_exec(SERVER_ROOT . "/scripts/ssl-check $hostname $port")));
$output = explode("\n", trim((string)shell_exec(SERVER_ROOT . "/bin/ssl-check $hostname $port")));
if (count($output) != 2) {
return [];
}

View File

@@ -14,6 +14,7 @@ ini_set('max_execution_time', -1);
define('CHUNK', 100);
$offset = 0;
$last = 0;
$processed = 0;
$newLog = 0;
$errLog = 0;
@@ -40,8 +41,8 @@ while (true) {
while (list($logId, $torrentId, $log) = $db->next_record(MYSQLI_NUM, false)) {
$last = $logId;
++$processed;
if (file_exists($logFiler->pathLegacy([$torrentId, $logId])) && !file_exists($logFiler->path([$torrentId, $logId]))) {
if (!copy($logFiler->pathLegacy([$torrentId, $logId]), $logFiler->path([$torrentId, $logId]))) {
if (file_exists($logFiler->pathLegacy([$torrentId, $logId])) && !file_exists($logFiler->path([$torrentId, $logId]))) { /** @phpstan-ignore-line */
if (!copy($logFiler->pathLegacy([$torrentId, $logId]), $logFiler->path([$torrentId, $logId]))) { /** @phpstan-ignore-line */
++$errLog;
}
++$newLog;

View File

@@ -84,7 +84,7 @@ while (($file = fgets($find)) !== false) {
continue;
}
$db_digest = md5($db->scalar($config['MD5'], ...array_slice($match, 1)) . ($config['NEWLN'] ? "\n" : ''));
$file_digest = md5(file_get_contents($file));
$file_digest = md5((string)file_get_contents($file));
if ($db_digest != $file_digest) {
echo "$file contents $file_digest does not match db $db_digest\n";
++$mismatch;

View File

@@ -16,7 +16,7 @@ will be 5 rows (from the five voters) in the users_votes table, and the
torrents_votes table will contain one row with Total = 5, Ups = 3.
If the `torrents_votes` is ever corrupted, it may be recreated with
`scripts/rebuild-votes`. There is some discrepancy in the code between the
`bin/rebuild-votes`. There is some discrepancy in the code between the
above formula and the use of binomial_ci(Ups, Total).
The user and group vote information are both cached. As the user object can

View File

@@ -1,7 +1,7 @@
# These are the cron jobs.
# Adjust PATH according to where the repository is checked out on the filesystem
PATH=$PATH:/var/www/scripts
PATH=$PATH:/var/www/bin
0,15,30,45 * * * * scheduler >> /tmp/schedule.log
* * * * * /usr/bin/indexer -c /etc/sphinx/sphinx.conf --rotate delta requests_delta log_delta > /dev/null

View File

@@ -62,7 +62,7 @@ defined('BETA') or define('BETA', false);
// Path for storing temporary files (should be moved out of the root partition)
defined('TMPDIR') or define('TMPDIR', '/tmp');
// Paths for storing uploaded assets outside the database. See scripts/generate-storage-dirs
// Paths for storing uploaded assets outside the database. See bin/generate-storage-dirs
// Should also be moved out of the root partition.
defined('STORAGE_PATH_TORRENT') or define('STORAGE_PATH_TORRENT', '/var/lib/gazelle/torrent');
defined('STORAGE_PATH_RIPLOG') or define('STORAGE_PATH_RIPLOG', '/var/lib/gazelle/riplog');

View File

@@ -2180,21 +2180,6 @@ parameters:
count: 1
path: ../classes/view.class.php
-
message: "#^Call to an undefined method Gazelle\\\\File\\\\RipLog\\:\\:pathLegacy\\(\\)\\.$#"
count: 2
path: ../scripts/migrate-logs.php
-
message: "#^Variable \\$last might not be defined\\.$#"
count: 2
path: ../scripts/migrate-logs.php
-
message: "#^Parameter \\#1 \\$string of function md5 expects string, string\\|false given\\.$#"
count: 1
path: ../scripts/recheck-file-storage.php
-
message: "#^Parameter \\#1 \\$json of function json_decode expects string, string\\|false given\\.$#"
count: 1

View File

@@ -22,9 +22,9 @@ parameters:
paths:
- ../lib/util.php
- ../app
- ../bin
- ../classes
- ../misc/phinx
- ../scripts
- ../tests
- ../sections
parallel:
@@ -92,7 +92,7 @@ parameters:
-
message: '/^Variable \$(?:Cache|DB|Debug|SessionID|Twig|Viewer) might not be defined\.$/'
paths:
- ../scripts/*
- ../bin/*
- ../sections/*
-
message: '/^Variable \$Router might not be defined\.$/'

View File

@@ -7,14 +7,14 @@
"prod": "cross-env NODE_ENV=production yarn build",
"build": "yarn build:scss && yarn build:previews",
"build:scss": "webpack --no-progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js",
"build:previews": "node scripts/render_styles_preview.js",
"build:previews": "node bin/render_styles_preview.js",
"start": "yarn build:scss -- --watch",
"lint:css": "stylelint \"sass/**/*.scss\" || exit 0",
"lint:css-checkstyle": "stylelint \"sass/**/*.scss\" --custom-formatter ./node_modules/stylelint-checkstyle-formatter/index.js || exit 0",
"lint:php:internal": "find . -path './vendor' -prune -o -path ./node_modules -prune -o -path './.docker' -prune -o -type f -name '*.php' -print0 | xargs -0 -n1 -P4 php -l -n | (! grep -v \"No syntax errors detected\" )",
"lint:php:phpcs": "vendor/bin/phpcs -p --report-width 1000",
"lint:php": "yarn lint:php:internal && yarn lint:php:phpcs",
"lint:php:fix": "./.bin/phpcbf",
"lint:php:fix": "bin/phpcbf",
"pre-commit": "yarn lint:php:fix",
"prepare": "husky install"
},
@@ -44,8 +44,8 @@
"lint-staged": {
"*.php": [
"vendor/bin/phpstan analyze --no-progress --configuration=misc/phpstan.neon --memory-limit 512M",
".bin/phpcs",
".bin/phpcbf"
"bin/phpcs",
"bin/phpcbf"
]
},
"browserslist": [