post-checkout.sh
uložit jako.git/hooks/post-checkout
.invalidate-opcache.php
jakowww/.invalidate-opcache.php
(POZOR! - tenhle soubor buďto na produkci nenahrávat, nebo zablokovat přístup!)
Last active
October 27, 2018 16:15
-
-
Save fprochazka/4c92cd5d0a1f100d2f0d to your computer and use it in GitHub Desktop.
.git/hooks/post-checkout
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
if (function_exists("opcache_reset")) { | |
opcache_reset(); | |
} | |
if (function_exists("apc_clear_cache")) { | |
apc_clear_cache(); | |
apc_clear_cache("user"); | |
} | |
echo "Opcache invalidated\n"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
oldrev="$1" | |
newrev="$2" | |
# --- Safety check | |
if [ -z "$GIT_DIR" ]; then | |
echo "Don't run this script from the command line." >&2 | |
echo " (if you want, you could supply GIT_DIR then run" >&2 | |
echo " $0<oldrev> <newrev>)" >&2 | |
exit 1 | |
fi | |
echo "[Cache]: flushing redis db 2 ... $(redis-cli -n 2 flushdb)" | |
echo "[Cache]: cleaning filesystem cache ..." | |
/bin/rm -R $(pwd)/temp/cache/*/ 2> /dev/null | |
/bin/rm -R $(pwd)/tests/tmp/*/ 2> /dev/null | |
echo "[Cache]: http... $(curl --silent http://rohlik.l/.invalidate-opcache.php)" | |
echo "[Cache]: cli... $(php $GIT_DIR/../www/.invalidate-opcache.php)" | |
echo "[Composer]: $(composer --working-dir="$GIT_DIR/.." dump-autoload)" | |
# /usr/local/bin/php $(pwd)/www/index.php orm:generate:proxies 1> $(pwd)/log/generate-proxies.log & | |
# --- Finished | |
exit 0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Ten invalidate-opcache samozřejmě na produkci není veřejně přístupný ;)