mirror of
https://gh.wpcy.net/https://github.com/aspirepress/AspireSync.git
synced 2026-05-30 23:44:03 +08:00
36 lines
1.2 KiB
Bash
Executable file
36 lines
1.2 KiB
Bash
Executable file
#!/usr/bin/env bash
|
|
|
|
. $(dirname $0)/prelude.bash
|
|
|
|
TMPDIR=${TMPDIR:-/tmp}
|
|
|
|
LOOKBACK_INTERVAL=${LOOKBACK_INTERVAL:--2 days}
|
|
RECHECK_INTERVAL=${RECHECK_INTERVAL:--4 hours}
|
|
|
|
verbosity=-vv
|
|
|
|
function main () {
|
|
plugins=$(mktemp $TMPDIR/plugins.list.XXXXXXXX)
|
|
themes=$(mktemp $TMPDIR/themes.list.XXXXXXXX)
|
|
trap "rm -f $plugins $themes" EXIT
|
|
|
|
# Doesn't really belong here, but it's cheap enough to run
|
|
bin/console doctrine:migrations:migrate --quiet --no-interaction
|
|
|
|
ymd=$(php -r "echo date('Y-m-d', strtotime('$LOOKBACK_INTERVAL'));")
|
|
[[ -n "$ymd" ]] || die "Could not parse a date from '$LOOKBACK_INTERVAL'"
|
|
|
|
svn/bin/ls-updated-plugins $ymd | sort > $plugins
|
|
svn/bin/ls-updated-themes $ymd | sort > $themes
|
|
|
|
bin/console sync:fetch:plugins $verbosity --slugs-from=$plugins --skip-checked-after="$RECHECK_INTERVAL"
|
|
bin/console sync:fetch:themes $verbosity --slugs-from=$themes --skip-checked-after="$RECHECK_INTERVAL"
|
|
|
|
bin/popular-plugins 100 | jq -r '.slug' | sort > $plugins
|
|
bin/popular-themes 100 | jq -r '.slug' | sort > $themes
|
|
|
|
bin/console sync:fetch:plugins $verbosity --slugs-from=$plugins --skip-checked-after="$RECHECK_INTERVAL"
|
|
bin/console sync:fetch:themes $verbosity --slugs-from=$themes --skip-checked-after="$RECHECK_INTERVAL"
|
|
}
|
|
|
|
main "$@"
|