[Koha-devel] koha-plack --enable does not enable plack when plack has never been enabled
philippe kloos
wwwretive at yahoo.fr
Tue Jan 26 18:42:34 CET 2016
hello,
When running koha-plack --enable, the script assumes that there is
already a commented line that includes the plack configuration in the
apache virtual host's config of the instance. The script would comment
out the line :
(from /usr/sbin/koha-plack line 148) :
sed -i 's:^\s*#\(\s*Include
/etc/koha/apache-shared-opac-plack.conf\)$:\1:' "$instancefile"
sed -i 's:^\s*#\(\s*Include
/etc/koha/apache-shared-intranet-plack.conf\)$:\1:' "$instancefile"
For old fashioned installs there is no commented line that includes
plack configuration, so the regular expression doesn't match and the
script doesn't enable plack. In my config (we've set up koha 3 years
ago) i had to add the plack-related line directly in the apache virtual
host config.
Since the included files use the ${instance} variable, i had to define
that variable as well in my vhost config :
Define instance myinstancename
(the "Define" keyword is not well documented in the apache docs ; i used
it because SetEnv didn't work).
Instead of commenting out the (possibibly non-existent) plack related
lines, it is possible to find where the
"/etc/koha/apache-shared-{opac,intranet}.conf" files are included and
add the two relevant lines :
--- a/debian/scripts/koha-plack
+++ b/debian/scripts/koha-plack
@@ -144,9 +144,9 @@ enable_plack()
local instancefile=$(get_apache_config_for "$instancename")
if ! is_plack_enabled $instancename; then
- # Uncomment the plack related lines for OPAC and intranet
- sed -i 's:^\s*#\(\s*Include
/etc/koha/apache-shared-opac-plack.conf\)$:\1:' "$instancefile"
- sed -i 's:^\s*#\(\s*Include
/etc/koha/apache-shared-intranet-plack.conf\)$:\1:' "$instancefile"
+ # Define the instance name and add the plack related lines for
OPAC and intranet
+ sed -i "s:^\(\s*\)\(Include
/etc/koha/apache-shared-opac.conf\):\1\2\n\1Define instance
$instancename\n\1Include /etc/koha/apache-shared-opac-plack.conf:"
"$instancefile"
+ sed -i "s:^\(\s*\)\(Include
/etc/koha/apache-shared-intranet.conf\):\1\2\n\1Define instance
$instancename\n\1Include /etc/koha/apache-shared-intranet-plack.conf:"
"$instancefile"
[ "${quiet}" != "yes" ] && warn "Plack enabled for
${instancename}"
return 0
else
To disable plack, one could remove the two added lines (although
removing the "Define instance $instancename" line could have side effects).
Should i file a bug about this ?
Regards,
Philippe K.
https://laretive.info
More information about the Koha-devel
mailing list