Skip to content

Commit a40268a

Browse files
committed
chore: allow disable cash flushing on boot
1 parent f204f69 commit a40268a

File tree

11 files changed

+99
-44
lines changed

11 files changed

+99
-44
lines changed

init/20-acorn-php.sh

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,15 @@ if wp cache &>/dev/null; then
2727
echo "wp cache command is available"
2828

2929
# Run wp cache flush command
30-
echo "Flushing cache..."
31-
if ! wp cache flush; then
32-
echo "Failed to flush cache" >&2
33-
exit 1
30+
if [ "${SKIP_CACHE_FLUSH:-false}" = "true" ]; then
31+
echo "⚡ SKIP_CACHE_FLUSH est actif : On conserve le cache existant (Mode High-Traffic)."
32+
else
33+
echo "Flushing cache..."
34+
if ! wp cache flush; then
35+
echo "Failed to flush cache" >&2
36+
# On ne quitte pas forcément en erreur ici, car si Redis est down, le site peut quand même marcher
37+
# exit 1
38+
fi
3439
fi
3540
else
3641
echo "project is not using cache or cache is not installed... skipping cache commands."

latest/php8.1/apache-redis/init/20-acorn-php.sh

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,15 @@ if wp cache &>/dev/null; then
2727
echo "wp cache command is available"
2828

2929
# Run wp cache flush command
30-
echo "Flushing cache..."
31-
if ! wp cache flush; then
32-
echo "Failed to flush cache" >&2
33-
exit 1
30+
if [ "${SKIP_CACHE_FLUSH:-false}" = "true" ]; then
31+
echo "⚡ SKIP_CACHE_FLUSH est actif : On conserve le cache existant (Mode High-Traffic)."
32+
else
33+
echo "Flushing cache..."
34+
if ! wp cache flush; then
35+
echo "Failed to flush cache" >&2
36+
# On ne quitte pas forcément en erreur ici, car si Redis est down, le site peut quand même marcher
37+
# exit 1
38+
fi
3439
fi
3540
else
3641
echo "project is not using cache or cache is not installed... skipping cache commands."

latest/php8.1/apache/init/20-acorn-php.sh

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,15 @@ if wp cache &>/dev/null; then
2727
echo "wp cache command is available"
2828

2929
# Run wp cache flush command
30-
echo "Flushing cache..."
31-
if ! wp cache flush; then
32-
echo "Failed to flush cache" >&2
33-
exit 1
30+
if [ "${SKIP_CACHE_FLUSH:-false}" = "true" ]; then
31+
echo "⚡ SKIP_CACHE_FLUSH est actif : On conserve le cache existant (Mode High-Traffic)."
32+
else
33+
echo "Flushing cache..."
34+
if ! wp cache flush; then
35+
echo "Failed to flush cache" >&2
36+
# On ne quitte pas forcément en erreur ici, car si Redis est down, le site peut quand même marcher
37+
# exit 1
38+
fi
3439
fi
3540
else
3641
echo "project is not using cache or cache is not installed... skipping cache commands."

latest/php8.2/apache-redis/init/20-acorn-php.sh

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,15 @@ if wp cache &>/dev/null; then
2727
echo "wp cache command is available"
2828

2929
# Run wp cache flush command
30-
echo "Flushing cache..."
31-
if ! wp cache flush; then
32-
echo "Failed to flush cache" >&2
33-
exit 1
30+
if [ "${SKIP_CACHE_FLUSH:-false}" = "true" ]; then
31+
echo "⚡ SKIP_CACHE_FLUSH est actif : On conserve le cache existant (Mode High-Traffic)."
32+
else
33+
echo "Flushing cache..."
34+
if ! wp cache flush; then
35+
echo "Failed to flush cache" >&2
36+
# On ne quitte pas forcément en erreur ici, car si Redis est down, le site peut quand même marcher
37+
# exit 1
38+
fi
3439
fi
3540
else
3641
echo "project is not using cache or cache is not installed... skipping cache commands."

latest/php8.2/apache/init/20-acorn-php.sh

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,15 @@ if wp cache &>/dev/null; then
2727
echo "wp cache command is available"
2828

2929
# Run wp cache flush command
30-
echo "Flushing cache..."
31-
if ! wp cache flush; then
32-
echo "Failed to flush cache" >&2
33-
exit 1
30+
if [ "${SKIP_CACHE_FLUSH:-false}" = "true" ]; then
31+
echo "⚡ SKIP_CACHE_FLUSH est actif : On conserve le cache existant (Mode High-Traffic)."
32+
else
33+
echo "Flushing cache..."
34+
if ! wp cache flush; then
35+
echo "Failed to flush cache" >&2
36+
# On ne quitte pas forcément en erreur ici, car si Redis est down, le site peut quand même marcher
37+
# exit 1
38+
fi
3439
fi
3540
else
3641
echo "project is not using cache or cache is not installed... skipping cache commands."

latest/php8.3/apache-redis/init/20-acorn-php.sh

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,15 @@ if wp cache &>/dev/null; then
2727
echo "wp cache command is available"
2828

2929
# Run wp cache flush command
30-
echo "Flushing cache..."
31-
if ! wp cache flush; then
32-
echo "Failed to flush cache" >&2
33-
exit 1
30+
if [ "${SKIP_CACHE_FLUSH:-false}" = "true" ]; then
31+
echo "⚡ SKIP_CACHE_FLUSH est actif : On conserve le cache existant (Mode High-Traffic)."
32+
else
33+
echo "Flushing cache..."
34+
if ! wp cache flush; then
35+
echo "Failed to flush cache" >&2
36+
# On ne quitte pas forcément en erreur ici, car si Redis est down, le site peut quand même marcher
37+
# exit 1
38+
fi
3439
fi
3540
else
3641
echo "project is not using cache or cache is not installed... skipping cache commands."

latest/php8.3/apache/init/20-acorn-php.sh

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,15 @@ if wp cache &>/dev/null; then
2727
echo "wp cache command is available"
2828

2929
# Run wp cache flush command
30-
echo "Flushing cache..."
31-
if ! wp cache flush; then
32-
echo "Failed to flush cache" >&2
33-
exit 1
30+
if [ "${SKIP_CACHE_FLUSH:-false}" = "true" ]; then
31+
echo "⚡ SKIP_CACHE_FLUSH est actif : On conserve le cache existant (Mode High-Traffic)."
32+
else
33+
echo "Flushing cache..."
34+
if ! wp cache flush; then
35+
echo "Failed to flush cache" >&2
36+
# On ne quitte pas forcément en erreur ici, car si Redis est down, le site peut quand même marcher
37+
# exit 1
38+
fi
3439
fi
3540
else
3641
echo "project is not using cache or cache is not installed... skipping cache commands."

latest/php8.4/apache-redis/init/20-acorn-php.sh

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,15 @@ if wp cache &>/dev/null; then
2727
echo "wp cache command is available"
2828

2929
# Run wp cache flush command
30-
echo "Flushing cache..."
31-
if ! wp cache flush; then
32-
echo "Failed to flush cache" >&2
33-
exit 1
30+
if [ "${SKIP_CACHE_FLUSH:-false}" = "true" ]; then
31+
echo "⚡ SKIP_CACHE_FLUSH est actif : On conserve le cache existant (Mode High-Traffic)."
32+
else
33+
echo "Flushing cache..."
34+
if ! wp cache flush; then
35+
echo "Failed to flush cache" >&2
36+
# On ne quitte pas forcément en erreur ici, car si Redis est down, le site peut quand même marcher
37+
# exit 1
38+
fi
3439
fi
3540
else
3641
echo "project is not using cache or cache is not installed... skipping cache commands."

latest/php8.4/apache/init/20-acorn-php.sh

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,15 @@ if wp cache &>/dev/null; then
2727
echo "wp cache command is available"
2828

2929
# Run wp cache flush command
30-
echo "Flushing cache..."
31-
if ! wp cache flush; then
32-
echo "Failed to flush cache" >&2
33-
exit 1
30+
if [ "${SKIP_CACHE_FLUSH:-false}" = "true" ]; then
31+
echo "⚡ SKIP_CACHE_FLUSH est actif : On conserve le cache existant (Mode High-Traffic)."
32+
else
33+
echo "Flushing cache..."
34+
if ! wp cache flush; then
35+
echo "Failed to flush cache" >&2
36+
# On ne quitte pas forcément en erreur ici, car si Redis est down, le site peut quand même marcher
37+
# exit 1
38+
fi
3439
fi
3540
else
3641
echo "project is not using cache or cache is not installed... skipping cache commands."

legacy/php7.4/apache/init/20-acorn-php.sh

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,15 @@ if wp cache &>/dev/null; then
2727
echo "wp cache command is available"
2828

2929
# Run wp cache flush command
30-
echo "Flushing cache..."
31-
if ! wp cache flush; then
32-
echo "Failed to flush cache" >&2
33-
exit 1
30+
if [ "${SKIP_CACHE_FLUSH:-false}" = "true" ]; then
31+
echo "⚡ SKIP_CACHE_FLUSH est actif : On conserve le cache existant (Mode High-Traffic)."
32+
else
33+
echo "Flushing cache..."
34+
if ! wp cache flush; then
35+
echo "Failed to flush cache" >&2
36+
# On ne quitte pas forcément en erreur ici, car si Redis est down, le site peut quand même marcher
37+
# exit 1
38+
fi
3439
fi
3540
else
3641
echo "project is not using cache or cache is not installed... skipping cache commands."

0 commit comments

Comments
 (0)