Commit 72ec3843f1173e86abfa19bdbdf4b89b1e0faf5a

Authored by Antonio Terceiro
1 parent 807d823c

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 if [ -e /etc/default/noosfero ]; then
8 8 . /etc/default/noosfero
9 9 else
10   - NOOSFERO_DIR=$(readlink -f `dirname $0`/..)
  10 + this_script=$(readlink -f $0)
  11 + NOOSFERO_DIR=$(dirname $this_script | xargs dirname)
11 12 fi
12 13  
13 14 # data
... ... @@ -19,6 +20,7 @@ disabled_plugins=$(printf "%s\n" $available_plugins $enabled_plugins_dir | sort
19 20  
20 21 # operation defaults
21 22 quiet=false
  23 +needs_migrate=false
22 24  
23 25 _list() {
24 26 for plugin in $available_plugins; do
... ... @@ -74,6 +76,7 @@ _enable(){
74 76 plugins_public_dir="$NOOSFERO_DIR/public/plugins"
75 77 test -d "$target/public/" && ln -s "$target/public" "$plugins_public_dir/$plugin"
76 78 _say "$plugin enabled"
  79 + needs_migrate=true
77 80 fi
78 81 }
79 82  
... ... @@ -159,13 +162,11 @@ case "$command" in
159 162 exit 1
160 163 fi
161 164 _$command
162   - exit 0
163 165 ;;
164 166 enable|disable|new)
165 167 for plugin in $@; do
166 168 _$command "$plugin"
167 169 done
168   - exit 0
169 170 ;;
170 171 *)
171 172 echo "Unknown command: $command"
... ... @@ -173,3 +174,21 @@ case "$command" in
173 174 exit 1
174 175 ;;
175 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
... ...