Skip to content
Snippets Groups Projects
Commit e68c62fa authored by alvaro's avatar alvaro
Browse files

Added cache clear option to lodspk.sh

Included cache clearing everytime developer switches to/from debug or disable mode

Solved #89
parent 5116e3dd
No related branches found
No related tags found
No related merge requests found
...@@ -7,7 +7,8 @@ USAGE=$USAGE" Delete component:\t\t\t\t\t$0 delete uri|type|service foo [html|rd ...@@ -7,7 +7,8 @@ USAGE=$USAGE" Delete component:\t\t\t\t\t$0 delete uri|type|service foo [html|rd
USAGE=$USAGE" Turn debug:\t\t\t\t\t\t$0 debug on|off\n" USAGE=$USAGE" Turn debug:\t\t\t\t\t\t$0 debug on|off\n"
USAGE=$USAGE" Switch to standard view/models temporaly:\t\t$0 disable on|off\n" USAGE=$USAGE" Switch to standard view/models temporaly:\t\t$0 disable on|off\n"
USAGE=$USAGE" Backup current installation:\t\t\t\t$0 backup\n" USAGE=$USAGE" Backup current installation:\t\t\t\t$0 backup\n"
USAGE=$USAGE" Restore previous instllation:\t\t\t\t$0 restore\n" USAGE=$USAGE" Restore previous installation:\t\t\t\t$0 restore\n"
USAGE=$USAGE" Clear cache:\t\t\t\t\t\t$0 cache clear\n"
USAGEDEBUG="Usage: $0 debug on|off" USAGEDEBUG="Usage: $0 debug on|off"
if [[ $# -eq 0 || "$1" == "--help" ]]; then if [[ $# -eq 0 || "$1" == "--help" ]]; then
echo -e $USAGE echo -e $USAGE
...@@ -15,7 +16,7 @@ if [[ $# -eq 0 || "$1" == "--help" ]]; then ...@@ -15,7 +16,7 @@ if [[ $# -eq 0 || "$1" == "--help" ]]; then
fi fi
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
operations=( create delete debug backup restore disable ) operations=( create delete debug backup restore disable cache )
currentOperation= currentOperation=
if [[ ${operations[@]} =~ $1 ]]; then if [[ ${operations[@]} =~ $1 ]]; then
...@@ -83,10 +84,11 @@ if [[ $currentOperation == "debug" ]]; then ...@@ -83,10 +84,11 @@ if [[ $currentOperation == "debug" ]]; then
exit 1 exit 1
fi fi
php $DIR/modules/debug.php "$debugOperation" php $DIR/modules/debug.php "$debugOperation"
$DIR/modules/cache.sh clear
exit exit
fi fi
## Backup ## Disable
if [[ $currentOperation == "disable" ]]; then if [[ $currentOperation == "disable" ]]; then
defaultOptions=( on off 0 1 ) defaultOptions=( on off 0 1 )
defaultOperation= defaultOperation=
...@@ -99,5 +101,21 @@ if [[ $currentOperation == "disable" ]]; then ...@@ -99,5 +101,21 @@ if [[ $currentOperation == "disable" ]]; then
exit 1 exit 1
fi fi
php $DIR/modules/default.php "$defaultOperation" php $DIR/modules/default.php "$defaultOperation"
$DIR/modules/cache.sh clear
exit exit
fi fi
## Cache
if [[ $currentOperation == "cache" ]]; then
cacheOptions=( clear )
if [[ ${cacheOptions[@]} =~ $2 ]]
then
cacheOperation=$2
else
echo -e "Cache option not supported. Operation aborted\n" >&2
echo -e $USAGE
exit 1
fi
$DIR/modules/cache.sh $2
exit
fi
#!/bin/bash
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
cacheDir=$DIR/../../cache
if [[ $1 == "clear" ]]; then
if [ -d "$cacheDir" ]; then
rm -f $cacheDir/*
else
echo "ERROR: Couldn't find cache directory" >&2
exit 1
fi
else
echo "ERROR: Invalid command" >&2
exit 1
fi
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment