Commit 72ec3843f1173e86abfa19bdbdf4b89b1e0faf5a
1 parent
807d823c
Exists in
staging
and in
42 other branches
Warn users that enabling plugin needs a restart
It also needs a database migration run, but since ./script/production will now run `rake db:migrate`, user don't need to perform this this step explicitly.
Showing
1 changed file
with
22 additions
and
3 deletions
Show diff stats
script/noosfero-plugins
| @@ -7,7 +7,8 @@ program_name=$(basename $0) | @@ -7,7 +7,8 @@ program_name=$(basename $0) | ||
| 7 | if [ -e /etc/default/noosfero ]; then | 7 | if [ -e /etc/default/noosfero ]; then |
| 8 | . /etc/default/noosfero | 8 | . /etc/default/noosfero |
| 9 | else | 9 | else |
| 10 | - NOOSFERO_DIR=$(readlink -f `dirname $0`/..) | 10 | + this_script=$(readlink -f $0) |
| 11 | + NOOSFERO_DIR=$(dirname $this_script | xargs dirname) | ||
| 11 | fi | 12 | fi |
| 12 | 13 | ||
| 13 | # data | 14 | # data |
| @@ -19,6 +20,7 @@ disabled_plugins=$(printf "%s\n" $available_plugins $enabled_plugins_dir | sort | @@ -19,6 +20,7 @@ disabled_plugins=$(printf "%s\n" $available_plugins $enabled_plugins_dir | sort | ||
| 19 | 20 | ||
| 20 | # operation defaults | 21 | # operation defaults |
| 21 | quiet=false | 22 | quiet=false |
| 23 | +needs_migrate=false | ||
| 22 | 24 | ||
| 23 | _list() { | 25 | _list() { |
| 24 | for plugin in $available_plugins; do | 26 | for plugin in $available_plugins; do |
| @@ -74,6 +76,7 @@ _enable(){ | @@ -74,6 +76,7 @@ _enable(){ | ||
| 74 | plugins_public_dir="$NOOSFERO_DIR/public/plugins" | 76 | plugins_public_dir="$NOOSFERO_DIR/public/plugins" |
| 75 | test -d "$target/public/" && ln -s "$target/public" "$plugins_public_dir/$plugin" | 77 | test -d "$target/public/" && ln -s "$target/public" "$plugins_public_dir/$plugin" |
| 76 | _say "$plugin enabled" | 78 | _say "$plugin enabled" |
| 79 | + needs_migrate=true | ||
| 77 | fi | 80 | fi |
| 78 | } | 81 | } |
| 79 | 82 | ||
| @@ -159,13 +162,11 @@ case "$command" in | @@ -159,13 +162,11 @@ case "$command" in | ||
| 159 | exit 1 | 162 | exit 1 |
| 160 | fi | 163 | fi |
| 161 | _$command | 164 | _$command |
| 162 | - exit 0 | ||
| 163 | ;; | 165 | ;; |
| 164 | enable|disable|new) | 166 | enable|disable|new) |
| 165 | for plugin in $@; do | 167 | for plugin in $@; do |
| 166 | _$command "$plugin" | 168 | _$command "$plugin" |
| 167 | done | 169 | done |
| 168 | - exit 0 | ||
| 169 | ;; | 170 | ;; |
| 170 | *) | 171 | *) |
| 171 | echo "Unknown command: $command" | 172 | echo "Unknown command: $command" |
| @@ -173,3 +174,21 @@ case "$command" in | @@ -173,3 +174,21 @@ case "$command" in | ||
| 173 | exit 1 | 174 | exit 1 |
| 174 | ;; | 175 | ;; |
| 175 | esac | 176 | esac |
| 177 | + | ||
| 178 | +if [ "$needs_migrate" = 'true' ]; then | ||
| 179 | + cat <<-EOF | ||
| 180 | +==================================================================== | ||
| 181 | +To finish the activation of the plugins you have just enabled, you | ||
| 182 | +need to restart Noosfero. | ||
| 183 | + | ||
| 184 | +If you installed Noosfero manually, run: | ||
| 185 | + | ||
| 186 | + $ ./script/production restart | ||
| 187 | + | ||
| 188 | +If you installed Noosfero using Debian packages, run as root: | ||
| 189 | + | ||
| 190 | + # service noosfero restart | ||
| 191 | + | ||
| 192 | +==================================================================== | ||
| 193 | +EOF | ||
| 194 | +fi |